spamassassin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzilla-dae...@spamassassin.apache.org
Subject [Bug 7831] DKIM_VALID_AU does not get set properly when mailing from a subdomain
Date Mon, 06 Jul 2020 02:04:08 GMT
https://bz.apache.org/SpamAssassin/show_bug.cgi?id=7831

--- Comment #9 from Rob Mosher <nyt-apachebz@countercultured.net> ---
adjusted... 

Here's the trunk patch

--- a/lib/Mail/SpamAssassin/Plugin/DKIM.pm
+++ b/lib/Mail/SpamAssassin/Plugin/DKIM.pm
@@ -561,9 +561,10 @@ sub check_dkim_valid_author_sig {
 sub check_dkim_valid_envelopefrom {
   my ($self, $pms, $full_ref) = @_;
   my $result = 0;
-  my
$envfrom=$self->{'main'}->{'registryboundaries'}->uri_to_domain($pms->get("EnvelopeFrom"));
+  my ( $envfrom ) = $pms->get("EnvelopeFrom:addr") =~ /@(\S*)/i;
   # if no envelopeFrom, it cannot be valid
   return $result if !$envfrom;
+  $envfrom = lc $envfrom;
   $self->_check_dkim_signature($pms)  if !$pms->{dkim_checked_signature};
   if (!$pms->{dkim_valid}) {
     # don't bother
@@ -720,7 +721,7 @@ sub _check_dkim_signed_by {
       next if $minimum_key_bits && $sig->{_spamassassin_key_size} &&
               $sig->{_spamassassin_key_size} < $minimum_key_bits;
     }
-    my $sdid = $sig->domain;
+    my ( $sdid ) = $sig->identity =~ /@(\S*)/;
     next if !defined $sdid;  # a signature with a missing required tag 'd' ?
     $sdid = lc $sdid;
     if ($must_be_author_domain_signature) {
@@ -909,7 +910,7 @@ sub _check_dkim_signature {
       push(@valid_signatures, $signature)  if $valid && !$expired;

       # check if we have a potential Author Domain Signature, valid or not
-      my $d = $signature->domain;
+      my ( $d ) = $signature->identity =~ /@(\S*)/;
       if (!defined $d) {
         # can be undefined on a broken signature with missing required tags
       } else {
@@ -1261,7 +1262,7 @@ sub _wlcheck_list {
       }
     }

-    my $sdid = $signature->domain;
+    my ( $sdid ) = $signature->identity =~ /@(\S+)/;
     $sdid = lc $sdid  if defined $sdid;

     my %tried_authors;

And here's the 3.4 patch

--- spamassassin-3.4.4/lib/Mail/SpamAssassin/Plugin/DKIM.pm     2020-01-18
03:44:49.000000000 -0500
+++ /usr/share/perl5/Mail/SpamAssassin/Plugin/DKIM.pm   2020-07-05
21:55:06.897221239 -0400
@@ -560,9 +560,10 @@ sub check_dkim_valid_author_sig {
 sub check_dkim_valid_envelopefrom {
   my ($self, $pms, $full_ref) = @_;
   my $result = 0;
-  my
$envfrom=$self->{'main'}->{'registryboundaries'}->uri_to_domain($pms->get("EnvelopeFrom"));
+  my ( $envfrom ) = $pms->get("EnvelopeFrom:addr") =~ /@(\S*)/i;
   # if no envelopeFrom, it cannot be valid
   return $result if !$envfrom;
+  $envfrom = lc $envfrom;
   $self->_check_dkim_signature($pms)  if !$pms->{dkim_checked_signature};
   if (!$pms->{dkim_valid}) {
     # don't bother
@@ -719,7 +720,7 @@ sub _check_dkim_signed_by {
       next if $minimum_key_bits && $sig->{_spamassassin_key_size} &&
               $sig->{_spamassassin_key_size} < $minimum_key_bits;
     }
-    my $sdid = $sig->domain;
+    my ( $sdid ) = $sig->identity =~ /@(\S*)/;
     next if !defined $sdid;  # a signature with a missing required tag 'd' ?
     $sdid = lc $sdid;
     if ($must_be_author_domain_signature) {
@@ -902,7 +903,7 @@ sub _check_dkim_signature {
       push(@valid_signatures, $signature)  if $valid && !$expired;

       # check if we have a potential Author Domain Signature, valid or not
-      my $d = $signature->domain;
+      my ( $d ) = $signature->identity =~ /@(\S*)/;
       if (!defined $d) {
         # can be undefined on a broken signature with missing required tags
       } else {
@@ -1254,7 +1255,7 @@ sub _wlcheck_list {
       }
     }

-    my $sdid = $signature->domain;
+    my ( $sdid ) = $signature->identity =~ /@(\S+)/;
     $sdid = lc $sdid  if defined $sdid;

     my %tried_authors;

-- 
You are receiving this mail because:
You are the assignee for the bug.
Mime
View raw message