You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2008/10/14 18:01:15 UTC
svn commit: r704570 -
/spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
Author: mmartinec
Date: Tue Oct 14 09:01:14 2008
New Revision: 704570
URL: http://svn.apache.org/viewvc?rev=704570&view=rev
Log:
AutoWhitelist.pm: reset an AWL entry with bad data when one is encountered
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm?rev=704570&r1=704569&r2=704570&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm Tue Oct 14 09:01:14 2008
@@ -147,16 +147,17 @@
}
}
- if ($entry->{count} == 0) {
- return undef;
- } elsif ($entry->{totscore} != $entry->{totscore}) {
- warn "auto-whitelist: totscore for ($addr, $origip) is a NaN, ignored\n";
- return undef;
- } elsif ($entry->{count} != $entry->{count}) {
- warn "auto-whitelist: count for ($addr, $origip) is a NaN, ignored\n";
- return undef;
+ if ($entry->{count} < 0 ||
+ $entry->{count} != $entry->{count} || # test for NaN
+ $entry->{totscore} != $entry->{totscore})
+ {
+ warn "auto-whitelist: resetting bad data for ($addr, $origip), ".
+ "count: $entry->{count}, totscore: $entry->{totscore}\n";
+ $entry->{count} = $entry->{totscore} = 0;
}
+ if ($entry->{count} == 0) { return undef }
+
return $entry->{totscore} / $entry->{count};
}
@@ -210,7 +211,7 @@
}
if ($score != $score) {
warn "auto-whitelist: attempt to add a $score to AWL entry ignored\n";
- return undef; # don't try to add a NaN, just in case
+ return undef; # don't try to add a NaN
}
$self->{entry}->{count} ||= 0;
@@ -275,7 +276,7 @@
# remove address only, no new score to add
if (!defined $score) { return 1; }
- if ($score != $score) { return 1; } # don't try to add a NaN, just in case
+ if ($score != $score) { return 1; } # don't try to add a NaN
# else add score. get a new entry first
$entry = $self->{checker}->get_addr_entry ($fulladdr, $signedby);