You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by km...@apache.org on 2020/08/01 04:39:38 UTC

svn commit: r1880494 - in /spamassassin/trunk: ./ ldap/ lib/Mail/SpamAssassin/ lib/Mail/SpamAssassin/Conf/ lib/Mail/SpamAssassin/Plugin/ rules/ sql/ t/ t/data/

Author: kmcgrail
Date: Sat Aug  1 04:39:37 2020
New Revision: 1880494

URL: http://svn.apache.org/viewvc?rev=1880494&view=rev
Log:
changing whitelist_from to welcomelist_from including backward compatibility stubs and using feature check instead of using a version test for rules.  Also added a new plugin for allowing the RaciallyCharged language and added it disabled to v400.pre.  Logic and scoring added for the new plugin as well to the rules for welcomelist_from and welcomelist_to.

Added:
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RaciallyCharged.pm
      - copied, changed from r1880489, spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/HTTPSMismatch.pm
    spamassassin/trunk/t/spamd_welcomelist_leak.t   (with props)
    spamassassin/trunk/t/welcomelist_from.t
Modified:
    spamassassin/trunk/MANIFEST
    spamassassin/trunk/ldap/README
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm
    spamassassin/trunk/rules/50_scores.cf
    spamassassin/trunk/rules/60_whitelist.cf
    spamassassin/trunk/rules/user_prefs.template
    spamassassin/trunk/rules/v400.pre
    spamassassin/trunk/sql/README
    spamassassin/trunk/t/data/01_test_rules.cf
    spamassassin/trunk/t/data/01_test_rules.pre
    spamassassin/trunk/t/debug.t
    spamassassin/trunk/t/welcomelist_to.t
    spamassassin/trunk/t/whitelist_to.t

Modified: spamassassin/trunk/MANIFEST
URL: http://svn.apache.org/viewvc/spamassassin/trunk/MANIFEST?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/MANIFEST (original)
+++ spamassassin/trunk/MANIFEST Sat Aug  1 04:39:37 2020
@@ -99,6 +99,7 @@ lib/Mail/SpamAssassin/Plugin/Phishing.pm
 lib/Mail/SpamAssassin/Plugin/PhishTag.pm
 lib/Mail/SpamAssassin/Plugin/PDFInfo.pm
 lib/Mail/SpamAssassin/Plugin/Pyzor.pm
+lib/Mail/SpamAssassin/Plugin/RaciallyCharged.pm
 lib/Mail/SpamAssassin/Plugin/Razor2.pm
 lib/Mail/SpamAssassin/Plugin/RelayCountry.pm
 lib/Mail/SpamAssassin/Plugin/RelayEval.pm
@@ -453,6 +454,7 @@ t/data/phishing/phishtank-feed.csv
 t/data/spam/phishing_openphish.eml
 t/data/spam/phishing_phishtank.eml
 t/welcomelist_to.t
+t/welcomelist_from.t
 t/phishing.t
 t/date.t
 t/db_awl_path.t
@@ -577,6 +579,7 @@ t/spamd_unix_and_tcp.t
 t/spamd_user_rules_leak.t
 t/spamd_utf8.t
 t/spamd_whitelist_leak.t
+t/spamd_welcomelist_leak.t
 t/spf.t
 t/sql_based_whitelist.t
 t/stop_always_matching_regexps.t

Modified: spamassassin/trunk/ldap/README
URL: http://svn.apache.org/viewvc/spamassassin/trunk/ldap/README?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/ldap/README (original)
+++ spamassassin/trunk/ldap/README Sat Aug  1 04:39:37 2020
@@ -6,9 +6,9 @@ SpamAssassin can now load users' score f
 here is to have a web application (PHP/perl/ASP/etc.) that will allow users to
 be able to update their local preferences on how SpamAssassin will filter their
 e-mail.  The most common use for a system like this would be for users to be
-able to update the white list of addresses (whitelist_from) without the need
-for them to update their $HOME/.spamassassin/user_prefs file.  It is also quite
-common for users listed in /etc/passwd to not have a home directory,
+able to update the white list of addresses (welcomelist_from, previously whitelist_from) 
+without the need for them to update their $HOME/.spamassassin/user_prefs file.  
+It is also quite common for users listed in /etc/passwd to not have a home directory,
 therefore, the only way to have their own local settings would be through a
 database or LDAP server.
 
@@ -38,8 +38,8 @@ Examples:
 
 If the user_scores_dsn option does not exist, SpamAssassin will not attempt
 to use an LDAP server for retrieving users' preferences. Note that this will
-NOT look for test rules, only local scores, whitelist_from(s), and
-required_score.
+NOT look for test rules, only local scores, welcomelist_from(s) (previously whitelist_from), 
+and required_score.
 
 Requirements
 ------------

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf.pm Sat Aug  1 04:39:37 2020
@@ -288,7 +288,9 @@ it from running.
 
 =over 4
 
-=item whitelist_from user@example.com
+=item welcomelist_from user@example.com
+
+Previously whitelist_from which will work interchangeably until 4.1.
 
 Used to whitelist sender addresses which send mail that is often tagged
 (incorrectly) as spam.
@@ -305,7 +307,7 @@ are not. Regular expressions are not use
 Matching is case-insensitive.
 
 Multiple addresses per line, separated by spaces, is OK.  Multiple
