You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2005/04/26 23:24:32 UTC

svn commit: r164887 - in /spamassassin/trunk: lib/Mail/SpamAssassin/EvalTests.pm rules/50_scores.cf

Author: felicity
Date: Tue Apr 26 14:24:31 2005
New Revision: 164887

URL: http://svn.apache.org/viewcvs?rev=164887&view=rev
Log:
bug 4182: generalize accreditation header support

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
    spamassassin/trunk/rules/50_scores.cf

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm?rev=164887&r1=164886&r2=164887&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Tue Apr 26 14:24:31 2005
@@ -1279,18 +1279,18 @@
   check_rbl_sub(@_);
 }
 
-# Check a RBL if a message is Habeas SWE.
-#	Test is skipped if the SWE 2.0 "Reputation Tag" is matched in the
-#	Envelope From address.  Otherwise transitional senders would get a
-#	double bonus.  <cs...@habeas.com>
+# Check an RBL if a message is Habeas SWE (a.k.a. the Habeas Haiku).
+#	Test is skipped if the message contains an Accreditor assertion;
+#	otherwise transitional senders using both the SWE header and the
+#	accreditor assertion would get a double bonus.  <cs...@habeas.com>
 #
 sub check_rbl_swe {
   my ($self, $rule, $set, $rbl_server, $subtest) = @_;
 
-  if (!defined $self->{envelope_accreditor_tag}) {
-    $self->message_envelope_accreditor_tag();
+  if (!defined $self->{accreditor_tag}) {
+    $self->message_accreditor_tag();
   }
-  if ($self->{envelope_accreditor_tag}) {
+  if (%{$self->{accreditor_tag}}) {
     return 0;
   }
   if (!defined $self->{habeas_swe}) {
@@ -1302,16 +1302,17 @@
   return 0;
 }
 
-# check an RBL if "--accreditor" tag is in Envelope From.
-#	<cs...@habeas.com>
+# check an RBL if the message contains an "accreditor assertion," that is,
+#	the message contains the name of a service that will vouch for their
+#	practices.  <cs...@habeas.com>
 #
 sub check_rbl_accreditor {
   my ($self, $rule, $set, $rbl_server, $subtest, $accreditor) = @_;
 
-  if (!defined $self->{envelope_accreditor_tag}) {
-    $self->message_envelope_accreditor_tag();
+  if (!defined $self->{accreditor_tag}) {
+    $self->message_accreditor_tag();
   }
-  if ($self->{envelope_accreditor_tag} eq $accreditor) {
+  if ($self->{accreditor_tag}->{$accreditor}) {
     $self->check_rbl_backend($rule, $set, $rbl_server, 'A', $subtest);
   }
   return 0;
@@ -2064,14 +2065,40 @@
   return $self->{habeas_swe};
 }
 
-sub message_envelope_accreditor_tag {
+# Check for an Accreditor Assertion within the message, that is, the name of
+#	a third-party who will vouch for the sender's practices. The accreditor
+#	can be asserted in the EnvelopeFrom like this:
+#
+#	    listowner@a--accreditor.mail.example.com
+#
+#	or in an 'Accreditor" Header field, like this:
+#
+#	    Accreditor: accreditor1, parm=value; accreditor2, parm-value
+#
+#	This implementation supports multiple accreditors, but ignores any
+#	parameters in the header field.
+#
+sub message_accreditor_tag {
   my ($self) = @_;
+  my %acctags;
 
   if ($self->get('EnvelopeFrom:addr') =~ /[@.]a--([a-z0-9]{3,})\./i) {
-    ($self->{envelope_accreditor_tag} = $1) =~ tr/A-Z/a-z/;
-    return;
+    (my $tag = $1) =~ tr/A-Z/a-z/;
+    $acctags{$tag} = -1;
+  }
+  my $accreditor_field = $self->get('Accreditor');
+  if (defined($accreditor_field)) {
+    my @accreditors = split(/,/, $accreditor_field);
+    foreach my $accreditor (@accreditors) {
+      my @terms = split(' ', $accreditor);
+      if ($#terms >= 0) {
+	  my $tag = $terms[0];
+	  $tag =~ tr/A-Z/a-z/;
+	  $acctags{$tag} = -1;
+      }
+    }
   }
-  $self->{envelope_accreditor_tag} = "";
+  $self->{accreditor_tag} = \%acctags;
 }
 
 ###########################################################################

Modified: spamassassin/trunk/rules/50_scores.cf
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/rules/50_scores.cf?rev=164887&r1=164886&r2=164887&view=diff
==============================================================================
--- spamassassin/trunk/rules/50_scores.cf (original)
+++ spamassassin/trunk/rules/50_scores.cf Tue Apr 26 14:24:31 2005
@@ -599,7 +599,7 @@
 
 # Habeas: http://www.habeas.com/
 score HABEAS_ACCREDITED_COI 0 -8.0 0 -8.0
-score HABEAS_ACCREDITED_SOI 0 -4.0 0 -4.0
+score HABEAS_ACCREDITED_SOI 0 -4.3 0 -4.3
 score HABEAS_CHECKED 0 -0.2 0 -0.2
 score HABEAS_INFRINGER 0 16.0 0 16.0
 score HABEAS_USER 0 -8.0 0 -8.0