You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by pa...@apache.org on 2005/02/08 00:35:16 UTC

svn commit: r151785 - in spamassassin/trunk: ./ lib/Mail/ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/Plugin/ lib/Mail/SpamAssassin/Util/ rules/ spamd/ t/

Author: parker
Date: Mon Feb  7 15:35:05 2005
New Revision: 151785

URL: http://svn.apache.org/viewcvs?view=rev&rev=151785
Log:
Turn AWL into a plugin and update various tests and documentation

Added:
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
    spamassassin/trunk/rules/60_awl.cf
Modified:
    spamassassin/trunk/INSTALL
    spamassassin/trunk/MANIFEST
    spamassassin/trunk/lib/Mail/SpamAssassin.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgLearner.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
    spamassassin/trunk/rules/10_misc.cf
    spamassassin/trunk/rules/60_whitelist.cf
    spamassassin/trunk/rules/init.pre
    spamassassin/trunk/spamassassin.raw
    spamassassin/trunk/spamd/spamd.raw
    spamassassin/trunk/t/db_awl_path.t

Modified: spamassassin/trunk/INSTALL
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/INSTALL?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/INSTALL (original)
+++ spamassassin/trunk/INSTALL Mon Feb  7 15:35:05 2005
@@ -317,7 +317,7 @@
   - DBI *and* DBD driver/modules for your database (from CPAN)
 
     If you intend to use SpamAssassin with an SQL database backend for
-    user configuration data, Bayes storage, or AWL storage, you will need
+    user configuration data, Bayes storage, or other storage, you will need
     to have these installed; both the basic DBI module and the driver for
     your database.
 

Modified: spamassassin/trunk/MANIFEST
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/MANIFEST?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Mon Feb  7 15:35:05 2005
@@ -56,6 +56,7 @@
 lib/Mail/SpamAssassin/PerMsgStatus.pm
 lib/Mail/SpamAssassin/PersistentAddrList.pm
 lib/Mail/SpamAssassin/Plugin.pm
+lib/Mail/SpamAssassin/Plugin/AWL.pm
 lib/Mail/SpamAssassin/Plugin/AutoLearnThreshold.pm
 lib/Mail/SpamAssassin/Plugin/DCC.pm
 lib/Mail/SpamAssassin/Plugin/DomainKeys.pm
@@ -167,6 +168,7 @@
 rules/30_text_nl.cf
 rules/30_text_pl.cf
 rules/50_scores.cf
+rules/60_awl.cf
 rules/60_whitelist.cf
 rules/STATISTICS-set1.txt
 rules/STATISTICS-set2.txt

Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Mon Feb  7 15:35:05 2005
@@ -737,13 +737,12 @@
 
 sub add_address_to_whitelist {
   my ($self, $addr) = @_;
-  my $list = Mail::SpamAssassin::AutoWhitelist->new($self);
-  if ($list->add_known_good_address ($addr)) {
-    print "SpamAssassin auto-whitelist: adding address: $addr\n";
-  }
-  $list->finish();
+
+  $self->call_plugins("whitelist_address", { address => $addr });
 }
 