-C<whitelist_from> lines are also OK.
+C<welcomelist_from> lines are also OK.
 
 The headers checked for whitelist addresses are as follows: if C<Resent-From>
 is set, use that; otherwise check all addresses taken from the following
@@ -321,23 +323,24 @@ where this is available, is looked up.
 
 e.g.
 
-  whitelist_from joe@example.com fred@example.com
-  whitelist_from *@example.com
+  welcomelist_from joe@example.com fred@example.com
+  welcomelist_from *@example.com
 
 =cut
 
   push (@cmds, {
-    setting => 'whitelist_from',
+    setting => 'welcomelist_from',
     type => $CONF_TYPE_ADDRLIST,
+    aliases => ['whitelist_from'],     # backward compatible - to be removed for 4.1
   });
 
 =item unwhitelist_from user@example.com
 
-Used to remove a default whitelist_from entry, so for example a distribution
-whitelist_from can be overridden in a local.cf file, or an individual user can
-override a whitelist_from entry in their own C<user_prefs> file.
+Used to remove a default welcomelist_from (previously whitelist_from) entry, so for example a distribution
+welcomelist_from can be overridden in a local.cf file, or an individual user can
+override a welcomelist_from entry in their own C<user_prefs> file.
 The specified email address has to match exactly (although case-insensitively)
-the address previously used in a whitelist_from line, which implies that a
+the address previously used in a welcomelist_from line, which implies that a
 wildcard only matches literally the same wildcard (not 'any' address).
 
 e.g.
@@ -349,14 +352,14 @@ e.g.
 
   push (@cmds, {
     command => 'unwhitelist_from',
-    setting => 'whitelist_from',
+    setting => 'welcomelist_from',
     type => $CONF_TYPE_ADDRLIST,
     code => \&Mail::SpamAssassin::Conf::Parser::remove_addrlist_value
   });
 
 =item whitelist_from_rcvd addr@lists.sourceforge.net sourceforge.net
 
-Works similarly to whitelist_from, except that in addition to matching
+Works similarly to welcomelist_from (previously whitelist_from), except that in addition to matching
 a sender address, a relay's rDNS name or its IP address must match too
 for the whitelisting rule to fire. The first parameter is a sender's e-mail
 address to whitelist, and the second is a string to match the relay's rDNS,
@@ -510,7 +513,7 @@ e.g.
 =item blacklist_from user@example.com
 
 Used to specify addresses which send mail that is often tagged (incorrectly) as
-non-spam, but which the user doesn't want.  Same format as C<whitelist_from>.
+non-spam, but which the user doesn't want.  Same format as C<welcomelist_from>.
 
 =cut
 
@@ -552,7 +555,7 @@ If the given address appears as a recipi
 (Resent-To, To, Cc, obvious envelope recipient, etc.) the mail will
 be listed as allowed.  Useful if you're deploying SpamAssassin system-wide,
 and don't want some users to have their mail filtered.  Same format
-as C<whitelist_from>.
+as C<welcomelist_from>.
 
 There are three levels of To-welcomelisting, C<welcomelist_to>, C<more_spam_to>
 and C<all_spam_to>.  Users in the first level may still get some spammish
@@ -615,7 +618,7 @@ be blacklisted.  Same format as C<blackl
 =item whitelist_auth user@example.com
 
 Used to specify addresses which send mail that is often tagged (incorrectly) as
-spam.  This is different from C<whitelist_from> and C<whitelist_from_rcvd> in
+spam.  This is different from C<welcomelist_from> and C<whitelist_from_rcvd> in
 that it first verifies that the message was sent by an authorized sender for
 the address, before whitelisting.
 
@@ -800,8 +803,8 @@ directive blacklist_from
 Enlisting an address to the list named welcomelist_to is synonymous to using the
 directive welcomelist_to 
 
-Enlisting an address to the list named whitelist_from is synonymous to using the
-directive whitelist_from
+Enlisting an address to the list named welcomelist_from (previously whitelist_from) is synonymous to using the
+directive welcomelist_from
 
 e.g.
 
@@ -2213,7 +2216,7 @@ setting.  Example:
 Bayesian classification and autolearning will not be performed on mail
 from the listed addresses.  Program C<sa-learn> will also ignore the
 listed addresses if it is invoked using the C<--use-ignores> option.
-One or more addresses can be listed, see C<whitelist_from>.
+One or more addresses can be listed, see C<welcomelist_from>.
 
 Spam messages from certain senders may contain many words that
 frequently occur in ham.  For example, one might read messages from a
