Fixed 'dnsbl_whitelist'
authorshort <>
Fri, 4 Apr 2003 18:51:14 +0000 (18:51 +0000)
committershort <>
Fri, 4 Apr 2003 18:51:14 +0000 (18:51 +0000)
$IdleMax adjusted to 10s
Fixes about idle "away" file

perlmail-accept

index f51f0db..192ffce 100755 (executable)
@@ -52,7 +52,7 @@ require WWW::SMS;
 my $HOME="/home/lace";
 my $Mail="$HOME/Mail";
 my @ValidUsers=qw(root lace short kratochvil _local);
-my $IdleMax=120;
+my $IdleMax=10;
 my $MaxBodySMS=0x1000; # max bytes to pass to Lingua::EN::Squeeze
 my $SMSmailError='short+err@ucw.cz';
 my @SMSwebRcpt=qw(420 602 431329);
@@ -60,8 +60,9 @@ my $SMSwebRcpt_username="lace2";
 my $SMScontact='<short@ucw.cz>';
 
 our($Message,$Audit,@AuditStored,$store_ignore,$store_ignorenewmail,$store_profile,$DoBell);
-our(%audit_profile,@sms_squeezes,@alternates_host);    # imported
+our(%audit_profile,@sms_squeezes,@alternates_host,@dnsbl_whitelist);   # imported
 my %alternates_host;   # from @alternates_host
+my %dnsbl_whitelist;   # from @dnsbl_whitelist
 
 # from RedHat "procmail-3.22-5"
 # /i should be only $procmailFROM_DAEMON but how it can hurt to /i all?
@@ -142,7 +143,7 @@ sub bell
 
 sub useridle
 {
-       return 0 if ! -e $ENV{"HOME"}."/idle";
+       return 0 if ! -e "$HOME/away";
        my %valid_users=map(($_=>1),@ValidUsers);
        my($idlebest,$linebest);
        for my $utmp (User::Utmp::getut(),{ "ut_line"=>"psaux" }) {
@@ -514,10 +515,6 @@ sub Received_for
        return @r;
 }
 
-my %dnsbl_whitelist=map(($_=>1),(
-               "195.250.128.83"        # smtp3.vol.cz; 83.128.250.195.blackholes.five-ten-sg.com
-               ));
-
 # Extended Mail::Audit::MAPS
 # $domain,$full,[$timeout]
 sub dnsbl
@@ -527,8 +524,9 @@ my($domain,$full,$timeout)=@_;
        $timeout||=30;  # sec
        $Mail::Audit::MAPS::host=$domain;
        my @hosts=map({ s/^.*://; "[$_]"; }     # strip DNS part
-                       grep({ /^([^:@]*):/ && !$alternates_host{$1}    # leave only foreign hosts
-                                       && !$dnsbl_whitelist{$1}; } (Received_for()))
+                       grep({ /^([^:@]*):/     # $1 is DNS name, $' is IP address
+                                       && !$alternates_host{$1}        # leave only foreign hosts
+                                       && !$dnsbl_whitelist{$'}; } (Received_for()))
                        );
        splice @hosts,1 if !$full && @hosts;    # "&& @hosts" to prevent: WARN: splice() offset past end of array
        {
@@ -760,6 +758,7 @@ open AUDIT,$filenameMyAudit or die "open \"$filenameMyAudit\": $!";
        eval <AUDIT> or die "eval \"$filenameMyAudit\": $@";
        audit_init();
        %alternates_host=map((lc($_)=>1),@alternates_host);
+       %dnsbl_whitelist=map((   $_ =>1),@dnsbl_whitelist);
        }
 close AUDIT or warn "close \"$filenameMyAudit\": $!";