Round up days_ago to the next highest integer
authorArt Cancro <ajc@citadel.org>
Thu, 1 Jun 2023 23:39:19 +0000 (19:39 -0400)
committerArt Cancro <ajc@citadel.org>
Thu, 1 Jun 2023 23:39:19 +0000 (19:39 -0400)
infanticide.pm

index e45a2925ca6a1840c6aae4434942073b18779025..3ad11d8e2f0cd4bfd3de3d5fd057f35679eda098 100755 (executable)
@@ -9,8 +9,8 @@ package infanticide;
 use Mail::SpamAssassin::Plugin;
 use Sys::Syslog;
 use Sys::Syslog qw(:standard :macros);
-#use Time::Local;
 use HTTP::Date;
+use POSIX;
 
 
 our @ISA = qw(Mail::SpamAssassin::Plugin);
@@ -66,11 +66,11 @@ sub check_for_disposable_domain() {
        my $domain = $fromarr[1];
        my $creationDate = infanticide_get_creation_date($domain);
        if ($creationDate eq "") {
-               syslog('debug', "infanticide: " . $counter . " no creation date for " . $domain);
+               syslog('debug', "infanticide: no creation date for " . $domain);
                return(0);
        }
        my $dt = str2time($creationDate);
-       my $daysAgo = (time() - $dt) / 86400;
+       my $daysAgo = ceil((time() - $dt) / 86400);
        syslog("debug", "infanticide: " . $domain . " was created " . $daysAgo . " days ago");
        if ($daysAgo < 30) {
                return(1);