+###########################################################################
+
 =item $f->add_all_addresses_to_whitelist ($mail)
 
 Given a mail message, find as many addresses in the usual headers (To, Cc, From
@@ -754,13 +753,9 @@
 sub add_all_addresses_to_whitelist {
   my ($self, $mail_obj) = @_;
 
-  my $list = Mail::SpamAssassin::AutoWhitelist->new($self);
   foreach my $addr ($self->find_all_addrs_in_mail ($mail_obj)) {
-    if ($list->add_known_good_address ($addr)) {
-      print "SpamAssassin auto-whitelist: adding address: $addr\n";
-    }
+    $self->call_plugins("whitelist_address", { address => $addr });
   }
-  $list->finish();
 }
 
 ###########################################################################
@@ -774,13 +769,12 @@
 
 sub remove_address_from_whitelist {
   my ($self, $addr) = @_;
-  my $list = Mail::SpamAssassin::AutoWhitelist->new($self);
-  if ($list->remove_address ($addr)) {
-    print "SpamAssassin auto-whitelist: removing address: $addr\n";
-  }
-  $list->finish();
+
+  $self->call_plugins("remove_address", { address => $addr });
 }
 
+###########################################################################
+
 =item $f->remove_all_addresses_from_whitelist ($mail)
 
 Given a mail message, find as many addresses in the usual headers (To, Cc, From
@@ -792,13 +786,9 @@
 sub remove_all_addresses_from_whitelist {
   my ($self, $mail_obj) = @_;
 
-  my $list = Mail::SpamAssassin::AutoWhitelist->new($self);
   foreach my $addr ($self->find_all_addrs_in_mail ($mail_obj)) {
-    if ($list->remove_address ($addr)) {
-      print "SpamAssassin auto-whitelist: removing address: $addr\n";
-    }
+    $self->call_plugins("remove_address", { address => $addr });
   }
-  $list->finish();
 }
 
 ###########################################################################
@@ -812,13 +802,11 @@
 
 sub add_address_to_blacklist {
   my ($self, $addr) = @_;
-  my $list = Mail::SpamAssassin::AutoWhitelist->new($self);
-  if ($list->add_known_bad_address ($addr)) {
-    print "SpamAssassin auto-whitelist: blacklisting address: $addr\n";
-  }
-  $list->finish();
+  $self->call_plugins("blacklist_address", { address => $addr });
 }
 
+###########################################################################
+
 =item $f->add_all_addresses_to_blacklist ($mail)
 
 Given a mail message, find addresses in the From headers and add them to the
@@ -831,8 +819,6 @@
 sub add_all_addresses_to_blacklist {
   my ($self, $mail_obj) = @_;
 
-  my $list = Mail::SpamAssassin::AutoWhitelist->new($self);
-
   $self->init(1);
 
   my @addrlist = ();
@@ -842,18 +828,13 @@
   }
 
   foreach my $addr (@addrlist) {
-    if ($list->add_known_bad_address ($addr)) {
-      print "SpamAssassin auto-whitelist: blacklisting address: $addr\n";
-    }
+    $self->call_plugins("blacklist_address", { address => $addr });
   }
 
-  $list->finish();
 }
 
 ###########################################################################
 
-###########################################################################
-
 =item $text = $f->remove_spamassassin_markup ($mail)
 
 Returns the text of the message, with any SpamAssassin-added text (such
@@ -1115,9 +1096,8 @@
 options which have a default with I<__userstate__> in it post-init(),
 and then re-change the option before returning.  This lets you change
 I<$ENV{'HOME'}> to a temp directory, have compile_now() and create any
-files there as necessary (auto-whitelist, etc,) without disturbing the
-actual files as changed by a configuration option.  By default, this
-is disabled.
+files there as necessary without disturbing the actual files as changed
+by a configuration option.  By default, this is disabled.
 
 =cut
 
@@ -1378,26 +1358,6 @@
   $set |= 1 unless $self->{local_tests_only};
   $set |= 2 if $self->{bayes_scanner}->is_scan_available();
   $self->{conf}->set_score_set ($set);
-
-  # Deal with autowhitelist
-  if ($self->{conf}->{use_auto_whitelist} &&
-      $self->{conf}->{auto_whitelist_factory})
-  {
-    my $factory;
-    my $type = $self->{conf}->{auto_whitelist_factory};
-    if ($type =~ /^([_A-Za-z0-9:]+)$/) {
-      $type = $1;
-      eval '
-	require '.$type.';
-	$factory = '.$type.'->new();
-      ';
-      if ($@) { warn "auto-whitelist: $@"; undef $factory; }
-    }
-    else {
-      warn "auto-whitelist: illegal auto_whitelist_factory setting\n";
-    }
-    $self->set_persistent_address_list_factory($factory) if defined $factory;
-  }
 
   if ($self->{only_these_rules}) {
     $self->{conf}->trim_rules($self->{only_these_rules});

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm Mon Feb  7 15:35:05 2005
@@ -68,11 +68,33 @@
 
   $self->{factor} = $main->{conf}->{auto_whitelist_factor};
 
-  if (!defined $self->{main}->{pers_addr_list_factory}) {
+  my $factory;
+  if ($main->{pers_addr_list_factory}) {
+    $factory = $main->{pers_addr_list_factory};
+  }
+  else {
+    my $type = $main->{conf}->{auto_whitelist_factory};
+    if ($type =~ /^([_A-Za-z0-9:]+)$/) {
+      $type = $1;
+      eval '
+  	    require '.$type.';
+            $factory = '.$type.'->new();
+           ';
+      if ($@) { 
+	warn "auto-whitelist: $@";
+	undef $factory;
+      }
+      $main->set_persistent_address_list_factory($factory) if $factory;
+    }
+    else {
+      warn "auto-whitelist: illegal auto_whitelist_factory setting\n";
+    }
+  }
+
+  if (!defined $factory) {
     $self->{checker} = undef;
   } else {
-    $self->{checker} =
-  	$self->{main}->{pers_addr_list_factory}->new_checker ($self->{main});
+    $self->{checker} = $factory->new_checker($self->{main});
   }
 
   bless ($self, $class);
@@ -225,7 +247,7 @@
   $entry = $self->{checker}->get_addr_entry ($fulladdr);
   $self->{checker}->add_score($entry, $score);
 
-  return 0;
+  return 1;
 }
 
 ###########################################################################

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Mon Feb  7 15:35:05 2005
@@ -1223,49 +1223,6 @@
     type => $CONF_TYPE_BOOL
   });
 
-=item auto_whitelist_factor n	(default: 0.5, range [0..1])
-
-How much towards the long-term mean for the sender to regress a message.
-Basically, the algorithm is to track the long-term mean score of messages for
-the sender (C<mean>), and then once we have otherwise fully calculated the
-score for this message (C<score>), we calculate the final score for the
-message as:
-
-C<finalscore> = C<score> +  (C<mean> - C<score>) * C<factor>
-
-So if C<factor> = 0.5, then we'll move to half way between the calculated
-score and the mean.  If C<factor> = 0.3, then we'll move about 1/3 of the way
-from the score toward the mean.  C<factor> = 1 means just use the long-term
-mean; C<factor> = 0 mean just use the calculated score.
-
-=cut
-
-  push (@cmds, {
-    setting => 'auto_whitelist_factor',
-    default => 0.5,
-    type => $CONF_TYPE_NUMERIC
-  });
-
-=item auto_whitelist_db_modules Module ...	(default: see below)
-
-What database modules should be used for the auto-whitelist storage database
-file.   The first named module that can be loaded from the perl include path
-will be used.  The format is:
-
-  PreferredModuleName SecondBest ThirdBest ...
-
-ie. a space-separated list of perl module names.  The default is:
-
-  DB_File GDBM_File NDBM_File SDBM_File
-
-=cut
-
-  push (@cmds, {
-    setting => 'auto_whitelist_db_modules',
-    default => 'DB_File GDBM_File NDBM_File SDBM_File',
-    type => $CONF_TYPE_STRING
-  });
-
 =item bayes_auto_learn ( 0 | 1 )      (default: 1)
 
 Whether SpamAssassin should automatically feed high-scoring mails (or
@@ -2236,9 +2193,9 @@
 
 Used to set flags on a test.  These flags are used in the
 score-determination back end system for details of the test's
-behaviour.  Please see C<bayes_auto_learn> and C<use_auto_whitelist>
-for more information about tflag interaction with those systems.
-The following flags can be set:
+behaviour.  Please see C<bayes_auto_learn> for more information
+about tflag interaction with those systems. The following flags
+can be set:
 
 =over 4
 
@@ -2353,61 +2310,6 @@
     }
   });
 
-=item use_auto_whitelist ( 0 | 1 )		(default: 1)
-
-Whether to use auto-whitelists.  Auto-whitelists track the long-term
-average score for each sender and then shift the score of new messages
-toward that long-term average.  This can increase or decrease the score
-for messages, depending on the long-term behavior of the particular
-correspondent.
-
-For more information about the auto-whitelist system, please look
-at the the C<Automatic Whitelist System> section of the README file.
-The auto-whitelist is not intended as a general-purpose replacement
-for static whitelist entries added to your config files.
-
-Note that certain tests are ignored when determining the final
-message score:
-
- - rules with tflags set to 'noautolearn'
-
-=cut
-
-  push (@cmds, {
-    setting => 'use_auto_whitelist',
-    is_admin => 1,
-    default => 1,
-    type => $CONF_TYPE_BOOL
-  });
-
-=item auto_whitelist_factory module (default: Mail::SpamAssassin::DBBasedAddrList)
-
-Select alternative whitelist factory module.
-
-=cut
-
-  push (@cmds, {
-    setting => 'auto_whitelist_factory',
-    is_admin => 1,
-    default => 'Mail::SpamAssassin::DBBasedAddrList',
-    type => $CONF_TYPE_STRING
-  });
-
-=item auto_whitelist_path /path/to/file	(default: ~/.spamassassin/auto-whitelist)
-
-Automatic-whitelist directory or file.  By default, each user has their own, in
-their C<~/.spamassassin> directory with mode 0700, but for system-wide
-SpamAssassin use, you may want to share this across all users.
-
-=cut
-
-  push (@cmds, {
-    setting => 'auto_whitelist_path',
-    is_admin => 1,
-    default => '__userstate__/auto-whitelist',
-    type => $CONF_TYPE_STRING
-  });
-
 =item bayes_path /path/to/file	(default: ~/.spamassassin/bayes)
 
 Path for Bayesian probabilities databases.  Several databases will be created,
