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 2006/12/08 20:14:30 UTC

svn commit: r484699 - /spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm

Author: felicity
Date: Fri Dec  8 11:14:25 2006
New Revision: 484699

URL: http://svn.apache.org/viewvc?view=rev&rev=484699
Log:
take the domain specified in DK and add it to the parsed uri list as a new domainkeys type.  generalize the get_uri_detail() handling of parsed to deal with different types.

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?view=diff&rev=484699&r1=484698&r2=484699
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri Dec  8 11:14:25 2006
@@ -1745,7 +1745,15 @@
   $self->{uri_domain_count} = 0;
 
   # do this so we're sure metadata->html is setup
-  my @parsed = $self->_get_parsed_uri_list();
+  my %parsed = map { $_ => 'parsed' } $self->_get_parsed_uri_list();
+
+  # Look for the domain in DK/DKIM headers
+  my $dk = $self->get('DomainKey-Signature');
+  if ($dk =~ /\bd\s*=\s*([^;]+)/) {
+    my $dom = $1;
+    $dom =~ s/\s+//g;
+    $parsed{$dom} = 'domainkeys';
+  }
 
   # get URIs from HTML parsing
   # use the metadata version since $self->{html} may not be setup
@@ -1781,14 +1789,19 @@
   }
 
   # canonify the text parsed URIs
-  foreach my $uri ( @parsed ) {
-    $detail->{$uri}->{types}->{parsed} = 1;
+  while (my($uri, $type) = each %parsed) {
+    $detail->{$uri}->{types}->{$type} = 1;
     my $info = $detail->{$uri};
 
     my @uris = ();
     
     if (!exists $info->{cleaned}) {
-      @uris = Mail::SpamAssassin::Util::uri_list_canonify($redirector_patterns, $uri);
+      if ($type eq 'parsed') {
+        @uris = Mail::SpamAssassin::Util::uri_list_canonify($redirector_patterns, $uri);
+      }
+      else {
+        @uris = ( $uri );
+      }
       $info->{cleaned} = \@uris;
 
       foreach (@uris) {
@@ -1801,7 +1814,7 @@
     }
 
     if (would_log('dbg', 'uri') == 2) {
-      dbg("uri: parsed uri found, $uri");
+      dbg("uri: parsed uri found of type $type, $uri");
       foreach my $nuri (@uris) {
         dbg("uri: cleaned parsed uri, $nuri");
       }



Re: svn commit: r484699 - /spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm

Posted by Theo Van Dinter <fe...@apache.org>.
On Fri, Dec 08, 2006 at 02:23:47PM -0500, Daryl C. W. O'Shea wrote:
> DKIM uses the header "DKIM-Signature".

Aha.  I wasn't sure if DK and DKIM used different headers.  Fixed now.
Thanks.  :)

-- 
Randomly Selected Tagline:
I need some duck tape.  My duck has a quack in it...

Re: svn commit: r484699 - /spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm

Posted by "Daryl C. W. O'Shea" <sp...@dostech.ca>.
felicity@apache.org wrote:
> Author: felicity
> Date: Fri Dec  8 11:14:25 2006
> New Revision: 484699
> 
> URL: http://svn.apache.org/viewvc?view=rev&rev=484699
> Log:
> take the domain specified in DK and add it to the parsed uri list as a new domainkeys type.  generalize the get_uri_detail() handling of parsed to deal with different types.
> 
> Modified:
>     spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
> 
> Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
> URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?view=diff&rev=484699&r1=484698&r2=484699
> ==============================================================================
> --- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
> +++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri Dec  8 11:14:25 2006
> @@ -1745,7 +1745,15 @@
>    $self->{uri_domain_count} = 0;
>  
>    # do this so we're sure metadata->html is setup
> -  my @parsed = $self->_get_parsed_uri_list();
> +  my %parsed = map { $_ => 'parsed' } $self->_get_parsed_uri_list();
> +
> +  # Look for the domain in DK/DKIM headers
> +  my $dk = $self->get('DomainKey-Signature');
> +  if ($dk =~ /\bd\s*=\s*([^;]+)/) {
> +    my $dom = $1;
> +    $dom =~ s/\s+//g;
> +    $parsed{$dom} = 'domainkeys';
> +  }

DKIM uses the header "DKIM-Signature".

Daryl