You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2005/03/12 03:02:07 UTC

svn commit: r157204 - in spamassassin/trunk: MANIFEST lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm rules/60_whitelist.cf t/blacklist_autolearn.t

Author: jm
Date: Fri Mar 11 18:02:03 2005
New Revision: 157204

URL: http://svn.apache.org/viewcvs?view=rev&rev=157204
Log:
bug 2788: doco fixes for blacklist rules where autolearning is concerned; also bug 2865: don't learn messages as ham if they were previously marked spam by the classifier (due to blacklists etc.), and vice-versa.

Added:
    spamassassin/trunk/t/blacklist_autolearn.t   (with props)
Modified:
    spamassassin/trunk/MANIFEST
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm
    spamassassin/trunk/rules/60_whitelist.cf

Modified: spamassassin/trunk/MANIFEST
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/MANIFEST?view=diff&r1=157203&r2=157204
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Fri Mar 11 18:02:03 2005
@@ -239,6 +239,7 @@
 t/bayesdbm.t
 t/bayesdbm_flock.t
 t/bayessql.t
+t/blacklist_autolearn.t
 t/body_mod.t
 t/cidrs.t
 t/data/etc/hello.txt

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm?view=diff&r1=157203&r2=157204
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm Fri Mar 11 18:02:03 2005
@@ -170,10 +170,20 @@
       return;
     }
 
+    if (!$scan->is_spam()) {
+      dbg("learn: auto-learn? no: scored as ham but autolearn wanted spam");
+      return;
+    }
+
   } else {
     if ($learned_points > $learner_said_spam_points) {
       dbg("learn: auto-learn? no: scored as ham but learner indicated spam (".
           $learned_points." > ".$learner_said_spam_points.")");
+      return;
+    }
+
+    if ($scan->is_spam()) {
+      dbg("learn: auto-learn? no: scored as spam but autolearn wanted ham");
       return;
     }
   }

Modified: spamassassin/trunk/rules/60_whitelist.cf
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/60_whitelist.cf?view=diff&r1=157203&r2=157204
==============================================================================
--- spamassassin/trunk/rules/60_whitelist.cf (original)
+++ spamassassin/trunk/rules/60_whitelist.cf Fri Mar 11 18:02:03 2005
@@ -28,8 +28,6 @@
 # user slip-up could result in scribbling side-effects in the bayes
 # db as a result -- which is hard to remedy.
 
-# we *do* allow the user to autolearn based on this, because it's hard
-# to accidentally blacklist someone's From address.
 header USER_IN_BLACKLIST	eval:check_from_in_blacklist()
 describe USER_IN_BLACKLIST	From: address is in the user's black-list
 tflags USER_IN_BLACKLIST	userconf noautolearn

Added: spamassassin/trunk/t/blacklist_autolearn.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/blacklist_autolearn.t?view=auto&rev=157204
==============================================================================
--- spamassassin/trunk/t/blacklist_autolearn.t (added)
+++ spamassassin/trunk/t/blacklist_autolearn.t Fri Mar 11 18:02:03 2005
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("blacklist_autolearn");
+use Test; BEGIN { plan tests => 3 };
+
+# ---------------------------------------------------------------------------
+
+%patterns = (
+
+q{ USER_IN_BLACKLIST }, 'blacklisted',
+
+
+);
+
+%anti_patterns = (
+q{ autolearn=ham } => 'autolearned as ham'
+);
+
+tstprefs ('
+
+blacklist_from *@ximian.com
+
+');
+
+ok (sarun ("-L -t < data/nice/001", \&patterns_run_cb));
+ok_all_patterns();

Propchange: spamassassin/trunk/t/blacklist_autolearn.t
------------------------------------------------------------------------------
    svn:executable = *