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 2004/02/29 06:09:12 UTC

svn commit: rev 6931 - in incubator/spamassassin/trunk: lib/Mail/SpamAssassin masses/rule-dev rules tools

Author: felicity
Date: Sat Feb 28 21:09:10 2004
New Revision: 6931

Modified:
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
   incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm
   incubator/spamassassin/trunk/masses/rule-dev/maildir-scan-headers
   incubator/spamassassin/trunk/rules/20_fake_helo_tests.cf
   incubator/spamassassin/trunk/rules/20_head_tests.cf
   incubator/spamassassin/trunk/rules/20_phrases.cf
   incubator/spamassassin/trunk/rules/20_ratware.cf
   incubator/spamassassin/trunk/tools/bayes_dump_to_trusted_networks
Log:
we prefer /(foo)?/ instead of /(foo|)/ ...

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm	Sat Feb 28 21:09:10 2004
@@ -369,7 +369,7 @@
     next if (!defined $by[$i] || $by[$i] !~ /^\w+(?:[\w.-]+\.)+\w+$/);
 
     if (defined ($from[$i]) && defined($fromip[$i])) {
-      if ($from[$i] =~ /^localhost(?:\.localdomain|)$/) {
+      if ($from[$i] =~ /^localhost(?:\.localdomain)?$/) {
         if ($fromip[$i] eq '127.0.0.1') {
           # valid: bouncing around inside 1 machine, via the localhost
           # interface (freshmeat newsletter does this).  TODO: this
@@ -480,9 +480,9 @@
 
   if ($self->gated_through_received_hdr_remover()) { return; }
 
-  if ($rcvd =~ /from \S*hotmail.com \(\S+\.hotmail(?:\.msn|)\.com[ \)]/ && $ip)
+  if ($rcvd =~ /from \S*hotmail.com \(\S+\.hotmail(?:\.msn)?\.com[ \)]/ && $ip)
                 { return; }
-  if ($rcvd =~ /from \S+ by \S+\.hotmail(?:\.msn|)\.com with HTTP\;/ && $ip)
+  if ($rcvd =~ /from \S+ by \S+\.hotmail(?:\.msn)?\.com with HTTP\;/ && $ip)
                 { return; }
   if ($rcvd =~ /from \[66\.218.\S+\] by \S+\.yahoo\.com/ && $ip)
                 { return; }

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm	Sat Feb 28 21:09:10 2004
@@ -632,21 +632,21 @@
     $subject ||= '';
     my $tag = $self->_replace_tags($self->{conf}->{rewrite_header}->{Subject});
     $tag =~ s/\n/ /gs; # strip tag's newlines
-    $subject =~ s/^(?:\Q${tag}\E |)/${tag} /g; # For some reason the tag may already be there!?
+    $subject =~ s/^(?:\Q${tag}\E )?/${tag} /g; # For some reason the tag may already be there!?
   }
 
   if ($self->{conf}->{rewrite_header}->{To}) {
     $to ||= '';
     my $tag = $self->_replace_tags($self->{conf}->{rewrite_header}->{To});
     $tag =~ s/\n/ /gs; # strip tag's newlines
-    $to =~ s/(?:\t\Q(${tag})\E|)$/\t(${tag})/
+    $to =~ s/(?:\t\Q(${tag})\E)?$/\t(${tag})/
   }
 
   if ($self->{conf}->{rewrite_header}->{From}) {
     $from ||= '';
     my $tag = $self->_replace_tags($self->{conf}->{rewrite_header}->{From});
     $tag =~ s/\n+//gs; # strip tag's newlines
-    $from =~ s/(?:\t\Q(${tag})\E|)$/\t(${tag})/
+    $from =~ s/(?:\t\Q(${tag})\E)?$/\t(${tag})/
   }
 
   # add report headers to message
@@ -848,7 +848,7 @@
   my $self = shift;
   my $text = shift;
 
-  $text =~ s/_(\w+?)(?:\((.*?)\)|)_/${\($self->_get_tag($1,$2 || ""))}/g;
+  $text =~ s/_(\w+?)(?:\((.*?)\))?_/${\($self->_get_tag($1,$2 || ""))}/g;
   return $text;
 }
 

Modified: incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm
==============================================================================
--- incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm	(original)
+++ incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Received.pm	Sat Feb 28 21:09:10 2004
@@ -663,7 +663,7 @@
     # (authenticated bits=0) by slate.dublin.wbtsystems.com (8.12.6/8.12.6)
     # with ESMTP id g9MFWcvb068860 for <jm...@jmason.org>;
     # Tue, 22 Oct 2002 16:32:39 +0100 (IST)
-    if (/^from (\S+) \((\S+) \[(${IP_ADDRESS})\]\)(?: \(authenticated bits=\d+\)|) by (\S+) \(/) { # sendmail
+    if (/^from (\S+) \((\S+) \[(${IP_ADDRESS})\]\)(?: \(authenticated bits=\d+\))? by (\S+) \(/) { # sendmail
       $mta_looked_up_dns = 1;
       $helo = $1; $rdns = $2; $ip = $3; $by = $4; goto enough;
     }
@@ -917,11 +917,11 @@
   # with SMTP id h2R2iivG093740; Wed, 26 Mar 2003 20:44:44 -0600 
   # (CST) (envelope-from x@x.org)
   # Received: from localhost (localhost [127.0.0.1]) (uid 500) by mail with local; Tue, 07 Jan 2003 11:40:47 -0600
-  if (/^from ${Mail::SpamAssassin::LOCALHOST} \((?:\S+\@|)${Mail::SpamAssassin::LOCALHOST}[\) ]/) { return; }
+  if (/^from ${Mail::SpamAssassin::LOCALHOST} \((?:\S+\@)?${Mail::SpamAssassin::LOCALHOST}[\) ]/) { return; }
 
   # Received: from olgisoft.com (127.0.0.1) by 127.0.0.1 (EzMTS MTSSmtp
   # 1.55d5) ; Thu, 20 Mar 03 10:06:43 +0100 for <as...@ietf.org>
-  if (/^from \S+ \((?:\S+\@|)${Mail::SpamAssassin::LOCALHOST}\) /) { return; }
+  if (/^from \S+ \((?:\S+\@)?${Mail::SpamAssassin::LOCALHOST}\) /) { return; }
 
   # Received: from casper.ghostscript.com (raph@casper [127.0.0.1]) h148aux8016336verify=FAIL); Tue, 4 Feb 2003 00:36:56 -0800
   # TODO: could use IPv6 localhost

Modified: incubator/spamassassin/trunk/masses/rule-dev/maildir-scan-headers
==============================================================================
--- incubator/spamassassin/trunk/masses/rule-dev/maildir-scan-headers	(original)
+++ incubator/spamassassin/trunk/masses/rule-dev/maildir-scan-headers	Sat Feb 28 21:09:10 2004
@@ -70,7 +70,7 @@
   $hdrs =~ s/(\n[ \t]+)/\\n /gs;	# folding
   $hdrs =~ s/\|/[pipe]/gs;		# pipe chars
 
-  my @ok = ($hdrs =~ /^(${wanted}:(?: .*|))$/gom);
+  my @ok = ($hdrs =~ /^(${wanted}:(?: .*)?)$/gom);
   if ($sort) { @ok = sort @ok; }
   $hdrs = join ("|", @ok);
 

Modified: incubator/spamassassin/trunk/rules/20_fake_helo_tests.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/20_fake_helo_tests.cf	(original)
+++ incubator/spamassassin/trunk/rules/20_fake_helo_tests.cf	Sat Feb 28 21:09:10 2004
@@ -30,7 +30,7 @@
 
 header FAKE_HELO_AOL		eval:check_for_rdns_helo_mismatch("aol\.com","aol\.com")
 describe FAKE_HELO_AOL		Host HELO did not match rDNS: aol.com
-header FAKE_HELO_HOTMAIL	eval:check_for_rdns_helo_mismatch("hotmail(?:\.msn|)\.com","hotmail\.com")
+header FAKE_HELO_HOTMAIL	eval:check_for_rdns_helo_mismatch("hotmail(?:\.msn)?\.com","hotmail\.com")
 describe FAKE_HELO_HOTMAIL	Host HELO did not match rDNS: hotmail.com
 header FAKE_HELO_USA_NET	eval:check_for_rdns_helo_mismatch("usa\.net","usa\.net")
 describe FAKE_HELO_USA_NET	Host HELO did not match rDNS: usa.net

Modified: incubator/spamassassin/trunk/rules/20_head_tests.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/20_head_tests.cf	(original)
+++ incubator/spamassassin/trunk/rules/20_head_tests.cf	Sat Feb 28 21:09:10 2004
@@ -677,7 +677,7 @@
 tflags ACCESSDB			userconf
 
 # via private mail with Mark Delany; thx Mark!
-header FORGED_YAHOO_RCVD_SMTP    Received =~ /from smtp(?:\d{1,2}|\d{4,})\.mail(?:\.[^\.]+|)\.yahoo\.com /
+header FORGED_YAHOO_RCVD_SMTP    Received =~ /from smtp(?:\d{1,2}|\d{4,})\.mail(?:\.[^\.]+)?\.yahoo\.com /
 describe FORGED_YAHOO_RCVD_SMTP  Header contains forged Yahoo! SMTP server hostname
 
 # a new spamware tool; catch it

Modified: incubator/spamassassin/trunk/rules/20_phrases.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/20_phrases.cf	(original)
+++ incubator/spamassassin/trunk/rules/20_phrases.cf	Sat Feb 28 21:09:10 2004
@@ -43,7 +43,7 @@
 describe REMOVE_REMOVAL_1WORD	List removal information
 
 # bug 1022: MGM_POSTCARD #2 original
-body REMOVE_POSTAL		/(?:Send(?:ing|) a (?:postal mail|postcard) to (?:Unsubscribe|Customer ?Service|remove)|unsubscribe by (?:postal mail|postcard))/i
+body REMOVE_POSTAL		/(?:Send(?:ing)? a (?:postal mail|postcard) to (?:Unsubscribe|Customer ?Service|remove)|unsubscribe by (?:postal mail|postcard))/i
 describe REMOVE_POSTAL		Send real mail to be unsubscribed
 
 ###########################################################################

Modified: incubator/spamassassin/trunk/rules/20_ratware.cf
==============================================================================
--- incubator/spamassassin/trunk/rules/20_ratware.cf	(original)
+++ incubator/spamassassin/trunk/rules/20_ratware.cf	Sat Feb 28 21:09:10 2004
@@ -144,7 +144,7 @@
 # updated to fix bugs 2047, 2598, 2654
 # NOTE: this is the *only* spammish Eudora MUA pattern that wasn't
 # ignored using __OLD_EUDORA1 and __OLD_EUDORA2 under previous rules.
-header __EUDORA_MUA             X-Mailer =~ /^QUALCOMM Windows Eudora (?:Pro |Light |)Version [3456]\./
+header __EUDORA_MUA             X-Mailer =~ /^QUALCOMM Windows Eudora (?:Pro |Light )?Version [3456]\./
 header __EUDORA_MSGID		MESSAGEID =~ /^<(?:\d\d?\.){3,5}\d{14}\.[a-f0-9]{8}\@\S+(?:\sport\s\d+)?>$/m
 header __HAS_X_LOOP		exists:X-Loop
 header __HAS_X_MAILING_LIST	exists:X-Mailing-List

Modified: incubator/spamassassin/trunk/tools/bayes_dump_to_trusted_networks
==============================================================================
--- incubator/spamassassin/trunk/tools/bayes_dump_to_trusted_networks	(original)
+++ incubator/spamassassin/trunk/tools/bayes_dump_to_trusted_networks	Sat Feb 28 21:09:10 2004
@@ -61,7 +61,7 @@
 # an IP address, in IPv4, IPv4-mapped-in-IPv6, or IPv6 format.  NOTE: cannot
 # just refer to $IPV4_ADDRESS, due to perl bug reported in nesting qr//s. :(
 #
-$IP_ADDRESS = qr/\b (?:IPv6:|) (?: (?:0*:0*:ffff:(?:0*:|)|) # IPv4-mapped-in-IPv6
+$IP_ADDRESS = qr/\b (?:IPv6:)? (?: (?:0*:0*:ffff:(?:0*:)?)? # IPv4-mapped-in-IPv6
                     (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
                     (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.
                     (?:1\d\d|2[0-4]\d|25[0-5]|\d\d|\d)\.