You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2004/09/28 18:46:54 UTC

svn commit: rev 47408 - in spamassassin/trunk: lib/Mail/SpamAssassin/Message/Metadata t

Author: jm
Date: Tue Sep 28 09:46:52 2004
New Revision: 47408

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
   spamassassin/trunk/t/rcvd_parser.t
Log:
bug 3837: Received parser: over-broad RE getting rDNS and HELO mixed up, fixed.  also fixed an inefficient RE, and the test cases.

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm	Tue Sep 28 09:46:52 2004
@@ -475,7 +475,9 @@
     # Received: from 217.137.58.28 ([217.137.58.28])
     # by webmail.ukonline.net (IMP) with HTTP
     # for <an...@localhost>; Sun, 11 Apr 2004 00:31:07 +0100
-    if (/^from (${IP_ADDRESS}) \(\[${IP_ADDRESS}\]\) by (\S+).*\bwith HTTP/) {
+    if (/\bwith HTTP\b/ &&        # more efficient split up this way
+        /^from (${IP_ADDRESS}) \(\[${IP_ADDRESS}\]\) by (\S+)/)
+    {
       # some smarty-pants decided to fake a numeric HELO for HTTP
       # no rDNS for this format?
       $ip = $1; $by = $2; goto enough;
@@ -490,10 +492,8 @@
     }
 
     # from mail2.detr.gsi.gov.uk ([51.64.35.18] helo=ahvfw.dtlr.gsi.gov.uk) by mail4.gsi.gov.uk with smtp id 190K1R-0000me-00 for spamassassin-talk-admin@lists.sourceforge.net; Tue, 01 Apr 2003 12:33:46 +0100
-    if (/^from (\S+) \(\[(${IP_ADDRESS})\](.*)\) by (\S+) with /) {
-      $rdns = $1; $ip = $2; $by = $4;
-      my $sub = ' '.$3.' ';
-      if ($sub =~ / helo=(\S+) /) { $helo = $1; }
+    if (/^from (\S+) \(\[(${IP_ADDRESS})\] helo=(\S+)\) by (\S+) with /) {
+      $rdns = $1; $ip = $2; $helo = $3; $by = $4;
       goto enough;
     }
 

Modified: spamassassin/trunk/t/rcvd_parser.t
==============================================================================
--- spamassassin/trunk/t/rcvd_parser.t	(original)
+++ spamassassin/trunk/t/rcvd_parser.t	Tue Sep 28 09:46:52 2004
@@ -120,7 +120,7 @@
 
 } => q{
 
-  [ ip=218.11.152.141 rdns=cs.helsinki.fi helo= by=mail.cs.helsinki.fi ident= envfrom= id= ] [ ip=64.235.238.165 rdns= helo=m165.4superdeals.biz by=mail.cs.helsinki.fi ident= envfrom= id= ]
+  [ ip=218.11.152.141 rdns= helo=cs.helsinki.fi by=mail.cs.helsinki.fi ident= envfrom= id= ] [ ip=64.235.238.165 rdns= helo=m165.4superdeals.biz by=mail.cs.helsinki.fi ident= envfrom= id= ]
 
 },
 q{
@@ -222,7 +222,7 @@
 
 } => q{
 
-[ ip=66.199.2.3 rdns=bigass1.example.com helo= by=slim1.example.com ident= envfrom= id= ] [ ip=24.83.2.4 rdns=a1200 helo= by=bigass1.example.com ident= envfrom= id= ] [ ip=66.199.2.5 rdns=ns1.example.com helo=bigass1.example.com by=fiat.example.edu ident= envfrom= id=i06MBJ6U020255 ] [ ip=24.83.2.6 rdns=a1200 helo= by=bigass1.example.com ident= envfrom= id= ] [ ip=24.83.2.7 rdns=a1200 helo= by=bigass1.example.com ident= envfrom= id= ]
+[ ip=66.199.2.3 rdns= helo=bigass1.example.com by=slim1.example.com ident= envfrom= id= ] [ ip=24.83.2.4 rdns= helo=a1200 by=bigass1.example.com ident= envfrom= id= ] [ ip=66.199.2.5 rdns=ns1.example.com helo=bigass1.example.com by=fiat.example.edu ident= envfrom= id=i06MBJ6U020255 ] [ ip=24.83.2.6 rdns= helo=a1200 by=bigass1.example.com ident= envfrom= id= ] [ ip=24.83.2.7 rdns= helo=a1200 by=bigass1.example.com ident= envfrom= id= ]
 
 },
 q{