You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by mm...@apache.org on 2010/03/19 18:48:27 UTC
svn commit: r925353 -
/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm
Author: mmartinec
Date: Fri Mar 19 17:48:27 2010
New Revision: 925353
URL: http://svn.apache.org/viewvc?rev=925353&view=rev
Log:
Bug 6382: add in missing unwhitelist_from_dkim
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm?rev=925353&r1=925352&r2=925353&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin/DKIM.pm Fri Mar 19 17:48:27 2010
@@ -213,6 +213,19 @@ Same as C<whitelist_from_dkim>, but used
in the SpamAssassin distribution. The whitelist score is lower, because
these are often targets for abuse of public mailers which sign their mail.
+=item unwhitelist_from_dkim author@example.com
+
+Removes an email address from def_whitelist_from_dkim and whitelist_from_dkim
+tables, if it exists. Useful for removing undesired default entries from
+a distributed configuration file by a local.cf file or by a C<user_prefs>.
+Note that a parameter is a single email address - currently that address
+is removed regardless of a signing-domain which may have been specified
+in a whitelisting entry.
+
+The specified email address has to match exactly the address previously
+used in a whitelist_from_dkim or def_whitelist_from_dkim directive
+(with an exception that its domain name part is matched case-insensitively).
+
=item adsp_override domain [signing-practices]
Currently few domains publish their signing practices (RFC 5617 - ADSP),
@@ -362,6 +375,7 @@ Example:
}
my $address = $1;
my $sdid = defined $2 ? $2 : ''; # empty implies author domain signature
+ $address =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
$self->{parser}->add_to_addrlist_rcvd('whitelist_from_dkim',
$address, $sdid);
}
@@ -381,12 +395,32 @@ Example:
}
my $address = $1;
my $sdid = defined $2 ? $2 : ''; # empty implies author domain signature
+ $address =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
$self->{parser}->add_to_addrlist_rcvd('def_whitelist_from_dkim',
$address, $sdid);
}
});
push (@cmds, {
+ setting => 'unwhitelist_from_dkim',
+ type => $Mail::SpamAssassin::Conf::CONF_TYPE_ADDRLIST,
+ code => sub {
+ my ($self, $key, $value, $line) = @_;
+ unless (defined $value && $value !~ /^$/) {
+ return $Mail::SpamAssassin::Conf::MISSING_REQUIRED_VALUE;
+ }
+ unless ($value =~ /^\S+$/) {
+ return $Mail::SpamAssassin::Conf::INVALID_VALUE;
+ }
+ $value =~ s/(\@[^@]*)\z/lc($1)/e; # lowercase the email address domain
+ $self->{parser}->remove_from_addrlist_rcvd('whitelist_from_dkim',
+ $value);
+ $self->{parser}->remove_from_addrlist_rcvd('def_whitelist_from_dkim',
+ $value);
+ }
+ });
+
+ push (@cmds, {
setting => 'adsp_override',
type => $Mail::SpamAssassin::Conf::CONF_TYPE_HASH_KEY_VALUE,
code => sub {
@@ -1046,6 +1080,8 @@ sub _wlcheck_acceptable_signature {
foreach my $white_addr (keys %$wl_ref) {
my $wl_addr_ref = $wl_ref->{$white_addr};
my $re = qr/$wl_addr_ref->{re}/i;
+ # dbg("dkim: WL %s %s, d: %s", $wl, $white_addr,
+ # join(", ", map { $_ eq '' ? "''" : $_ } @{$wl_addr_ref->{domain}}));
if ($author =~ $re) {
foreach my $sdid (@{$wl_addr_ref->{domain}}) {
push(@$acceptable_sdid_tuples_ref, [$author,$sdid,$wl,$re]);
@@ -1065,6 +1101,7 @@ sub _wlcheck_author_signature {
foreach my $author (@{$pms->{dkim_author_addresses}}) {
foreach my $white_addr (keys %$wl_ref) {
my $re = $wl_ref->{$white_addr};
+ # dbg("dkim: WL %s %s", $wl, $white_addr);
if ($author =~ $re) {
push(@$acceptable_sdid_tuples_ref, [$author,undef,$wl,$re]);
}