@@ -2430,23 +2332,6 @@
     type => $CONF_TYPE_STRING
   });
 
-=item auto_whitelist_file_mode		(default: 0700)
-
-The file mode bits used for the automatic-whitelist directory or file.
-
-Make sure you specify this using the 'x' mode bits set, as it may also be used
-to create directories.  However, if a file is created, the resulting file will
-not have any execute bits set (the umask is set to 111).
-
-=cut
-
-  push (@cmds, {
-    setting => 'auto_whitelist_file_mode',
-    is_admin => 1,
-    default => '0700',
-    type => $CONF_TYPE_NUMERIC
-  });
-
 =item bayes_file_mode		(default: 0700)
 
 The file mode bits used for the Bayesian filtering database files.
@@ -2664,72 +2549,6 @@
     type => $CONF_TYPE_STRING
   });
 
-=item user_awl_dsn DBI:databasetype:databasename:hostname:port
-
-If you load user auto-whitelists from an SQL database, this will set the DSN
-used to connect.  Example: C<DBI:mysql:spamassassin:localhost>
-
-=cut
-
-  push (@cmds, {
-    setting => 'user_awl_dsn',
-    is_admin => 1,
-    type => $CONF_TYPE_STRING
-  });
-
-=item user_awl_sql_username username
-
-The authorized username to connect to the above DSN.
-
-=cut
-
-  push (@cmds, {
-    setting => 'user_awl_sql_username',
-    is_admin => 1,
-    type => $CONF_TYPE_STRING
-  });
-
-=item user_awl_sql_password password
-
-The password for the database username, for the above DSN.
-
-=cut
-
-  push (@cmds, {
-    setting => 'user_awl_sql_password',
-    is_admin => 1,
-    type => $CONF_TYPE_STRING
-  });
-
-=item user_awl_sql_table tablename
-
-The table user auto-whitelists are stored in, for the above DSN.
-
-=cut
-
-  push (@cmds, {
-    setting => 'user_awl_sql_table',
-    is_admin => 1,
-    default => 'awl',
-    type => $CONF_TYPE_STRING
-  });
-
-=item user_awl_sql_override_username
-
-Used by the SQLBasedAddrList storage implementation.
-
-If this option is set the SQLBasedAddrList module will override the set
-username with the value given.  This can be useful for implementing global
-or group based auto-whitelist databases.
-
-=cut
-
-  push (@cmds, {
-    setting => 'user_awl_sql_override_username',
-    default => '',
-    type => $CONF_TYPE_STRING
-  });
-
 =item user_scores_ldap_username
 
 This is the Bind DN used to connect to the LDAP server.
@@ -2902,10 +2721,6 @@
  _BAYESTCHAMMY_    number of hammy tokens found
  _HAMMYTOKENS(N)_  the N most significant hammy tokens (default, 5)
  _SPAMMYTOKENS(N)_ the N most significant spammy tokens (default, 5)
- _AWL_             AWL modifier
- _AWLMEAN_         Mean score on which AWL modification is based
- _AWLCOUNT_        Number of messages on which AWL modification is based
- _AWLPRESCORE_     Score before AWL
  _DATE_            rfc-2822 date of scan
  _STARS(*)_        one "*" (use any character) for each full score point
                    (note: limited to 50 'stars')

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Mon Feb  7 15:35:05 2005
@@ -874,83 +874,6 @@
 
 ###########################################################################
 
-sub check_from_in_auto_whitelist {
-    my ($self) = @_;
-
-    return unless defined $self->{main}->{pers_addr_list_factory};
-
-    local $_ = lc $self->get('From:addr');
-    return 0 unless /\S/;
-
-    # find the earliest usable "originating IP".  ignore private nets
-    my $origip;
-    foreach my $rly (reverse (@{$self->{relays_trusted}}, @{$self->{relays_untrusted}}))
-    {
-      next if ($rly->{ip_private});
-      if ($rly->{ip}) {
-	$origip = $rly->{ip}; last;
-      }
-    }
-
-    my $awlpoints = $self->_get_autowhitelist_points();
-
-    # Create the AWL object, catching 'die's
-    my $whitelist;
-    my $evalok = eval {
-      $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
-
-      # check
-      my $meanscore = $whitelist->check_address($_, $origip);
-      my $delta = 0;
-
-      dbg("auto-whitelist: AWL active, pre-score: $self->{score}, autolearn score: $awlpoints, ".
-	"mean: ". ($meanscore || 'undef') .", IP: ". ($origip || 'undef'));
-
-      if (defined ($meanscore)) {
-        $delta = ($meanscore - $awlpoints) * $self->{main}->{conf}->{auto_whitelist_factor};
-	$self->{tag_data}->{AWL} = sprintf("%2.1f",$delta);
-	# Save this for _AWL_ tag
-
-	$self->{tag_data}->{AWLMEAN} = sprintf("%2.1f", $meanscore);
-	$self->{tag_data}->{AWLCOUNT} = sprintf("%2.1f", $whitelist->count());
-	$self->{tag_data}->{AWLPRESCORE} = sprintf("%2.1f", $self->{score});
-      }
-
-      # Update the AWL *before* adding the new score, otherwise
-      # early high-scoring messages are reinforced compared to
-      # later ones.  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=159704
-      if (!$self->{disable_auto_learning}) {
-        $whitelist->add_score($awlpoints);
-      }
-
-      # current AWL score changes with each hit
-      for my $set (0..3) {
-	$self->{conf}->{scoreset}->[$set]->{"AWL"} = sprintf("%0.3f", $delta);
-      }
-
-      if ($delta != 0) {
-        $self->_handle_hit("AWL", $delta, "AWL: ",
-			   $self->{main}->{conf}->{descriptions}->{AWL});
-      }
-
-      $whitelist->finish();
-      1;
-    };
-
-    if (!$evalok) {
-      dbg("auto-whitelist: open of auto-whitelist file failed: $@");
-      # try an unlock, in case we got that far
-      eval { $whitelist->finish(); };
-    }
-
-    dbg("auto-whitelist: post auto-whitelist score: ".$self->{score});
-
-    # test hit is above
-    return 0;
-}
-
-###########################################################################
-
 # look up $addr and trusted relays in a whitelist with rcvd
 # note if it appears to be a forgery and $addr is not in any-relay list
 sub _check_whitelist_rcvd {

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgLearner.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgLearner.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgLearner.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgLearner.pm Mon Feb  7 15:35:05 2005
@@ -53,7 +53,6 @@
 use bytes;
 
 use Mail::SpamAssassin;
-use Mail::SpamAssassin::AutoWhitelist;
 use Mail::SpamAssassin::PerMsgStatus;
 use Mail::SpamAssassin::Bayes;
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Mon Feb  7 15:35:05 2005
@@ -56,7 +56,6 @@
 
 use Mail::SpamAssassin::Constants qw(:sa);
 use Mail::SpamAssassin::EvalTests;
-use Mail::SpamAssassin::AutoWhitelist;
 use Mail::SpamAssassin::Conf;
 use Mail::SpamAssassin::Util;
 
@@ -313,28 +312,6 @@
     dbg("learn: auto-learning failed: $@");
     $self->{auto_learn_status} = "failed";
   }
