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

[email protected]
Newsgroups gmane.mail.spam.spamassassin.cvs
Message-ID <175887253761.4013253.6654238169832216389@svn02-us-east.apache.org>
Author: gbechis
Date: Fri Sep 26 07:42:17 2025
New Revision: 1928772

Log:
improve rcvd parser for some Qmail headers

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
   spamassassin/trunk/t/rcvd_parser.t

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm	Fri Sep 26 04:20:03 2025	(r1928771)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message/Metadata/Received.pm	Fri Sep 26 07:42:17 2025	(r1928772)
@@ -858,6 +858,24 @@ sub parse_received_line {
       goto enough;
     }
 
+    # Let's try to support a few qmailish formats in one;
+    # http://bz.apache.org/SpamAssassin/show_bug.cgi?id=2744#c14 :
+    # Received: from unknown (HELO feux01a-isp) (213.199.4.210) by totor.bouissou.net with SMTP; 1 Nov 2003 07:05:19 -0000 
+    # Received: from adsl-207-213-27-129.dsl.lsan03.pacbell.net (HELO merlin.net.au) ([email protected]) by totor.bouissou.net with SMTP; 10 Nov 2003 06:30:34 -0000 
+    if (/^(\S+) \((?:HELO|EHLO) ([^\)]*)\) \((\S*@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /)
+    {
+      $mta_looked_up_dns = 1;
+      $rdns = $1; 
+      $helo = $2; 
+      $ident = (defined $3) ? $3 : '';
+      $ip = $4; 
+      $by = $5;
+      if ($ident) { 
+        $ident =~ s/\@$//; 
+      }
+      goto enough;
+    }
+
     # Received: from mail.sxptt.zj.cn ([218.0.185.24]) by dogma.slashnull.org
     # (8.11.6/8.11.6) with ESMTP id h2FH0Zx11330 for <[email protected]>;
     # Sat, 15 Mar 2003 17:00:41 GMT
@@ -911,24 +929,6 @@ sub parse_received_line {
       return 0;		# skip mail fetcher handovers
     }
 
-    # Let's try to support a few qmailish formats in one;
-    # http://bz.apache.org/SpamAssassin/show_bug.cgi?id=2744#c14 :
-    # Received: from unknown (HELO feux01a-isp) (213.199.4.210) by totor.bouissou.net with SMTP; 1 Nov 2003 07:05:19 -0000 
-    # Received: from adsl-207-213-27-129.dsl.lsan03.pacbell.net (HELO merlin.net.au) ([email protected]) by totor.bouissou.net with SMTP; 10 Nov 2003 06:30:34 -0000 
-    if (/^(\S+) \((?:HELO|EHLO) ([^\)]*)\) \((\S*@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /)
-    {
-      $mta_looked_up_dns = 1;
-      $rdns = $1; 
-      $helo = $2; 
-      $ident = (defined $3) ? $3 : '';
-      $ip = $4; 
-      $by = $5;
-      if ($ident) { 
-        $ident =~ s/\@$//; 
-      }
-      goto enough;
-    }
-
     # Received: from x1-6-00-04-bd-d2-e0-a3.k317.webspeed.dk ([email protected]) by totor.bouissou.net with SMTP; 5 Nov 2003 23:18:42 -0000
     if (/^(\S+) \((\S*@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /)
     {

Modified: spamassassin/trunk/t/rcvd_parser.t
==============================================================================
--- spamassassin/trunk/t/rcvd_parser.t	Fri Sep 26 04:20:03 2025	(r1928771)
+++ spamassassin/trunk/t/rcvd_parser.t	Fri Sep 26 07:42:17 2025	(r1928772)
@@ -2,7 +2,7 @@
 
 use lib '.'; use lib 't';
 use SATest; sa_t_init("rcvd_parser");
-use Test::More tests => 148;
+use Test::More tests => 149;
 use strict;
 
 # format is:
@@ -453,6 +453,8 @@ my %data = (
 
   'from unknown (HELO [216.10.132.55]) ([email protected]@216.10.132.55) by mail.example.com with  (SSL TLSv1.3 TLS_AES_128_GCM_SHA256 encrypted) SMTPSESMTPSA (a296348e-8bfe-11f0-9b0a-6b3a2ad3fd80); Sun, 07 Sep 2025 10:23:41 -0500' => '[ ip=216.10.132.55 rdns= helo=!216.10.132.55! by=mail.example.com [email protected] envfrom= id= auth=ESMTPSA msa=0 ]',
 
+  'from mta.example.com (HELO [192.168.1.35]) ([email protected]@1.2.3.4) by mta.example.com with  (TLS_AES_128_GCM_SHA256 encrypted) ESMTPSA (4090c222-9a4a-11f0-88a6-c3acd4c5d78d) ; Sun, 07 Sep 2025 10:23:41 -0500' => '[ ip=1.2.3.4 rdns=mta.example.com helo=!192.168.1.35! by=mta.example.com [email protected] envfrom= id= auth=ESMTPSA msa=0 ]',
+
   #ADDED PER Bug 6783
   'from 67.85.219.192 (NaSMail authenticated user john.doe) by webmail.example.com with HTTP; Fri, 30 Mar 2012 12:39:58 +0100 (BST)' => 
   '[ ip=67.85.219.192 rdns= helo= by=webmail.example.com ident= envfrom= id= auth=HTTP msa=0 ]',
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.