@@ -4807,7 +4810,7 @@ sub new {
 
   $self->{whitelist_auth} = { };
   $self->{def_whitelist_auth} = { };
-  $self->{whitelist_from} = { };
+  $self->{welcomelist_from} = { };
   $self->{whitelist_allows_relays} = { };
   $self->{blacklist_from} = { };
   $self->{whitelist_from_rcvd} = { };

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Conf/Parser.pm Sat Aug  1 04:39:37 2020
@@ -61,7 +61,7 @@ The type of this setting:
  - $CONF_TYPE_NUMERIC: numeric value (float or int)
  - $CONF_TYPE_BOOL: boolean (0/no or 1/yes)
  - $CONF_TYPE_TEMPLATE: template, like "report"
- - $CONF_TYPE_ADDRLIST: list of mail addresses, like "whitelist_from"
+ - $CONF_TYPE_ADDRLIST: list of mail addresses, like "welcomelist_from" (previously whitelist_from)
  - $CONF_TYPE_HASH_KEY_VALUE: hash key/value pair, like "describe" or tflags
  - $CONF_TYPE_STRINGLIST list of strings, stored as an array
  - $CONF_TYPE_IPADDRLIST list of IP addresses, stored as an array of SA::NetSet

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Sat Aug  1 04:39:37 2020
@@ -3360,7 +3360,8 @@ sub all_from_addrs {
   else {
     # bug 2292: Used to use find_all_addrs_in_line() with the same
     # headers, but the would catch addresses in comments which caused
-    # FNs for things like whitelist_from.  Since all of these are From
+    # FNs for things like welcomelist_from (previously whitelist_from).  
+    # Since all of these are From
     # headers, there should only be 1 address in each anyway (not exactly
     # true, RFC 2822 allows multiple addresses in a From header field),
     # so use the :addr code...

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm Sat Aug  1 04:39:37 2020
@@ -182,7 +182,7 @@ sub set_config {
 
 =item whitelist_from_dkim author@example.com [signing-domain]
 
-Works similarly to whitelist_from, except that in addition to matching
+Works similarly to welcomelist_from (previously whitelist_from), except that in addition to matching
 an author address (From) to the pattern in the first parameter, the message
 must also carry a valid Domain Keys Identified Mail (DKIM) signature made by
 a signing domain (SDID, i.e. the d= tag) that is acceptable to us.
@@ -1214,7 +1214,7 @@ sub _wlcheck_acceptable_signature {
   }
 }
 
-# use a traditional whitelist_from -style addrlist, the only acceptable DKIM
+# use a traditional welcomelist_from -style (previously whitelist_from) addrlist, the only acceptable DKIM
 # signature is an Author Domain Signature.  Note: don't pre-parse and store
 # domains; that's inefficient memory-wise and only saves one m//
 #

Copied: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RaciallyCharged.pm (from r1880489, spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/HTTPSMismatch.pm)
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RaciallyCharged.pm?p2=spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RaciallyCharged.pm&p1=spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/HTTPSMismatch.pm&r1=1880489&r2=1880494&rev=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/HTTPSMismatch.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RaciallyCharged.pm Sat Aug  1 04:39:37 2020
@@ -15,95 +15,30 @@
 # limitations under the License.
 # </...@LICENSE>
 
-package Mail::SpamAssassin::Plugin::HTTPSMismatch;
+package Mail::SpamAssassin::Plugin::RaciallyCharged;
 
-use Mail::SpamAssassin::Plugin;
-use Mail::SpamAssassin::Logger;
-use Mail::SpamAssassin::Constants qw(:ip);
 use strict;
-use warnings;
-# use bytes;
-use re 'taint';
+use Mail::SpamAssassin::Plugin;
 
-our @ISA = qw(Mail::SpamAssassin::Plugin);
+use vars qw(@ISA);
+@ISA = qw(Mail::SpamAssassin::Plugin);
+
+sub dbg { Mail::SpamAssassin::Plugin::dbg ("RaciallyCharged: @_"); }
 
-# constructor: register the eval rule
 sub new {
-  my $class = shift;
-  my $mailsaobject = shift;
+  my ($class, $mailsa) = @_;
 
-  # some boilerplate...
+  # the usual perlobj boilerplate to create a subclass object
   $class = ref($class) || $class;
-  my $self = $class->SUPER::new($mailsaobject);
+  my $self = $class->SUPER::new($mailsa);
   bless ($self, $class);
 
-  # the important bit!
-  $self->register_eval_rule ("check_https_http_mismatch", $Mail::SpamAssassin::Conf::TYPE_BODY_EVALS);
+  $self->{RaciallyCharged} = 1;
 
-  return $self;
-}
-
-# [lt]a href="http://baboz-njeryz.de/"[gt]https://bankofamerica.com/[lt]/a[gt]
-# ("<" and ">" replaced with "[lt]" and "[gt]" to avoid Kaspersky Desktop AV
-# false positive ;)
-sub check_https_http_mismatch {
-  my ($self, $permsgstatus, undef, $minanchors, $maxanchors) = @_;
-
-  $minanchors ||= 1;
-
-  if (!exists $permsgstatus->{chhm_hit}) {
-    $permsgstatus->{chhm_hit} = 0;
-    $permsgstatus->{chhm_anchors} = 0;
-
-    foreach my $k ( keys %{$permsgstatus->{html}->{uri_detail}} ) {
-      my %uri_detail = %{$permsgstatus->{html}->{uri_detail}};
-      my $v = ${uri_detail}{$k};
-      # if the URI wasn't used for an anchor tag, or the anchor text didn't
-      # exist, skip this.
-      next unless (exists $v->{anchor_text} && @{$v->{anchor_text}});
-
-      my $uri;
-      if ($k =~ m@^https?://([^/:?#]+)@i) {
-        $uri = $1;
-        # Skip IPs since there's another rule to catch that already
-        if ($uri =~ IS_IP_ADDRESS) {
-          undef $uri;
-          next;
-        } 
-        # want to compare whole hostnames instead of domains?
-        # comment this next section to the blank line.
-        $uri = $self->{main}->{registryboundaries}->trim_domain($uri);
-        my $domain = $self->{main}->{registryboundaries}->uri_to_domain($uri);
-        undef $uri unless ($self->{main}->{registryboundaries}->is_domain_valid($domain));
-      }
-
-      next unless $uri;
-      $permsgstatus->{chhm_anchors}++ if exists $v->{anchor_text};
-
-      foreach (@{$v->{anchor_text}}) {
-        if (m@https://([^/:?#]+)@i) {
-          my $https = $1;
-
-	  # want to compare whole hostnames instead of domains?
-	  # comment this next section to the blank line.
-          if ($https !~ IS_IP_ADDRESS) {
-	    $https = $self->{main}->{registryboundaries}->trim_domain($https);
-            undef $https unless ($self->{main}->{registryboundaries}->is_domain_valid($https));
-          }
-	  next unless $https;
-
-	  dbg("https_http_mismatch: domains $uri -> $https");
-
-	  next if $uri eq $https;
-	  $permsgstatus->{chhm_hit} = 1;
-	  last;
-        }
-      }
-    }
-    dbg("https_http_mismatch: anchors ".$permsgstatus->{chhm_anchors});
-  }
+  dbg("Racially Charged configuration options enabled");
 
-  return ( $permsgstatus->{chhm_hit} && $permsgstatus->{chhm_anchors} >= $minanchors && (defined $maxanchors && $permsgstatus->{chhm_anchors} < $maxanchors) );
+  # and return the new plugin object
+  return $self;
 }
 
 1;

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/SPF.pm Sat Aug  1 04:39:37 2020
@@ -92,12 +92,12 @@ sub set_config {
 
 =item whitelist_from_spf user@example.com
 
-Works similarly to whitelist_from, except that in addition to matching
-a sender address, a check against the domain's SPF record must pass.
-The first parameter is an address to whitelist, and the second is a string
+Works similarly to welcomelist_from (previously whitelist_from), except that 
+in addition to matching a sender address, a check against the domain's SPF record 
+must pass. The first parameter is an address to whitelist, and the second is a string
 to match the relay's rDNS.
 
-Just like whitelist_from, multiple addresses per line, separated by spaces,
+Just like welcomelist_from (previously whitelist_from), multiple addresses per line, separated by spaces,
 are OK. Multiple C<whitelist_from_spf> lines are also OK.
 
 The headers checked for whitelist_from_spf addresses are the same headers

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/WLBLEval.pm Sat Aug  1 04:39:37 2020
@@ -49,7 +49,8 @@ sub new {
   $self->register_eval_rule("check_from_in_list", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
   $self->register_eval_rule("check_replyto_in_list", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
   $self->register_eval_rule("check_to_in_list", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
-  $self->register_eval_rule("check_from_in_whitelist", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
+  $self->register_eval_rule("check_from_in_welcomelist", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
+  $self->register_eval_rule("check_from_in_whitelist", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS); #Stub - Remove in SA 4.1
   $self->register_eval_rule("check_forged_in_whitelist", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
   $self->register_eval_rule("check_from_in_default_whitelist", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
   $self->register_eval_rule("check_forged_in_default_whitelist", $Mail::SpamAssassin::Conf::TYPE_HEAD_EVALS);
@@ -186,17 +187,22 @@ sub check_to_in_list {
 
 ###########################################################################
 
-sub check_from_in_whitelist {
+sub check_from_in_welcomelist {
   my ($self, $pms) = @_;
-  $self->_check_from_in_whitelist($pms) unless exists $pms->{from_in_whitelist};
-  return ($pms->{from_in_whitelist} > 0);
+  $self->_check_from_in_welcomelist($pms) unless exists $pms->{from_in_welcomelist};
+  return ($pms->{from_in_welcomelist} > 0);
 }
 
+#Stub for backwards compatibility - Remove in SA 4.1
+sub check_from_in_whitelist {
+  return check_from_in_welcomelist(@_);
+} 
+
 sub check_forged_in_whitelist {
   my ($self, $pms) = @_;
-  $self->_check_from_in_whitelist($pms) unless exists $pms->{from_in_whitelist};
+  $self->_check_from_in_welcomelist($pms) unless exists $pms->{from_in_welcomelist};
   $self->_check_from_in_default_whitelist($pms) unless exists $pms->{from_in_default_whitelist};
-  return ($pms->{from_in_whitelist} < 0) && ($pms->{from_in_default_whitelist} == 0);
+  return ($pms->{from_in_welcomelist} < 0) && ($pms->{from_in_default_whitelist} == 0);
 }
 
 sub check_from_in_default_whitelist {
@@ -208,23 +214,23 @@ sub check_from_in_default_whitelist {
 sub check_forged_in_default_whitelist {
   my ($self, $pms) = @_;
   $self->_check_from_in_default_whitelist($pms) unless exists $pms->{from_in_default_whitelist};
-  $self->_check_from_in_whitelist($pms) unless exists $pms->{from_in_whitelist};
-  return ($pms->{from_in_default_whitelist} < 0) && ($pms->{from_in_whitelist} == 0);
+  $self->_check_from_in_welcomelist($pms) unless exists $pms->{from_in_welcomelist};
+  return ($pms->{from_in_default_whitelist} < 0) && ($pms->{from_in_welcomelist} == 0);
 }
 
 ###########################################################################
 
-sub _check_from_in_whitelist {
+sub _check_from_in_welcomelist {
   my ($self, $pms) = @_;
   my $found_match = 0;
   foreach ($pms->all_from_addrs()) {
-    if ($self->_check_welcomelist ($self->{main}->{conf}->{whitelist_from}, $_)) {
-      $pms->{from_in_whitelist} = 1;
+    if ($self->_check_welcomelist ($self->{main}->{conf}->{welcomelist_from}, $_)) {
+      $pms->{from_in_welcomelist} = 1;
       return;
     }
     my $wh = $self->_check_whitelist_rcvd ($pms, $self->{main}->{conf}->{whitelist_from_rcvd}, $_);
     if ($wh == 1) {
-      $pms->{from_in_whitelist} = 1;
+      $pms->{from_in_welcomelist} = 1;
       return;
     }
     elsif ($wh == -1) {
@@ -232,7 +238,7 @@ sub _check_from_in_whitelist {
     }
   }
 
-  $pms->{from_in_whitelist} = $found_match;
+  $pms->{from_in_welcomelist} = $found_match;
   return;
 }
 

Modified: spamassassin/trunk/rules/50_scores.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/50_scores.cf?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/rules/50_scores.cf (original)
+++ spamassassin/trunk/rules/50_scores.cf Sat Aug  1 04:39:37 2020
@@ -702,7 +702,7 @@ score MIME_CHARSET_FARAWAY 2.450
 # rescore never changes the whitelist/blacklist scores
 ifplugin Mail::SpamAssassin::Plugin::WLBLEval
 score USER_IN_BLACKLIST 100.000
-score USER_IN_WHITELIST -100.000
+#score USER_IN_WELCOMELIST -100.000 - Moved to 60_whitelist.cf
 score USER_IN_DEF_WHITELIST -15.000
 score USER_IN_BLACKLIST_TO   10.000
 score URI_HOST_IN_BLACKLIST  100.0

Modified: spamassassin/trunk/rules/60_whitelist.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/60_whitelist.cf?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/rules/60_whitelist.cf (original)
+++ spamassassin/trunk/rules/60_whitelist.cf Sat Aug  1 04:39:37 2020
@@ -1,4 +1,4 @@
-# SpamAssassin rules file: default whitelists
+# SpamAssassin rules file: default welcomelists
 #
 # Please don't modify this file as your changes will be overwritten with
 # the next update. Use @@LOCAL_RULES_DIR@@/local.cf instead.
@@ -22,7 +22,7 @@
 # </...@LICENSE>
 
 ###########################################################################
-# Whitelist rules
+# Welcomelist rules
 #
 # Note that most of these get 'noautolearn'.  They should not be
 # considered when deciding whether to auto-learn a message, as a
@@ -35,9 +35,32 @@ header USER_IN_BLACKLIST	eval:check_from
 describe USER_IN_BLACKLIST	From: address is in the user's black-list
 tflags USER_IN_BLACKLIST	userconf noautolearn
 
-header USER_IN_WHITELIST	eval:check_from_in_whitelist()
-describe USER_IN_WHITELIST	From: address is in the user's white-list
-tflags USER_IN_WHITELIST	userconf nice noautolearn
+
+if can(Mail::SpamAssassin::Conf::feature_blocklist_welcomelist)
+  #bz7826 renames whitelist to welcomelist
+  header USER_IN_WELCOMELIST		eval:check_from_in_welcomelist()
+  describe USER_IN_WELCOMELIST	 	user is listed in 'welcomelist_from'
+  tflags USER_IN_WELCOMELIST		userconf nice noautolearn
+  score USER_IN_WELCOMELIST             -100.0
+  
+  ifplugin Mail::SpamAssassin::Plugin::RaciallyCharged
+    meta USER_IN_WHITELIST                (USER_IN_WELCOMELIST)
+    describe USER_IN_WHITELIST            DEPRECATED: See USER_IN_WELCOMELIST
+    tflags USER_IN_WHITELIST              userconf nice noautolearn
+    score USER_IN_WELCOMELIST             -0.01
+    score USER_IN_WHITELIST               -100.0
+  endif
+else
+  header USER_IN_WELCOMELIST	 	eval:check_from_in_whitelist()
+  describe USER_IN_WELCOMELIST	 	user is listed in 'welcomelist_from'
+  tflags USER_IN_WELCOMELIST	 	userconf nice noautolearn
+  score USER_IN_WELCOMELIST	 	-0.01
+
+  meta USER_IN_WHITELIST        	(USER_IN_WELCOMELIST)
+  describe USER_IN_WHITELIST     	DEPRECATED: See USER_IN_WELCOMELIST 
+  tflags USER_IN_WHITELIST       	userconf nice noautolearn
+  score USER_IN_WHITELIST		-100.0
+endif
 
 header USER_IN_DEF_WHITELIST	eval:check_from_in_default_whitelist()
 describe USER_IN_DEF_WHITELIST	From: address is in the default white-list
@@ -52,7 +75,15 @@ if can(Mail::SpamAssassin::Conf::feature
   header USER_IN_WELCOMELIST_TO		eval:check_to_in_welcomelist()
   describe USER_IN_WELCOMELIST_TO	User is listed in 'welcomelist_to'
   tflags USER_IN_WELCOMELIST_TO		userconf nice noautolearn
-  score USER_IN_WELCOMELIST_TO		-6.0
+  score USER_IN_WELCOMELIST_TO          -6.0
+
+  ifplugin Mail::SpamAssassin::Plugin::RaciallyCharged
+    meta USER_IN_WHITELIST_TO             (USER_IN_WELCOMELIST_TO)
+    describe USER_IN_WHITELIST_TO         DEPRECATED: See USER_IN_WELCOMELIST_TO
+    tflags USER_IN_WHITELIST_TO           userconf nice noautolearn
+    score USER_IN_WELCOMELIST_TO	  -0.01
+    score USER_IN_WHITELIST_TO            -6.0
+  endif
 else
   header USER_IN_WELCOMELIST_TO		eval:check_to_in_whitelist()
   describe USER_IN_WELCOMELIST_TO	User is listed in 'welcomelist_to'
@@ -95,12 +126,12 @@ if (version >= 3.004000)
 endif
 
 ###########################################################################
-# Default whitelists.  These should be addresses which send mail that is often
+# Default welcomelists.  These should be addresses which send mail that is often
 # tagged (incorrectly) as spam; it also helps that they be addresses of big
 # companies with lots of lawyers, so if spammers impersonate them, they'll get
 # into big trouble, so it doesn't provide a shortcut around SpamAssassin.
 #
-# Whitelist and blacklist addresses are now file-glob-style patterns, so
+# Welcomelist and blocklist addresses are now file-glob-style patterns, so
 # "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.
 #
 # Please do not add unmoderated public mailing lists here.  They are

Modified: spamassassin/trunk/rules/user_prefs.template
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/user_prefs.template?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/rules/user_prefs.template (original)
+++ spamassassin/trunk/rules/user_prefs.template Sat Aug  1 04:39:37 2020
@@ -11,9 +11,10 @@
 # How many points before a mail is considered spam.
 # required_score		5
 
-# Whitelist and blacklist addresses are now file-glob-style patterns, so
+# Welcomelist and blocklist addresses are now file-glob-style patterns, so
 # "friend@somewhere.com", "*@isp.com", or "*.domain.net" will all work.
-# whitelist_from	someone@somewhere.com
+# welcomelist_from	someone@somewhere.com
+# welcomelist_to	someone@mydomain.com
 
 # Add your own customised scores for some tests below.  The default scores are
 # read from the installed spamassassin rules files, but you can override them

Modified: spamassassin/trunk/rules/v400.pre
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/v400.pre?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/rules/v400.pre (original)
+++ spamassassin/trunk/rules/v400.pre Sat Aug  1 04:39:37 2020
@@ -16,3 +16,7 @@
 # added to new files, named according to the release they're added in.
 ###########################################################################
 
+# RaciallyCharged - Enables racially charged configuration options for 
+# backwards compatibility
+#
+# loadplugin Mail::SpamAssassin::Plugin::RaciallyCharged

Modified: spamassassin/trunk/sql/README
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sql/README?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/sql/README (original)
+++ spamassassin/trunk/sql/README Sat Aug  1 04:39:37 2020
@@ -6,13 +6,13 @@ SpamAssassin can now load users' score f
 here is to have a web application (PHP/perl/ASP/etc.) that will allow users to
 be able to update their local preferences on how SpamAssassin will filter their
 e-mail.  The most common use for a system like this would be for users to be
-able to update the white list of addresses (whitelist_from) without the need
+able to update the white list of addresses (welcomelist_from, previously whitelist_from) without the need
 for them to update their $HOME/.spamassassin/user_prefs file.  It is also quite
 common for users listed in /etc/passwd to not have a home directory, therefore,
 the only way to have their own local settings would be through an RDBMS system.
 
 Note that this will NOT look for test rules, only local scores,
-whitelist_from(s), and required_score.
+welcomelist_from(s) (previously whitelist_from), and required_score.
 
 In addition, any config options marked as Admin Only will NOT be parsed from
 SQL preferences.
@@ -101,7 +101,7 @@ The database must contain a table, defau
 least three fields:
 
   username varchar(100)	  # this is the username whose e-mail is being filtered
-  preference varchar(50)  # the preference (whitelist_from, required_score, etc.)
+  preference varchar(50)  # the preference (welcomelist_from (previously whitelist_from), required_score, etc.)
   value varchar(100)	  # the value of the named preference
 
 You can add as many other fields you wish as long as the above three fields are

Modified: spamassassin/trunk/t/data/01_test_rules.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/data/01_test_rules.cf?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/t/data/01_test_rules.cf (original)
+++ spamassassin/trunk/t/data/01_test_rules.cf Sat Aug  1 04:39:37 2020
@@ -124,15 +124,15 @@ describe BAYES_99     Bayes spam probabi
 score BAYES_99 0 0 3.5 3.5
 
 ifplugin Mail::SpamAssassin::Plugin::WLBLEval
-header USER_IN_WHITELIST	eval:check_from_in_whitelist()
-tflags USER_IN_WHITELIST	userconf nice noautolearn
-score  USER_IN_WHITELIST -100.000
+#header USER_IN_WHITELIST	eval:check_from_in_whitelist()
+#tflags USER_IN_WHITELIST	userconf nice noautolearn
+#score  USER_IN_WHITELIST -100.000
 header USER_IN_DEF_WHITELIST	eval:check_from_in_default_whitelist()
 tflags USER_IN_DEF_WHITELIST	userconf nice noautolearn
 score  USER_IN_DEF_WHITELIST -15.000
-header USER_IN_WHITELIST_TO     eval:check_to_in_whitelist()
-tflags USER_IN_WHITELIST_TO     userconf nice noautolearn
-score  USER_IN_WHITELIST_TO -6.000
+#header USER_IN_WHITELIST_TO     eval:check_to_in_whitelist()
+#tflags USER_IN_WHITELIST_TO     userconf nice noautolearn
+#score  USER_IN_WHITELIST_TO -6.000
 header USER_IN_BLACKLIST	eval:check_from_in_blacklist()
 tflags USER_IN_BLACKLIST	userconf noautolearn
 score  USER_IN_BLACKLIST 100.000

Modified: spamassassin/trunk/t/data/01_test_rules.pre
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/data/01_test_rules.pre?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/t/data/01_test_rules.pre (original)
+++ spamassassin/trunk/t/data/01_test_rules.pre Sat Aug  1 04:39:37 2020
@@ -38,3 +38,4 @@ loadplugin Mail::SpamAssassin::Plugin::H
 loadplugin Mail::SpamAssassin::Plugin::FromNameSpoof
 loadplugin Mail::SpamAssassin::Plugin::Phishing
 #loadplugin Mail::SpamAssassin::Plugin::OLEVBMacro
+loadplugin Mail::SpamAssassin::Plugin::RaciallyCharged

Modified: spamassassin/trunk/t/debug.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/debug.t?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/t/debug.t (original)
+++ spamassassin/trunk/t/debug.t Sat Aug  1 04:39:37 2020
@@ -32,7 +32,7 @@ my %facility = map( ($_, 1),
       ident ignore info ldap learn locker log logger markup HashBL
       message metadata mimeheader netset plugin prefork progress pyzor razor2
       received-header replacetags reporter rules rules-all spamd spf textcat
-      timing TxRep uri uridnsbl util pdfinfo asn geodb ));
+      timing TxRep uri uridnsbl util pdfinfo asn geodb RaciallyCharged));
 
 my $fh = IO::File->new_tmpfile();
 open(STDERR, ">&=".fileno($fh)) || die "Cannot reopen STDERR";

Added: spamassassin/trunk/t/spamd_welcomelist_leak.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/spamd_welcomelist_leak.t?rev=1880494&view=auto
==============================================================================
--- spamassassin/trunk/t/spamd_welcomelist_leak.t (added)
+++ spamassassin/trunk/t/spamd_welcomelist_leak.t Sat Aug  1 04:39:37 2020
@@ -0,0 +1,60 @@
+#!/usr/bin/perl -T
+# bug 4179
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("spamd_whitelist_leak");
+
+use Test::More;
+plan skip_all => 'Spamd tests disabled.' if $SKIP_SPAMD_TESTS;
+plan tests => 8;
+
+# ---------------------------------------------------------------------------
+# bug 6003
+
+tstlocalrules (q{
+
+        body MYBODY /LOSE WEIGHT/
+        score MYBODY 99
+
+  });
+
+rmtree ("log/virtualconfig/testuser1", 0, 1);
+mkpath ("log/virtualconfig/testuser1", 0, 0755);
+rmtree ("log/virtualconfig/testuser2", 0, 1);
+mkpath ("log/virtualconfig/testuser2", 0, 0755);
+open (OUT, ">log/virtualconfig/testuser1/user_prefs");
+print OUT q{
+
+        welcomelist_from    sb55sb123456789@yahoo.com
+        whitelist_from_rcvd sb55sb123456789@yahoo.com  cgocable.ca
+        whitelist_from_rcvd sb55sb123456789@yahoo.com  webnote.net
+
+};
+close OUT;
+open (OUT, ">log/virtualconfig/testuser2/user_prefs");
+print OUT '';
+close OUT;
+
+%patterns = (
+  q{ 99 MYBODY }, 'MYBODY',
+  q{-0.0 USER_IN_WELCOMELIST }, 'USER_IN_WELCOMELIST',
+);
+%anti_patterns = (
+);
+
+# use -m1 so all scans use the same child
+ok (start_spamd ("--virtual-config-dir=log/virtualconfig/%u -L -u $spamd_run_as_user -m1"));
+ok (spamcrun ("-u testuser1 < data/spam/001", \&patterns_run_cb));
+ok_all_patterns();
+clear_pattern_counters();
+
+%patterns = (
+  q{ 99 MYBODY }, 'MYBODY',
+);
+%anti_patterns = (
+  q{-0.0 USER_IN_WELCOMELIST }, 'USER_IN_WELCOMELIST',
+);
+ok (spamcrun ("-u testuser2 < data/spam/001", \&patterns_run_cb));
+checkfile ($spamd_stderr, \&patterns_run_cb);
+ok_all_patterns();
+ok stop_spamd();

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

Added: spamassassin/trunk/t/welcomelist_from.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/welcomelist_from.t?rev=1880494&view=auto
==============================================================================
--- spamassassin/trunk/t/welcomelist_from.t (added)
+++ spamassassin/trunk/t/welcomelist_from.t Sat Aug  1 04:39:37 2020
@@ -0,0 +1,85 @@
+#!/usr/bin/perl -T
+
+use lib '.'; use lib 't';
+use SATest; sa_t_init("welcomelist_from");
+
+use Test::More;
+plan skip_all => 'Long running tests disabled' unless conf_bool('run_long_tests');
+plan tests => 32;
+
+# ---------------------------------------------------------------------------
+
+tstprefs ("
+        def_whitelist_from_rcvd *\@paypal.com paypal.com
+        def_whitelist_from_rcvd *\@paypal.com ebay.com
+        def_whitelist_from_rcvd mumble\@example.com example.com
+        whitelist_from_rcvd foo\@example.com spamassassin.org
+        whitelist_from_rcvd foo\@example.com example.com
+        whitelist_from_rcvd bar\@example.com example.com
+        whitelist_allows_relays bar\@example.com
+        welcomelist_from baz\@example.com
+        welcomelist_from bam\@example.com
+        unwhitelist_from bam\@example.com
+        unwhitelist_from_rcvd mumble\@example.com
+	");
+
+# tests 1 - 4 does welcomelist_from (previously whitelist_from) work?
+%patterns = (
+             q{ USER_IN_WELCOMELIST }, 'w1'
+             );
+
+%anti_patterns = (
+             q{ FORGED_IN_WHITELIST }, 'a2',
+             q{ USER_IN_DEF_WHITELIST }, 'a3',
+             q{ FORGED_IN_DEF_WHITELIST }, 'a4'
+             );
+sarun ("-L -t < data/nice/008", \&patterns_run_cb);
+ok_all_patterns();
+
+# tests 5 - 8 does whitelist_from_rcvd work?
+sarun ("-L -t < data/nice/009", \&patterns_run_cb);
+ok_all_patterns();
+
+# tests 9 - 12 second relay specified for same addr in whitelist_from_rcvd
+sarun ("-L -t < data/nice/010", \&patterns_run_cb);
+ok_all_patterns();
+
+%patterns = (
+             q{ USER_IN_DEF_WHITELIST }, 'w5'
+             );
+
+%anti_patterns = (
+             q{ USER_IN_WHITELIST }, 'a6',
+             q{ FORGED_IN_WHITELIST }, 'a7',
+             q{ FORGED_IN_DEF_WHITELIST }, 'a8'
+             );
+
+# tests 13 - 16 does def_whitelist_from_rcvd work?
+sarun ("-L -t < data/nice/011", \&patterns_run_cb);
+ok_all_patterns();
+
+# tests 17 - 20 second relay specified for same addr in def_whitelist_from_rcvd
+sarun ("-L -t < data/nice/012", \&patterns_run_cb);
+ok_all_patterns();
+
+%patterns = ();
+
+%anti_patterns = (
+             q{ USER_IN_WHITELIST }, 'a9',
+             q{ FORGED_IN_WHITELIST }, 'a10',
+             q{ USER_IN_DEF_WHITELIST }, 'a11',
+             q{ FORGED_IN_DEF_WHITELIST }, 'a12'
+             );
+# tests 21 - 24 does whitelist_allows_relays suppress the forged rule without
+#  putting the address on the whitelist?
+sarun ("-L -t < data/nice/013", \&patterns_run_cb);
+ok_all_patterns();
+
+# tests 25 - 28 does unwhitelist_from work?
+sarun ("-L -t < data/nice/014", \&patterns_run_cb);
+ok_all_patterns();
+
+# tests 29 - 32 does unwhitelist_from_rcvd work?
+sarun ("-L -t < data/nice/015", \&patterns_run_cb);
+ok_all_patterns();
+

Modified: spamassassin/trunk/t/welcomelist_to.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/welcomelist_to.t?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/t/welcomelist_to.t (original)
+++ spamassassin/trunk/t/welcomelist_to.t Sat Aug  1 04:39:37 2020
@@ -19,5 +19,5 @@ tstprefs ("
         welcomelist_to announce*
 	");
 
-sarun ("-L -t -D < data/nice/016", \&patterns_run_cb);
+sarun ("-L -t < data/nice/016", \&patterns_run_cb);
 ok_all_patterns();

Modified: spamassassin/trunk/t/whitelist_to.t
URL: http://svn.apache.org/viewvc/spamassassin/trunk/t/whitelist_to.t?rev=1880494&r1=1880493&r2=1880494&view=diff
==============================================================================
--- spamassassin/trunk/t/whitelist_to.t (original)
+++ spamassassin/trunk/t/whitelist_to.t Sat Aug  1 04:39:37 2020
@@ -17,5 +17,5 @@ tstprefs ("
         whitelist_to announce*
 	");
 
-sarun ("-L -t -D < data/nice/016", \&patterns_run_cb);
+sarun ("-L -t < data/nice/016", \&patterns_run_cb);
 ok_all_patterns();