Fix Postfix/Amavis discarded spam and virus that appears with status sent. Thanks to Miquel Angel Daniel Veny for the report.

This commit is contained in:
Darold Gilles 2015-10-06 19:35:04 +02:00
parent 0328605ccd
commit f53248c920
2 changed files with 28 additions and 2 deletions

View file

@ -3043,7 +3043,7 @@ sub display_postgreyflow
return;
}
print qq {
print qq{
<table width="80%"><td valign="top">
<table align="center">
<tr><th colspan="3" class="thhead">$TRANSLATE{'Postgrey Status'}</th></tr>
@ -3190,7 +3190,7 @@ sub display_top_sender
}
$top++;
}
my $other_percent = 100 - sprintf("%.2f", ($percent_total*100)/$totalrelay);
my $other_percent = 100 - sprintf("%.2f", ($percent_total*100)/($totalrelay||1));
$relays{"Others"} = $other_percent if ($other_percent > 0);
delete $topsender{relay};

View file

@ -943,6 +943,32 @@ sub parse_sendmail
$KEEP_TEMPORARY{$1} = $id;
return;
}
# Spam message discarded by amavisd and reported as sent must be affected to spam
if ($status =~ /sent \(250 [^,]+, ([^,]+), .* spam\)/) {
$status = ucfirst($1);
$SPAM{$host}{$id}{relay} = $relay;
$SPAM{$host}{$id}{rule} = 'discarded';
$SPAM{$host}{$id}{spam} = "Amavis $status spam";
$SPAM{$host}{$id}{date} = $time_st;
$SPAM{$host}{$id}{from} = $FROM{$host}{$id}{from} if (exists $FROM{$host}{$id}{from});
if ($CONFIG{SPAM_DETAIL}) {
$SPAMDETAIL{$host}{$id}{date} = $time_st;
$SPAMDETAIL{$host}{$id}{type} = 'amavis';
$SPAMDETAIL{$host}{$id}{spam} = $status;
}
return;
}
# Virus message discarded by amavisd and reported as sent must be affected to virus
if ($status =~ /sent \(250 [^,]+, ([^,]+), .* INFECTED: (.*)\)/) {
$status = ucfirst($1);
$VIRUS{$host}{$id}{file} = 'Inline';
$VIRUS{$host}{$id}{virus} = $2;
$VIRUS{$host}{$id}{relay} = $relay;
$VIRUS{$host}{$id}{from} = $FROM{$host}{$id}{from} if (exists $FROM{$host}{$id}{from});
$VIRUS{$host}{$id}{to} = $to;
$VIRUS{$host}{$id}{date} = $time_st;
return;
}
if ($status =~ /sent \(250 OK, sent [^\s]+ ([^\)]+)\)/) {
$KEEP_TEMPORARY{$1} = $id;
return;