-}
-
-# This function is for exclusive use by the autowhitelist function to
-# figure out the score to be used for inclusion in the AWL.
-sub _get_autowhitelist_points {
-  my ($self) = @_;
-
-  my $scores = $self->{conf}->{scores};
-  my $tflags = $self->{conf}->{tflags};
-  my $points = 0;
-
-  foreach my $test (@{$self->{test_names_hit}})
-  {
-    # ignore tests with 0 score in this scoreset,
-    # or if the test is a learning or userconf test
-    next if ($scores->{$test} == 0);
-    next if (exists $tflags->{$test} && $tflags->{$test} =~ /\bnoautolearn\b/);
-
-    $points += $scores->{$test};
-  }
-
-  return (sprintf "%0.3f", $points) + 0;
 }
 
 =item $score = $status->get_autolearn_points()

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm Mon Feb  7 15:35:05 2005
@@ -582,6 +582,45 @@
 
 =back
 
+=item $plugin->whitelist_address( { options ... } )
+
+Called when a request is made to add an address to a
+persistent address list.
+
+=over 4
+
+=item address
+
+Address you wish to add.
+
+=back
+
+=item $plugin->blacklist_address( { options ... } )
+
+Called when a request is made to add an address to a
+persistent address list.
+
+=over 4
+
+=item address
+
+Address you wish to add.
+
+=back
+
+=item $plugin->remove_address( { options ... } )
+
+Called when a request is made to remove an address to a
+persistent address list.
+
+=over 4
+
+=item address
+
+Address you wish to remove.
+
+=back
+
 =item $plugin->finish ()
 
 Called when the C<Mail::SpamAssassin> object is destroyed.

