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 2008/04/10 15:59:16 UTC
svn commit: r646805 - in /spamassassin/trunk:
lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm rules/25_uribl.cf
Author: jm
Date: Thu Apr 10 06:59:09 2008
New Revision: 646805
URL: http://svn.apache.org/viewvc?rev=646805&view=rev
Log:
bug 5820: add 'uridnssub' keyword for URIDNSBL plugin; fix URIBL_SBL to use this keyword, and thereby produce a marginal gain in efficiency for lookups on zen.spamhaus.org
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
spamassassin/trunk/rules/25_uribl.cf
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm?rev=646805&r1=646804&r2=646805&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm Thu Apr 10 06:59:09 2008
@@ -60,6 +60,25 @@
body URIBL_SBLXBL eval:check_uridnsbl('URIBL_SBLXBL')
describe URIBL_SBLXBL Contains a URL listed in the SBL/XBL blocklist
+=item uridnssub NAME_OF_RULE dnsbl_zone lookuptype subtest
+
+Specify a DNSBL-style domain lookup with a sub-test. C<NAME_OF_RULE> is the
+name of the rule to be used, C<dnsbl_zone> is the zone to look up IPs in,
+and C<lookuptype> is the type of lookup (B<TXT> or B<A>).
+
+C<subtest> is the sub-test to run against the returned data. The sub-test may
+either be an IPv4 dotted address for DNSBLs that return multiple A records or a
+non-negative decimal number to specify a bitmask for DNSBLs that return a
+single A record containing a bitmask of results.
+
+Note that, as with C<uridnsbl>, you must also define a body-eval rule calling
+C<check_uridnsbl()> to use this.
+
+Example:
+
+ uridnssub URIBL_DNSBL_4 dnsbl.example.org. A 127.0.0.4
+ uridnssub URIBL_DNSBL_8 dnsbl.example.org. A 8
+
=item urirhsbl NAME_OF_RULE rhsbl_zone lookuptype
Specify a RHSBL-style domain lookup. C<NAME_OF_RULE> is the name of the rule
@@ -315,6 +334,32 @@
zone => $zone, type => $type,
is_rhsbl => 0
};
+ }
+ elsif ($value =~ /^$/) {
+ return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
+ }
+ else {
+ return $Mail::SpamAssassin::Conf::INVALID_VALUE;
+ }
+ }
+ });
+
+ push (@cmds, {
+ setting => 'uridnssub',
+ is_priv => 1,
+ code => sub {
+ my ($self, $key, $value, $line) = @_;
+ if ($value =~ /^(\S+)\s+(\S+)\s+(\S+)\s+(\d{1,10}|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/) {
+ my $rulename = $1;
+ my $zone = $2;
+ my $type = $3;
+ my $subrule = $4;
+ $self->{uridnsbls}->{$rulename} = {
+ zone => $zone, type => $type,
+ is_rhsbl => 0, is_subrule => 1
+ };
+ $self->{uridnsbl_subs}->{$zone} ||= { };
+ push (@{$self->{uridnsbl_subs}->{$zone}->{$subrule}->{rulenames}}, $rulename);
}
elsif ($value =~ /^$/) {
return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
Modified: spamassassin/trunk/rules/25_uribl.cf
URL: http://svn.apache.org/viewvc/spamassassin/trunk/rules/25_uribl.cf?rev=646805&r1=646804&r2=646805&view=diff
==============================================================================
--- spamassassin/trunk/rules/25_uribl.cf (original)
+++ spamassassin/trunk/rules/25_uribl.cf Thu Apr 10 06:59:09 2008
@@ -33,7 +33,7 @@
###########################################################################
## SBL
-uridnsbl URIBL_SBL sbl.spamhaus.org. TXT
+uridnssub URIBL_SBL zen.spamhaus.org. A 127.0.0.2
body URIBL_SBL eval:check_uridnsbl('URIBL_SBL')
describe URIBL_SBL Contains an URL listed in the SBL blocklist
tflags URIBL_SBL net