You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by km...@apache.org on 2013/10/11 05:24:27 UTC
svn commit: r1531183 - in /spamassassin/trunk/lib/Mail/SpamAssassin:
PerMsgStatus.pm Plugin/DNSEval.pm
Author: kmcgrail
Date: Fri Oct 11 03:24:27 2013
New Revision: 1531183
URL: http://svn.apache.org/r1531183
Log:
added check_rbl_from_domain function to allow checking all the from headers but querying just the domain instead of the full address used previously. So bob@test.microsoft.com will query for bob@microsoft.com.
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DNSEval.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1531183&r1=1531182&r2=1531183&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri Oct 11 03:24:27 2013
@@ -2906,6 +2906,42 @@ sub all_from_addrs {
return @addrs;
}
+=item all_from_addrs_domains
+
+This function returns all the various from addresses in a message using all_from_addrs()
+and then returns only the domain names.
+
+=cut
+
+sub all_from_addrs_domains {
+ my ($self) = @_;
+
+ if (exists $self->{all_from_addrs_domains}) {
+ return @{$self->{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);
+
+ 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@'.&Mail::SpamAssassin::Util::uri_to_domain($addrs[$i]);
+ }
+
+ #Remove duplicate domains
+ my %addrs = map { $_ => 1 } @addrs;
+ @addrs = keys %addrs;
+
+ dbg("eval: all '*From' addrs domains (after uri to domain): " . join(" ", @addrs));
+
+ $self->{all_from_addrs_domains} = \@addrs;
+
+ return @addrs;
+}
+
sub all_to_addrs {
my ($self) = @_;
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DNSEval.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DNSEval.pm?rev=1531183&r1=1531182&r2=1531183&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DNSEval.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DNSEval.pm Fri Oct 11 03:24:27 2013
@@ -15,6 +15,13 @@
# limitations under the License.
# </...@LICENSE>
+=head1 NAME
+
+DNSEVAL - look up URLs against DNS blocklists
+
+=cut
+
+
package Mail::SpamAssassin::Plugin::DNSEval;
use Mail::SpamAssassin::Plugin;
@@ -49,6 +56,7 @@ sub new {
'check_rbl_sub',
'check_rbl_results_for',
'check_rbl_from_host',
+ 'check_rbl_from_domain',
'check_rbl_envfrom',
'check_dns_sender',
];
@@ -310,6 +318,15 @@ sub check_rbl_from_host {
_check_rbl_addresses(@_, $_[1]->all_from_addrs());
}
+=item check_rbl_from_domain
+
+This checks all the from addrs domain names as an alternate to check_rbl_from_host
+
+=cut
+sub check_rbl_from_domain {
+ _check_rbl_addresses(@_, $_[1]->all_from_addrs_domains());
+}
+
# this only checks the address host name and not the domain name because
# using the domain name had much worse results for dsn.rfc-ignorant.org
sub check_rbl_envfrom {
@@ -344,6 +361,7 @@ sub _check_rbl_addresses {
dbg("dns: _check_rbl_addresses RBL $rbl_server, set $set");
for my $host (keys %hosts) {
+ #dbg("dns: checking [$host] / $rule / $set / $rbl_server");
$pms->do_rbl_lookup($rule, $set, 'A', "$host.$rbl_server");
}
}