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/10/03 23:26:02 UTC

svn commit: rev 51849 - in spamassassin/branches/3.0: lib/Mail/SpamAssassin/Message/Metadata t

Author: jm
Date: Sun Oct  3 14:26:02 2004
New Revision: 51849

Modified:
   spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
   spamassassin/branches/3.0/t/rcvd_parser.t
Log:
bug 3837: over-broad RE in Received parser gets some rDNS and HELO strings mixed up

Modified: spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
==============================================================================
--- spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message/Metadata/Received.pm	(original)
+++ spamassassin/branches/3.0/lib/Mail/SpamAssassin/Message/Metadata/Received.pm	Sun Oct  3 14:26:02 2004
@@ -449,7 +449,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;
@@ -464,10 +466,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/branches/3.0/t/rcvd_parser.t
==============================================================================
--- spamassassin/branches/3.0/t/rcvd_parser.t	(original)
+++ spamassassin/branches/3.0/t/rcvd_parser.t	Sun Oct  3 14:26:02 2004
@@ -78,7 +78,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{
@@ -180,7 +180,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{