Added: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm?view=auto&rev=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm (added)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm Mon Feb  7 15:35:05 2005
@@ -0,0 +1,512 @@
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </...@LICENSE>
+
+=head1 NAME
+
+Mail::SpamAssassin::Plugin::AWL - Normalize scores via auto-whitelist
+
+=head1 SYNOPSIS
+
+To try this out, add this or uncomment this line in init.pre:
+
+  loadplugin     Mail::SpamAssassin::Plugin::AWL
+
+Use the supplied 60_awl.cf file (ie you don't have to do anything) or
+add these lines to a .cf file:
+
+  header AWL             eval:check_from_in_auto_whitelist()
+  describe AWL           From: address is in the auto white-list
+  tflags AWL             userconf noautolearn
+  priority AWL           1000
+
+=head1 DESCRIPTION
+
+The AWL plugin has been deprecated and superceded by the new History
+plugin, but is available if you want to continue using the old AWL
+method with your current AWL database.  Once you have activated the
+History plugin and are using it to adjust scores, you should disable
+this plugin (it will work, but accuracy will be compromised).
+
+This plugin module provides backward-compatible support for the
+auto-whitelist used in SpamAssassin 3.0 and earlier versions.  It keeps
+track of the average SpamAssassin score for senders.  Senders are
+tracked using a combination of their From: address and their IP address.
+It then uses that average score to reduce the variability in scoring
+from message to message and modifies the final score by pushing the
+result towards the historical average.  This improves the accuracy of
+filtering for most email.
+
+=head1 TEMPLATE TAGS
+
+This plugin module adds the following C<tags> that can be used as
+placeholders in certain options.  See C<Mail::SpamAssassin::Conf>
+for more information on TEMPLATE TAGS.
+
+ _AWL_             AWL modifier
+ _AWLMEAN_         Mean score on which AWL modification is based
+ _AWLCOUNT_        Number of messages on which AWL modification is based
+ _AWLPRESCORE_     Score before AWL
+
+=cut
+
+package Mail::SpamAssassin::Plugin::AWL;
+
+# Make the main dbg() accessible in our package w/o an extra function
+*dbg=\&Mail::SpamAssassin::Plugin::dbg;
+
+use strict;
+use warnings;
+use bytes;
+use Mail::SpamAssassin::Plugin;
+use Mail::SpamAssassin::AutoWhitelist;
+
+use vars qw(@ISA);
+@ISA = qw(Mail::SpamAssassin::Plugin);
+
+# constructor: register the eval rule
+sub new {
+  my $class = shift;
+  my $mailsaobject = shift;
+
+  # some boilerplate...
+  $class = ref($class) || $class;
+  my $self = $class->SUPER::new($mailsaobject);
+  bless ($self, $class);
+
+  # the important bit!
+  $self->register_eval_rule("check_from_in_auto_whitelist");
+
+  $self->set_config($mailsaobject->{conf});
+
+  return $self;
+}
+
+sub set_config {
+  my($self, $conf) = @_;
+  my @cmds = ();
+
+=head1 USER PREFERENCES
+
+The following options can be used in both site-wide (C<local.cf>) and
+user-specific (C<user_prefs>) configuration files to customize how
+SpamAssassin handles incoming email messages.
+
+=over 4
+
+=item use_auto_whitelist ( 0 | 1 )		(default: 1)
+
+Whether to use auto-whitelists.  Auto-whitelists track the long-term
+average score for each sender and then shift the score of new messages
+toward that long-term average.  This can increase or decrease the score
+for messages, depending on the long-term behavior of the particular
+correspondent.
+
+For more information about the auto-whitelist system, please look
+at the the C<Automatic Whitelist System> section of the README file.
+The auto-whitelist is not intended as a general-purpose replacement
+for static whitelist entries added to your config files.
+
+Note that certain tests are ignored when determining the final
+message score:
+
+ - rules with tflags set to 'noautolearn'
+
+=cut
+
+  push (@cmds, {
+		setting => 'use_auto_whitelist',
+		default => 1,
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_BOOL
+	       });
+
+=item auto_whitelist_factor n	(default: 0.5, range [0..1])
+
+How much towards the long-term mean for the sender to regress a message.
+Basically, the algorithm is to track the long-term mean score of messages for
+the sender (C<mean>), and then once we have otherwise fully calculated the
+score for this message (C<score>), we calculate the final score for the
+message as:
+
+C<finalscore> = C<score> +  (C<mean> - C<score>) * C<factor>
+
+So if C<factor> = 0.5, then we'll move to half way between the calculated
+score and the mean.  If C<factor> = 0.3, then we'll move about 1/3 of the way
+from the score toward the mean.  C<factor> = 1 means just use the long-term
+mean; C<factor> = 0 mean just use the calculated score.
+
+=cut
+
+  push (@cmds, {
+		setting => 'auto_whitelist_factor',
+		default => 0.5,
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_NUMERIC
+	       });
+
+=item user_awl_sql_override_username
+
+Used by the SQLBasedAddrList storage implementation.
+
+If this option is set the SQLBasedAddrList module will override the set
+username with the value given.  This can be useful for implementing global
+or group based auto-whitelist databases.
+
+=cut
+
+  push (@cmds, {
+		setting => 'user_awl_sql_override_username',
+		default => '',
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=head1 ADMINISTRATOR SETTINGS
+
+These settings differ from the ones above, in that they are considered 'more
+privileged' -- even more than the ones in the B<PRIVILEGED SETTINGS> section.
+No matter what C<allow_user_rules> is set to, these can never be set from a
+user's C<user_prefs> file.
+
+=item auto_whitelist_factory module (default: Mail::SpamAssassin::DBBasedAddrList)
+
+Select alternative whitelist factory module.
+
+=cut
+
+  push (@cmds, {
+		setting => 'auto_whitelist_factory',
+		is_admin => 1,
+		default => 'Mail::SpamAssassin::DBBasedAddrList',
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=item auto_whitelist_path /path/to/file	(default: ~/.spamassassin/auto-whitelist)
+
+Automatic-whitelist directory or file.  By default, each user has their own, in
+their C<~/.spamassassin> directory with mode 0700, but for system-wide
+SpamAssassin use, you may want to share this across all users.
+
+=cut
+
+  push (@cmds, {
+		setting => 'auto_whitelist_path',
+		is_admin => 1,
+		default => '__userstate__/auto-whitelist',
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=item auto_whitelist_db_modules Module ...	(default: see below)
+
+What database modules should be used for the auto-whitelist storage database
+file.   The first named module that can be loaded from the perl include path
+will be used.  The format is:
+
+  PreferredModuleName SecondBest ThirdBest ...
+
+ie. a space-separated list of perl module names.  The default is:
+
+  DB_File GDBM_File NDBM_File SDBM_File
+
+=cut
+
+  push (@cmds, {
+		setting => 'auto_whitelist_db_modules',
+		is_admin => 1,
+		default => 'DB_File GDBM_File NDBM_File SDBM_File',
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=item auto_whitelist_file_mode		(default: 0700)
+
+The file mode bits used for the automatic-whitelist directory or file.
+
+Make sure you specify this using the 'x' mode bits set, as it may also be used
+to create directories.  However, if a file is created, the resulting file will
+not have any execute bits set (the umask is set to 111).
+
+=cut
+
+  push (@cmds, {
+		setting => 'auto_whitelist_file_mode',
+		is_admin => 1,
+		default => '0700',
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_NUMERIC
+	       });
+
+=item user_awl_dsn DBI:databasetype:databasename:hostname:port
+
+Used by the SQLBasedAddrList storage implementation.
+
+This will set the DSN used to connect.  Example:
+C<DBI:mysql:spamassassin:localhost>
+
+=cut
+
+  push (@cmds, {
+		setting => 'user_awl_dsn',
+		is_admin => 1,
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=item user_awl_sql_username username
+
+Used by the SQLBasedAddrList storage implementation.
+
+The authorized username to connect to the above DSN.
+
+=cut
+
+  push (@cmds, {
+		setting => 'user_awl_sql_username',
+		is_admin => 1,
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=item user_awl_sql_password password
+
+Used by the SQLBasedAddrList storage implementation.
+
+The password for the database username, for the above DSN.
+
+=cut
+
+  push (@cmds, {
+		setting => 'user_awl_sql_password',
+		is_admin => 1,
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+=item user_awl_sql_table tablename
+
+Used by the SQLBasedAddrList storage implementation.
+
+The table user auto-whitelists are stored in, for the above DSN.
+
+=back
+
+=cut
+
+  push (@cmds, {
+		setting => 'user_awl_sql_table',
+		is_admin => 1,
+		default => 'awl',
+		type => $Mail::SpamAssassin::Conf::CONF_TYPE_STRING
+	       });
+
+  $conf->{parser}->register_commands(\@cmds);
+}
+
+sub check_from_in_auto_whitelist {
+    my ($self, $pms) = @_;
+
+    return 0 unless ($pms->{conf}->{use_auto_whitelist});
+
+    local $_ = lc $pms->get('From:addr');
+    return 0 unless /\S/;
+
+    # find the earliest usable "originating IP".  ignore private nets
+    my $origip;
+    foreach my $rly (reverse (@{$pms->{relays_trusted}}, @{$pms->{relays_untrusted}}))
+    {
+      next if ($rly->{ip_private});
+      if ($rly->{ip}) {
+	$origip = $rly->{ip}; last;
+      }
+    }
+
+    my $scores = $pms->{conf}->{scores};
+    my $tflags = $pms->{conf}->{tflags};
+    my $points = 0;
+
+    foreach my $test (@{$pms->{test_names_hit}}) {
+      # ignore tests with 0 score in this scoreset,
+      # or if the test is a learning or userconf test
+      next if ($scores->{$test} == 0);
+      next if (exists $tflags->{$test} && $tflags->{$test} =~ /\bnoautolearn\b/);
+
+      $points += $scores->{$test};
+    }
+
+    my $awlpoints = (sprintf "%0.3f", $points) + 0;
+
+   # Create the AWL object
+    my $whitelist;
+    my $evalok = eval {
+      $whitelist = Mail::SpamAssassin::AutoWhitelist->new($pms->{main});
+
+      # check
+      my $meanscore = $whitelist->check_address($_, $origip);
+      my $delta = 0;
+    
+      dbg("auto-whitelist: AWL active, pre-score: $pms->{score}, autolearn score: $awlpoints, ".
+	  "mean: ". ($meanscore || 'undef') .", IP: ". ($origip || 'undef'));
+
+      if (defined ($meanscore)) {
+	$delta = ($meanscore - $awlpoints) * $pms->{main}->{conf}->{auto_whitelist_factor};
+      
+	$pms->set_tag('AWL', sprintf("%2.1f",$delta));
+	$pms->set_tag('AWLMEAN', sprintf("%2.1f", $meanscore));
+	$pms->set_tag('AWLCOUNT', sprintf("%2.1f", $whitelist->count()));
+	$pms->set_tag('AWLPRESCORE', sprintf("%2.1f", $pms->{score}));
+      }
+
+      # Update the AWL *before* adding the new score, otherwise
+      # early high-scoring messages are reinforced compared to
+      # later ones.  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=159704
+      if (!$pms->{disable_auto_learning}) {
+	$whitelist->add_score($awlpoints);
+      }
+
+      # current AWL score changes with each hit
+      for my $set (0..3) {
+	$pms->{conf}->{scoreset}->[$set]->{"AWL"} = sprintf("%0.3f", $delta);
+      }
+
+      if ($delta != 0) {
+	# We have to use the private _handle_hit method here because we want
+	# to pass in a dynamically generated score.  Perhaps we should extend
+	# handle_hit or add a handle_dynamic_hit method to help here.
+	$pms->_handle_hit("AWL", $delta, "AWL: ",
+			  $pms->{conf}->{descriptions}->{AWL});
+      }
+
+      $whitelist->finish();
+      1;
+    };
+
+    if (!$evalok) {
+      warn("auto-whitelist: open of auto-whitelist file failed: $@");
+      # try an unlock, in case we got that far
+      eval { $whitelist->finish(); };
+      return 0;
+    }
+
+    dbg("auto-whitelist: post auto-whitelist score: ".$pms->{score});
+
+    # test hit is above
+    return 0;
+}
+
+sub blacklist_address {
+  my ($self, $args) = @_;
+
+  return 0 unless ($self->{main}->{conf}->{use_auto_whitelist});
+
+  unless ($args->{address}) {
+    print "SpamAssassin auto-whitelist: Failed to add address to blacklist.\n";
+    return;
+  }
+  
+  my $whitelist;
+  my $status;
+
+  eval {
+    $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
+
+    if ($whitelist->add_known_bad_address($args->{address})) {
+      print "SpamAssassin auto-whitelist: adding address to blacklist: " . $args->{address} . ".\n";
+      $status = 0;
+    }
+    else {
+      print "SpamAssassin auto-whitelist: error adding address to blacklist\n";
+      $status = 1;
+    }
+    $whitelist->finish();
+  };
+
+  if ($@) {
+    warn("auto-whitelist: open of auto-whitelist file failed: $@");
+    eval { $whitelist->finish(); };
+    return 0;
+  }
+
+  return $status;
+}
+
+sub whitelist_address {
+  my ($self, $args) = @_;
+
+  return 0 unless ($self->{main}->{conf}->{use_auto_whitelist});
+
+  unless ($args->{address}) {
+    print "SpamAssassin auto-whitelist: Failed to add address to whitelist.\n";
+    return 0;
+  }
+
+  my $whitelist;
+  my $status;
+
+  eval {
+    $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
+
+    if ($whitelist->add_known_good_address($args->{address})) {
+      print "SpamAssassin auto-whitelist: adding address to whitelist: " . $args->{address} . ".\n";
+      $status = 1;
+    }
+    else {
+      print "SpamAssassin auto-whitelist: error adding address to whitelist\n";
+      $status = 0;
+    }
+
+    $whitelist->finish();
+  };
+
+  if ($@) {
+    warn("auto-whitelist: open of auto-whitelist file failed: $@");
+    eval { $whitelist->finish(); };
+    return 0;
+  }
+
+  return $status;
+}
+
+sub remove_address {
+  my ($self, $args) = @_;
+
+  return 0 unless ($self->{main}->{conf}->{use_auto_whitelist});
+
+  unless ($args->{address}) {
+    print "SpamAssassin auto-whitelist: Failed to remove address.\n";
+    return 0;
+  }
+
+  my $whitelist;
+  my $status;
+
+  eval {
+    $whitelist = Mail::SpamAssassin::AutoWhitelist->new($self->{main});
+
+    if ($whitelist->remove_address($args->{address})) {
+      print "SpamAssassin auto-whitelist: removing address: " . $args->{address} . ".\n";
+      $status = 1;
+    }
+    else {
+      print "SpamAssassin auto-whitelist: error removing address.\n";
+      $status = 0;
+    }
+  
+    $whitelist->finish();
+  };
+
+  if ($@) {
+    warn("auto-whitelist: open of auto-whitelist file failed: $@");
+    eval { $whitelist->finish(); };
+    return 0;
+  }
+
+  return $status;
+}
+
+
+1;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm Mon Feb  7 15:35:05 2005
@@ -153,7 +153,7 @@
   module => 'DBI',
   version => '0.00',
   desc => 'If you intend to use SpamAssassin with an SQL database backend for
-  user configuration data, Bayes storage, or AWL storage, you will need
+  user configuration data, Bayes storage, or other storage, you will need
   to have these installed; both the basic DBI module and the driver for
   your database.',
 },

Modified: spamassassin/trunk/rules/10_misc.cf
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/10_misc.cf?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/rules/10_misc.cf (original)
+++ spamassassin/trunk/rules/10_misc.cf Mon Feb  7 15:35:05 2005
@@ -70,23 +70,6 @@
 #user_scores_sql_username	spam
 #user_scores_sql_password	spamfilter
 
-###########################################################################
-# Automatic-whitelist directory, for the default db-based whitelist
-# backend.  By default, each user has their own, in their ~/.spamassassin
-# directory with mode 0600, but for system-wide SpamAssassin use, you may
-# want to share this across all users; uncomment and customise the below
-# lines.  (Make sure the mode has --x bits set.)
-
-# auto_whitelist_factor   0.5
-
-# default: per-user whitelist:
-# auto_whitelist_path        ~/.spamassassin/auto-whitelist
-# auto_whitelist_file_mode   0600
-
-# use this for a system-wide whitelist:
-# auto_whitelist_path        /var/spool/spamassassin/auto-whitelist
-# auto_whitelist_file_mode   0666
-
 ##########################################################################
 # Headers to be added to mail (can be overriden by users in
 # ~/.spamassassin/user_prefs)

Added: spamassassin/trunk/rules/60_awl.cf
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/60_awl.cf?view=auto&rev=151785
==============================================================================
--- spamassassin/trunk/rules/60_awl.cf (added)
+++ spamassassin/trunk/rules/60_awl.cf Mon Feb  7 15:35:05 2005
@@ -0,0 +1,30 @@
+# SpamAssassin rules file: auto-whitelist
+#
+# Please don't modify this file as your changes will be overwritten with
+# the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
+# See 'perldoc Mail::SpamAssassin::Conf' for details.
+#
+# <@LICENSE>
+# Copyright 2004 Apache Software Foundation
+# 
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+# 
+#     http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# </...@LICENSE>
+
+ifplugin Mail::SpamAssassin::Plugin::AWL
+
+header AWL			eval:check_from_in_auto_whitelist()
+describe AWL			From: address is in the auto white-list
+tflags AWL			userconf noautolearn
+priority AWL                    1000
+
+endif # Mail::SpamAssassin::Plugin::AWL

Modified: spamassassin/trunk/rules/60_whitelist.cf
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/60_whitelist.cf?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/rules/60_whitelist.cf (original)
+++ spamassassin/trunk/rules/60_whitelist.cf Mon Feb  7 15:35:05 2005
@@ -28,12 +28,6 @@
 # user slip-up could result in scribbling side-effects in the bayes
 # db as a result -- which is hard to remedy.
 
-# TODO: this test name is hard-coded several places, change everywhere
-header AWL			eval:check_from_in_auto_whitelist()
-describe AWL			From: address is in the auto white-list
-tflags AWL			userconf noautolearn
-priority AWL                    1000
-
 # 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()

Modified: spamassassin/trunk/rules/init.pre
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/init.pre?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/rules/init.pre (original)
+++ spamassassin/trunk/rules/init.pre Mon Feb  7 15:35:05 2005
@@ -53,7 +53,9 @@
 #
 #loadplugin Mail::SpamAssassin::Plugin::MSExec
 
+# AWL - do auto-whitelist checks
+loadplugin Mail::SpamAssassin::Plugin::AWL
+
 # AutoLearnThreshold - threshold-based discriminator for Bayes auto-learning
 #
 loadplugin Mail::SpamAssassin::Plugin::AutoLearnThreshold
-

Modified: spamassassin/trunk/spamassassin.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamassassin.raw?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/spamassassin.raw (original)
+++ spamassassin/trunk/spamassassin.raw Mon Feb  7 15:35:05 2005
@@ -196,7 +196,6 @@
 
   # last in 2.6
   'log-to-mbox|l:s'       => sub { warn "The -l option has been deprecated and is no longer supported, ignoring.\n" },
-  'auto-whitelist|a'      => sub { warn "The -a option has been removed.  Please look at the use_auto_whitelist config option instead.\n"; exit 2; },
   'warning-from|w:s'      => sub { warn "The -w option has been removed from spamassassin, please remove from your commandline and re-run.\n"; exit 2; }, 
   'whitelist-factory|M:s' => sub { warn "The -M option has been removed from spamassassin, please remove from your commandline and re-run.\n"; exit 2; },
 
@@ -271,6 +270,8 @@
 
 # if we're doing things in test mode, force disable long-term memory
 # functions like autowhitelist and bayes autolearn.
+# XXX - feels like we need a plugin hook here so plugins can be made
+# aware and take appropriate action.
 if ($opt{'test-mode'}) {
   $spamtest->{'conf'}->{'use_auto_whitelist'} = 0;
   $spamtest->{'conf'}->{'bayes_auto_learn'} = 0;
@@ -473,13 +474,13 @@
  -t, --test-mode                   Pipe message through and add extra
                                    report to the bottom
  --lint                            Lint the rule set: report syntax errors
- -W, --add-to-whitelist            Add addresses in mail to whitelist (AWL)
- --add-to-blacklist                Add addresses in mail to blacklist (AWL)
- -R, --remove-from-whitelist       Remove all addresses found in mail
-                                   from whitelist (AWL)
- --add-addr-to-whitelist=addr      Add addr to whitelist (AWL)
- --add-addr-to-blacklist=addr      Add addr to blacklist (AWL)
- --remove-addr-from-whitelist=addr Remove addr from whitelist (AWL)
+ -W, --add-to-whitelist            Add addresses in mail to persistent address whitelist
+ --add-to-blacklist                Add addresses in mail to persistent address blacklist
+ -R, --remove-from-whitelist       Remove all addresses found in mail from
+                                   persistent address list
+ --add-addr-to-whitelist=addr      Add addr to persistent address whitelist
+ --add-addr-to-blacklist=addr      Add addr to persistent address blacklist
+ --remove-addr-from-whitelist=addr Remove addr from persistent address list
  -D, --debug [area=n,...]          Print debugging messages
  -V, --version                     Print version
  -h, --help                        Print usage message
@@ -531,10 +532,6 @@
 If you run this with B<-d>, the message will first have SpamAssassin
 markup removed before being tested.
 
-If you run tests with the auto-whitelist enabled, the score result will be
-added to the AWL.  This may not be what you want to do.  If it is not,
-then disable the auto-whitelist.
-
 =item B<-r>, B<--report>
 
 Report this message as manually-verified spam.  This will submit the mail
@@ -583,44 +580,44 @@
 =item B<-W>, B<--add-to-whitelist>
 
 Add all email addresses, in the headers and body of the mail message read
-from STDIN, to the automatic whitelist.  Note that you must be running
-C<spamassassin> or C<spamd> with the auto-whitelist enabled for this
-to work.
+from STDIN, to a persistent address whitelist.  Note that you must be running
+C<spamassassin> or C<spamd> with a persistent address list plugin enabled for
+this to work.
 
 =item B<--add-to-blacklist>
 
 Add all email addresses, in the headers and body of the mail message read
-from STDIN, to the automatic whitelist with a high score (ensuring they
-will be ''blacklisted'').  Note that you must be running C<spamassassin>
-or C<spamd> with the auto-whitelist enabled.
+from STDIN, to the persistent address blacklist.  Note that you must be
+running C<spamassassin> or C<spamd> with a persistent address list plugin
+enabled for this to work.
 
 =item B<-R>, B<--remove-from-whitelist>
 
 Remove all email addresses, in the headers and body of the mail message read
-from STDIN, from the automatic whitelist. STDIN must contain a full email
+from STDIN, from a persistent address list. STDIN must contain a full email
 message, so to remove a single address you should use
 B<--remove-addr-from-whitelist> instead.
 
-Note that you must be running C<spamassassin> or C<spamd> with the
-auto-whitelist enabled.
+Note that you must be running C<spamassassin> or C<spamd> with a persistent
+address list plugin enabled for this to work.
 
 =item B<--add-addr-to-whitelist>
 
-Add the named email address to the automatic whitelist.  Note that you
-must be running C<spamassassin> or C<spamd> with the auto-whitelist
-enabled.
+Add the named email address to a persistent address whitelist.  Note that you
+must be running C<spamassassin> or C<spamd> with a persistent address list
+plugin enabled for this to work.
 
 =item B<--add-addr-to-blacklist>
 
-Add the named email address to the automatic whitelist with a high score
-(ensuring they will be ''blacklisted'').  Note that you must be running
-C<spamassassin> or C<spamd> with the auto-whitelist enabled.
+Add the named email address to a persistent address blacklist.  Note that you
+must be running C<spamassassin> or C<spamd> with a persistent address list
+plugin enabled for this to work.
 
 =item B<--remove-addr-from-whitelist>
 
-Remove the named email address from the automatic whitelist.  Note that
-you must be running C<spamassassin> or C<spamd> with the auto-whitelist
-enabled.
+Remove the named email address from a persistent address whitelist.  Note that
+you must be running C<spamassassin> or C<spamd> with a persistent address
+list plugin enabled for this to work.
 
 =item B<-L>, B<--local>
 

Modified: spamassassin/trunk/spamd/spamd.raw
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/spamd/spamd.raw?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/spamd/spamd.raw (original)
+++ spamassassin/trunk/spamd/spamd.raw Mon Feb  7 15:35:05 2005
@@ -216,9 +216,6 @@
   # last in 2.4
   'stop-at-threshold|S' => sub { warn "The -S option has been deprecated and is no longer supported, ignoring.\n" },
 
-  # last in 2.6
-  'auto-whitelist|whitelist|a'      => sub { warn "The -a option has been removed.  Please look at the use_auto_whitelist config option instead.\n"; exit 2; },
-
 ) or print_usage_and_exit();
 
 if ($opt{'help'}) {
@@ -1642,7 +1639,7 @@
   }
 
   # assume that $userdir will be a writable directory we can
-  # use for AWL, Bayes dbs etc.
+  # use for Bayes dbs etc.
   $spamtest->signal_user_changed(
     {
       username => $username,
@@ -1710,7 +1707,7 @@
     }
   }
 
-  my $spam_conf_dir = $dir . '/.spamassassin';    #needed for AWL, Bayes, etc.
+  my $spam_conf_dir = $dir . '/.spamassassin';    #needed for Bayes, etc.
   if ( !-d $spam_conf_dir ) {
     if ( mkdir $spam_conf_dir, 0700 ) {
       logmsg("info: created $spam_conf_dir for $username.");
@@ -1754,7 +1751,7 @@
     }
   }
 
-  my $spam_conf_dir = $dir . '/.spamassassin';    #needed for AWL, Bayes, etc.
+  my $spam_conf_dir = $dir . '/.spamassassin';    #needed for Bayes, etc.
   if ( !-d $spam_conf_dir ) {
     if ( mkdir $spam_conf_dir, 0700 ) {
       logmsg("info: created $spam_conf_dir for $username.");
@@ -2238,7 +2235,7 @@
 Turn on SQL lookups even when per-user config files have been disabled
 with B<-x> and also setuid to the user.  This is useful for spamd hosts
 which want to load user preferences from an SQL database but also wish to
-support the use of B<-a> (AWL) and B<-H> (Helper home directories.)
+support the use of B<-H> (Helper home directories.)
 
 =item B<--setuid-with-ldap>
 
@@ -2282,8 +2279,7 @@
 This path must be a writable directory.  It will be created if it does not
 already exist.  If a file called B<user_prefs> exists in this directory (note:
 B<not> in a C<.spamassassin> subdirectory!), it will be loaded as the user's
-preferences.  The auto-whitelist and/or Bayes databases for that user will be
-stored in this directory.
+preferences.  The Bayes databases for that user will be stored in this directory.
 
 Note that this B<requires> that B<-x> is used, and cannot be combined with
 SQL- or LDAP-based configuration.

Modified: spamassassin/trunk/t/db_awl_path.t
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/t/db_awl_path.t?view=diff&r1=151784&r2=151785
==============================================================================
--- spamassassin/trunk/t/db_awl_path.t (original)
+++ spamassassin/trunk/t/db_awl_path.t Mon Feb  7 15:35:05 2005
@@ -28,9 +28,8 @@
 my $fh = IO::File->new_tmpfile();
 ok($fh);
 open(STDERR, ">&=".fileno($fh)) || die "Cannot reopen STDERR";
-ok (!sarun (
-"--add-addr-to-whitelist whitelist_test\@whitelist.spamassassin.taint.org",
-                \&patterns_run_cb));
+sarun("--add-addr-to-whitelist whitelist_test\@whitelist.spamassassin.taint.org",
+      \&patterns_run_cb);
 seek($fh, 0, 0);
 my $error = do {
   local $/;
@@ -45,3 +44,4 @@
 sarun ("-L -t < data/spam/004", \&patterns_run_cb);
 ok_all_patterns();
 
+ok(unlink 'log/awl'); # need a little cleanup



Re: svn commit: r151785 - in spamassassin/trunk: ./ lib/Mail/ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/Plugin/ lib/Mail/SpamAssassin/Util/ rules/ spamd/ t/

Posted by Michael Parker <pa...@pobox.com>.
On Mon, Feb 07, 2005 at 07:03:31PM -0500, Theo Van Dinter wrote:
> 
> Would it be possible for us to take this opportunity and rename AWL to
> something more accurate?
> 

Well, that is the next step.  Making AWL a plugin was necessary in
order to help folks transition to the new History plugin (in progress
but not much more than a little code and lots of notes).  It will have
a different DB structure but very much the same spirit.  Once the
History plugin goes in, AWL can be considered deprecated and we can
remove it anytime after 3.1.

Michael

Re: svn commit: r151785 - in spamassassin/trunk: ./ lib/Mail/ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/Plugin/ lib/Mail/SpamAssassin/Util/ rules/ spamd/ t/

Posted by Theo Van Dinter <fe...@kluge.net>.
On Mon, Feb 07, 2005 at 11:35:16PM -0000, parker@apache.org wrote:
> Added:
>     spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/AWL.pm
>     spamassassin/trunk/rules/60_awl.cf
> Modified:
>     spamassassin/trunk/INSTALL
>     spamassassin/trunk/MANIFEST
>     spamassassin/trunk/lib/Mail/SpamAssassin.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/AutoWhitelist.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgLearner.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm
>     spamassassin/trunk/lib/Mail/SpamAssassin/Util/DependencyInfo.pm
>     spamassassin/trunk/rules/10_misc.cf
>     spamassassin/trunk/rules/60_whitelist.cf
>     spamassassin/trunk/rules/init.pre
>     spamassassin/trunk/spamassassin.raw
>     spamassassin/trunk/spamd/spamd.raw
>     spamassassin/trunk/t/db_awl_path.t

Wow, that's a lot of work, nice! ;)

Would it be possible for us to take this opportunity and rename AWL to
something more accurate?

-- 
Randomly Generated Tagline:
You do not have mail.