You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by fe...@apache.org on 2006/12/05 19:43:59 UTC

svn commit: r482734 - in /spamassassin: rules/trunk/sandbox/felicity/70_other.cf trunk/lib/Mail/SpamAssassin/Plugin/RelayEval.pm

Author: felicity
Date: Tue Dec  5 10:43:58 2006
New Revision: 482734

URL: http://svn.apache.org/viewvc?view=rev&rev=482734
Log:
bug 4459: allow 127.0.0.\d+, and look for other illegals

Modified:
    spamassassin/rules/trunk/sandbox/felicity/70_other.cf
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayEval.pm

Modified: spamassassin/rules/trunk/sandbox/felicity/70_other.cf
URL: http://svn.apache.org/viewvc/spamassassin/rules/trunk/sandbox/felicity/70_other.cf?view=diff&rev=482734&r1=482733&r2=482734
==============================================================================
--- spamassassin/rules/trunk/sandbox/felicity/70_other.cf (original)
+++ spamassassin/rules/trunk/sandbox/felicity/70_other.cf Tue Dec  5 10:43:58 2006
@@ -315,3 +315,9 @@
 # messages, so maybe just adding a point for that is the right way to go.
 header EXTRA_MPART_TYPE2         Content-Type =~ /\btype=/i
 header EXTRA_MPART_TYPE3         Content-Type =~ /^multipart\/related\b/i
+
+
+# bug 4459: allow 127.0.0.\d+, and look for other illegals
+ifplugin Mail::SpamAssassin::Plugin::RelayEval
+header RCVD_ILLEGAL_IP2         eval:check_for_illegal_ip2()
+endif

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayEval.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayEval.pm?view=diff&rev=482734&r1=482733&r2=482734
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayEval.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/RelayEval.pm Tue Dec  5 10:43:58 2006
@@ -94,6 +94,19 @@
   return 0;
 }
 
+sub check_for_illegal_ip2 {
+  my ($self, $pms) = @_;
+
+  foreach my $rcvd ( @{$pms->{relays_untrusted}} ) {
+    # (note this might miss some hits if the Received.pm skips any invalid IPs)
+    foreach my $check ( $rcvd->{ip}, $rcvd->{by} ) {
+      return 1 if ($check =~ /^
+    	(?:[01257]|(?!127.0.0.)127|22[3-9]|2[3-9]\d|[12]\d{3,}|[3-9]\d\d+)\.\d+\.\d+\.\d+
+	$/x);
+    }
+  }
+  return 0;
+}
 sub check_for_illegal_ip {
   my ($self, $pms) = @_;