X-Git-Url: http://git.jankratochvil.net/?p=PerlMail.git;a=blobdiff_plain;f=perlmail-accept;h=81d1bd731f5ef4085331e4323bdb56605dba14cd;hp=d9a944d585a8ab87a820b898ebed66104384bda6;hb=61092e868f2245891e6000543fbc1ed1cbe36f0d;hpb=f29d6dc23ac3e500c8afad40a165f3d45fb67998 diff --git a/perlmail-accept b/perlmail-accept index d9a944d..81d1bd7 100755 --- a/perlmail-accept +++ b/perlmail-accept @@ -192,6 +192,12 @@ sub body_first return $first; } +sub is_multipart +{ + return 0 if !$Audit->is_mime(); + return $Audit->is_multipart(); +} + sub mimehead { my($part)=@_; @@ -498,11 +504,13 @@ sub _spamchildcode my($err,$isspam)=@_; $err=$? if !defined $err; - return undef() if !WIFEXITED($?); - return undef() if WIFSIGNALED($?); - return undef() if WIFSTOPPED($?); - return $isspam||1 if WEXITSTATUS($?); # is-spam - return 0; # not-spam + return undef() if !WIFEXITED($?); + return undef() if WIFSIGNALED($?); + return undef() if WIFSTOPPED($?); + return 0 if !WEXITSTATUS($?); + return $isspam||1 if 1==WEXITSTATUS($?); # isspam + cluck "Possible FIXME or your system is broken (WEXITSTATUS==".WEXITSTATUS($?).")"; + return 0; # simulate as not spam } # return: true (error-message or "1") if is spam @@ -510,8 +518,9 @@ sub spamassassin { my($cmd)=@_; - $cmd||="$HOME/bin/spamassassin --exit-code"; - # spamassassin has exit code 1 if IS spam, code 0 if NOT spam + $cmd||="spamassassin --exit-code 1"; + # spamassassin has the specified exit code if IS spam, code 0 if NOT spam + # See &_spamchildcode for the code 1. local *CHILD; local $SIG{"PIPE"}=sub { warn "spamassassin gave me SIGPIPE: broken pipe"; }; # prevent Razor2's: Can't call method "log" on unblessed reference at Razor2/Client/Agent.pm line 212. @@ -566,7 +575,9 @@ my($domain,$full,$timeout)=@_; my $code=Mail::Audit::rblcheck($self_faked,$timeout); next if !$code; # Some 0.0.0.0 etc. found for , see: &Mail::Audit::MAPS::_checkit - return $code if $code!='1 Invalid IP address '; + # Do not: $code!='1 Invalid IP address ' + # as it causes warn. + return $code if $code ne '1 Invalid IP address '; return if !$full; } } @@ -600,7 +611,9 @@ my($cmd)=@_; my $err=$?; $pidcheck && $pidcheck==$pid or do { cluck "waitpid for $cmd returned $pidcheck!=$pid"; return 0; }; - $status=~s/^stdin: //; + $status=~s/^stdin: //mg; + # Prevent: LibClamAV Warning: PGP encoded attachment not scanned + $status=~s/^.*\bwarning:.*\n//img; $status=~s/\n$//; return $status if $status ne "OK" && $status; return _spamchildcode $err,$status;