patch-src::ParseReceived-3.0.3.patch by Victor Ustugov diff -urN lib.orig/Mail/SpamAssassin/Message/Metadata/Received.pm lib/Mail/SpamAssassin/Message/Metadata/Received.pm --- lib.orig/Mail/SpamAssassin/Message/Metadata/Received.pm 2005-04-27 21:45:04.000000000 +0300 +++ lib/Mail/SpamAssassin/Message/Metadata/Received.pm 2005-05-24 17:27:05.000000000 +0300 @@ -461,14 +461,14 @@ if (/^from \[(${IP_ADDRESS})\] \((.*?)\) by (\S+) /) { $ip = $1; my $sub = $2; $by = $3; $sub =~ s/helo=(\S+)// and $helo = $1; - $sub =~ s/ident=(\S+)// and $ident = $1; + $sub =~ s/ident=(\S*)// and $ident = $1; goto enough; } # Received: from sc8-sf-list1-b.sourceforge.net ([10.3.1.13] helo=sc8-sf-list1.sourceforge.net) by sc8-sf-list2.sourceforge.net with esmtp (Exim 3.31-VA-mm2 #1 (Debian)) id 18t301-0007Bh-00; Wed, 12 Mar 2003 01:58:13 -0800 # Received: from dsl092-072-213.bos1.dsl.speakeasy.net ([66.92.72.213] helo=blazing.arsecandle.org) by sc8-sf-list1.sourceforge.net with esmtp (Cipher TLSv1:DES-CBC3-SHA:168) (Exim 3.31-VA-mm2 #1 (Debian)) id 18lyuU-0007TI-00 for ; Thu, 20 Feb 2003 14:11:18 -0800 # Received: from eclectic.kluge.net ([66.92.69.221] ident=[W9VcNxE2vKxgWHD05PJbLzIHSxcmZQ/O]) by sc8-sf-list1.sourceforge.net with esmtp (Cipher TLSv1:DES-CBC3-SHA:168) (Exim 3.31-VA-mm2 #1 (Debian)) id 18m0hT-00031I-00 for ; Thu, 20 Feb 2003 16:06:00 -0800 - if (/^from (\S+) \(\[(${IP_ADDRESS})\](:\d+)? helo=(\S+) ident=(\S+)\) by (\S+) /) { + if (/^from (\S+) \(\[(${IP_ADDRESS})\](:\d+)? helo=(\S+) ident=(\S*)\) by (\S+) /) { $rdns=$1; $ip = $2; $helo = $4; $ident = $5; $by = $6; goto enough; } # (and without ident) @@ -594,14 +594,14 @@ if (/^from (\S+) \((\S+) \[(${IP_ADDRESS})\].*\) by (\S+) \(/) { $mta_looked_up_dns = 1; $helo = $1; $rdns = $2; $ip = $3; $by = $4; - $rdns =~ s/^IDENT:([^\@]+)\@// and $ident = $1; # remove IDENT lookups - $rdns =~ s/^([^\@]+)\@// and $ident = $1; # remove IDENT lookups + $rdns =~ s/^IDENT:([^\@]*)\@// and $ident = $1; # remove IDENT lookups + $rdns =~ s/^([^\@]*)\@// and $ident = $1; # remove IDENT lookups goto enough; } } # Received: from 4wtgRl (kgbxn@[211.244.147.115]) by dogma.slashnull.org (8.11.6/8.11.6) with SMTP id h8BBsUJ18848; Thu, 11 Sep 2003 12:54:31 +0100 - if (/^from (\S+) \((\S+)\@\[(${IP_ADDRESS})\].*\) by (\S+) \(/) { + if (/^from (\S+) \((\S*)\@\[(${IP_ADDRESS})\].*\) by (\S+) \(/) { $mta_looked_up_dns = 1; # this one does. there just wasn't one $helo = $1; $ip = $3; $by = $4; $ident = $2; @@ -662,13 +662,13 @@ # Received: from 211.245.85.228 (EHLO ) (211.245.85.228) by mta232.mail.scd.yahoo.com with SMTP; Sun, 25 Jan 2004 00:24:37 -0800 if (/^from \S+( \((?:HELO|EHLO) \S*\))? \((\S+\@)?\[?${IP_ADDRESS}\]?\)( \(envelope-sender <\S+>\))? by \S+( \(.+\))* with (.* )?(SMTP|QMQP)/) { - if (/^from (\S+) \((?:HELO|EHLO) ([^ \(\)]*)\) \((\S+)\@\[?(${IP_ADDRESS})\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { + if (/^from (\S+) \((?:HELO|EHLO) ([^ \(\)]*)\) \((\S*)\@\[?(${IP_ADDRESS})\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { $rdns = $1; $helo = $2; $ident = $3; $ip = $4; $by = $6; } elsif (/^from (\S+) \((?:HELO|EHLO) ([^ \(\)]*)\) \(\[?(${IP_ADDRESS})\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { $rdns = $1; $helo = $2; $ip = $3; $by = $5; } - elsif (/^from (\S+) \((\S+)\@\[?(${IP_ADDRESS})\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { + elsif (/^from (\S+) \((\S*)\@\[?(${IP_ADDRESS})\]?\)( \(envelope-sender <\S+>\))? by (\S+)/) { # note: absence of HELO means that it matched rDNS in qmail-land $helo = $rdns = $1; $ident = $2; $ip = $3; $by = $5; } @@ -768,7 +768,7 @@ # http://bugzilla.spamassassin.org/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) (Owner50@207.213.27.129) by totor.bouissou.net with SMTP; 10 Nov 2003 06:30:34 -0000 - if (/^from (\S+) \((?:HELO|EHLO) ([^\)]*)\) \((\S+@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /) + if (/^from (\S+) \((?:HELO|EHLO) ([^\)]*)\) \((\S*@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /) { $mta_looked_up_dns = 1; $rdns = $1; $helo = $2; $ident = (defined $3) ? $3 : ''; @@ -778,7 +778,7 @@ } # Received: from x1-6-00-04-bd-d2-e0-a3.k317.webspeed.dk (benelli@80.167.158.170) by totor.bouissou.net with SMTP; 5 Nov 2003 23:18:42 -0000 - if (/^from (\S+) \((\S+@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /) + if (/^from (\S+) \((\S*@)?\[?(${IP_ADDRESS})\]?\).* by (\S+) /) { $mta_looked_up_dns = 1; # http://bugzilla.spamassassin.org/show_bug.cgi?id=2744 notes that