X-Git-Url: http://git.jankratochvil.net/?p=PerlMail.git;a=blobdiff_plain;f=perlmail-accept;h=a96e1778a03ca0260e951a7eeffd62b4f4e223e5;hp=5abd067e40f5ac96d581d404281f145ccd582fde;hb=cbf136ac0505a12a6984f83e5a0887ffff1be055;hpb=d3f7164a228e46921c5a9acaab1c086461e209bd diff --git a/perlmail-accept b/perlmail-accept index 5abd067..a96e177 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||="$HOME/bin/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; } }