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 2005/06/28 03:26:40 UTC

svn commit: r202109 - /spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm

Author: jm
Date: Mon Jun 27 18:26:39 2005
New Revision: 202109

URL: http://svn.apache.org/viewcvs?rev=202109&view=rev
Log:
bug 4436: trusted_networks were being ignored for X-Originating-IP header, fix from Martin Blapp <mbr /at/ freebsd.org>

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm?rev=202109&r1=202108&r2=202109&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/EvalTests.pm Mon Jun 27 18:26:39 2005
@@ -1235,6 +1235,8 @@
 	" untrusted: ".join(", ", @ips).
 	" originating: ".join(", ", @originating));
 
+  my $trusted = $self->{conf}->{trusted_networks};
+
   if (scalar @ips + scalar @originating > 0) {
     # If name is foo-notfirsthop, check all addresses except for
     # the originating one.  Suitable for use with dialup lists, like the PDL.
@@ -1256,18 +1258,27 @@
     # And if name is foo-untrusted, check any untrusted IP address.
     elsif ($set =~ /-(first|un)trusted$/)
     {
-      push(@ips, @originating);
-      if ($1 eq "first") {
-	@ips = ($ips[0]);
+      my @tips = ();
+      foreach my $ip (@originating) {
+        if ($ip && !$trusted->contains_ip($ip)) {
+          push(@tips, $ip);
+        }
       }
-      else {
-	shift @ips;
+      @ips = reverse $self->ip_list_uniq_and_strip_private (@ips, @tips);
+      if ($1 eq "first") {
+        @ips = (defined $ips[0]) ? ($ips[0]) : ();
       }
     }
     else
     {
-      # add originating IPs as untrusted IPs
-      @ips = reverse $self->ip_list_uniq_and_strip_private(@ips, @originating);
+      my @tips = ();
+      foreach my $ip (@originating) {
+        if ($ip && !$trusted->contains_ip($ip)) {
+          push(@tips, $ip);
+        }
+      }
+      # add originating IPs as untrusted IPs (if they are untrusted)
+      @ips = reverse $self->ip_list_uniq_and_strip_private (@ips, @tips);
 
       # How many IPs max you check in the received lines
       my $checklast=$self->{conf}->{num_check_received};