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 2004/09/28 05:38:44 UTC

svn commit: rev 47380 - spamassassin/trunk/lib/Mail/SpamAssassin/Plugin

Author: felicity
Date: Mon Sep 27 20:38:44 2004
New Revision: 47380

Modified:
   spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
Log:
bug 3805: added uridnsbl_skip_domain to allow specification of domains which should not be checked via the URIDNSBL plugin

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm	(original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm	Mon Sep 27 20:38:44 2004
@@ -76,6 +76,12 @@
 
 The maximum number of domains to look up.
 
+=item uridnsbl_skip_domain domain1 domain2 ...
+
+Specify a domain, or a number of domains, which should be skipped for the
+URIBL checks.  This is very useful to specify very common domains which are
+not going to be listed in URIBLs.
+
 =back
 
 =cut
@@ -126,6 +132,7 @@
   # set default config settings
   $samain->{conf}->{uridnsbl_timeout} =		3;
   $samain->{conf}->{uridnsbl_max_domains} =	20;
+  $samain->{conf}->{uridnsbl_skip_domains} =	{};
   return $self;
 }
 
@@ -178,7 +185,14 @@
   my %domlist = ( );
   foreach my $uri ($scanner->get_uri_list()) {
     my $dom = Mail::SpamAssassin::Util::uri_to_domain($uri);
-    if ($dom) { $domlist{$dom} = 1; }
+    if ($dom) {
+      if (exists $scanner->{main}->{conf}->{uridnsbl_skip_domains}->{$dom}) {
+        dbg("URIDNSBL: found domain $dom in skip list");
+      }
+      else {
+        $domlist{$dom} = 1;
+      }
+    }
   }
 
   # trim down to a limited number - pick randomly
@@ -255,6 +269,12 @@
     $opts->{conf}->{uridnsbl_timeout} = $opts->{value};
     $self->inhibit_further_callbacks(); return 1;
   }
+  elsif ($key eq 'uridnsbl_skip_domain') {
+    foreach my $domain (split(/\s+/, $opts->{value})) {
+      $opts->{conf}->{uridnsbl_skip_domains}->{$domain} = 1;
+    }
+    $self->inhibit_further_callbacks(); return 1;
+  }
   return 0;
 }
 
@@ -335,8 +355,7 @@
   if ($dom =~ /^\d+\.\d+\.\d+\.\d+$/) { 
     $self->lookup_dnsbl_for_ip ($scanstate, $obj, $dom);
   }
-  else
-  {
+  else {
     # look up the domain in the RHSBL subset
     my $cf = $scanstate->{active_rules_rhsbl};
     foreach my $rulename (keys %{$cf}) {