You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2015/05/16 00:30:39 UTC

svn commit: r1679653 - /spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm

Author: mmartinec
Date: Fri May 15 22:30:39 2015
New Revision: 1679653

URL: http://svn.apache.org/r1679653
Log:
Bug 7196: PerMsgStatus Warning

Modified:
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1679653&r1=1679652&r2=1679653&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri May 15 22:30:39 2015
@@ -3073,24 +3073,25 @@ sub all_from_addrs_domains {
 
   #TEST POINT - my @addrs = ("test.voipquotes2.net","test.voipquotes2.co.uk");
   #Start with all the normal from addrs
-  my @addrs = &all_from_addrs($self);
+  my @addrs = all_from_addrs($self);
 
   dbg("eval: all '*From' addrs domains (before): " . join(" ", @addrs));
 
-  #loop through and limit to just the domain with a dummy address
-  for (my $i = 0; $i < scalar(@addrs); $i++) {
-    $addrs[$i] = 'dummy@'.$self->{main}->{registryboundaries}->uri_to_domain($addrs[$i]);
+  #Take just the domain with a dummy localpart
+  #removing invalid and duplicate domains
+  my(%addrs_seen, @addrs_filtered);
+  foreach my $a (@addrs) {
+    my $domain = $self->{main}->{registryboundaries}->uri_to_domain($a);
+    next if !defined $domain || $addrs_seen{lc $domain}++;
+    push(@addrs_filtered, 'dummy@'.$domain);
   }
 
-  #Remove duplicate domains
-  my %addrs = map { $_ => 1 } @addrs;
-  @addrs = keys %addrs;
+  dbg("eval: all '*From' addrs domains (after uri to domain): " .
+      join(" ", @addrs_filtered));
 
-  dbg("eval: all '*From' addrs domains (after uri to domain): " . join(" ", @addrs));
+  $self->{all_from_addrs_domains} = \@addrs_filtered;
 
-  $self->{all_from_addrs_domains} = \@addrs;
-
-  return @addrs;
+  return @addrs_filtered;
 }
 
 sub all_to_addrs {