You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2018/10/20 02:54:22 UTC

svn commit: r1844383 - in /spamassassin: branches/3.4/ branches/3.4/lib/Mail/SpamAssassin/ branches/3.4/lib/Mail/SpamAssassin/Message/ trunk/ trunk/lib/Mail/SpamAssassin/ trunk/lib/Mail/SpamAssassin/Message/

Author: hege
Date: Sat Oct 20 02:54:21 2018
New Revision: 1844383

URL: http://svn.apache.org/viewvc?rev=1844383&view=rev
Log:
Make ALL pseudo-header return decoded headers, so it's usage is consistent with normal header usage

Modified:
    spamassassin/branches/3.4/UPGRADE
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/Message/Node.pm
    spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm
    spamassassin/trunk/UPGRADE
    spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm

Modified: spamassassin/branches/3.4/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/UPGRADE?rev=1844383&r1=1844382&r2=1844383&view=diff
==============================================================================
--- spamassassin/branches/3.4/UPGRADE (original)
+++ spamassassin/branches/3.4/UPGRADE Sat Oct 20 02:54:21 2018
@@ -11,6 +11,9 @@ Note for Users Upgrading to SpamAssassin
   "ALTER TABLE txrep RENAME COLUMN count TO msgcount;"
   "ALTER TABLE awl RENAME COLUMN count TO msgcount;"
 
+- ALL pseudo-header now returns decoded headers, so it's usage is consistent
+  with single header matching (:raw returns undecoded and unfolded like
+  before).
 
 Note for Users Upgrading to SpamAssassin 3.4.2
 ----------------------------------------------

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/Message/Node.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/Message/Node.pm?rev=1844383&r1=1844382&r2=1844383&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/Message/Node.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/Message/Node.pm Sat Oct 20 02:54:21 2018
@@ -979,7 +979,7 @@ sub get_all_headers {
 	$self->{'truncated_header'} = 1;
 	last HEADER;
       }
-      $lines[$position] = $self->{header_order}->[$position].":".$contents;
+      $lines[$position] = $self->{header_order}->[$position].": ".$contents;
     }
   }
 

Modified: spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1844383&r1=1844382&r2=1844383&view=diff
==============================================================================
--- spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/branches/3.4/lib/Mail/SpamAssassin/PerMsgStatus.pm Sat Oct 20 02:54:21 2018
@@ -1831,6 +1831,7 @@ There are several special pseudo-headers
 =over 4
 
 =item C<ALL> can be used to mean the text of all the message's headers.
+Each header is decoded and unfolded to single line, unless called with :raw.
 
 =item C<ALL-TRUSTED> can be used to mean the text of all the message's headers
 that could only have been added by trusted relays.
@@ -1892,7 +1893,7 @@ sub _get {
   # ALL: entire pristine or semi-raw headers
   if ($request eq 'ALL') {
     return ($getraw ? $self->{msg}->get_pristine_header()
-                    : $self->{msg}->get_all_headers(1));
+                    : $self->{msg}->get_all_headers(0));
   }
   # ALL-TRUSTED: entire trusted raw headers
   elsif ($request eq 'ALL-TRUSTED') {
@@ -2842,7 +2843,7 @@ sub get_envelope_from {
   if ($envf = $self->get("X-Envelope-From")) {
     # heuristic: this could have been relayed via a list which then used
     # a *new* Envelope-from.  check
-    if ($self->get("ALL:raw") =~ /^Received:.*^X-Envelope-From:/smi) {
+    if ($self->get("ALL") =~ /^Received:.*?^X-Envelope-From:/smi) {
       dbg("message: X-Envelope-From header found after 1 or more Received lines, cannot trust envelope-from");
       return;
     } else {
@@ -2854,7 +2855,7 @@ sub get_envelope_from {
   if ($envf = $self->get("Envelope-Sender")) {
     # heuristic: this could have been relayed via a list which then used
     # a *new* Envelope-from.  check
-    if ($self->get("ALL:raw") =~ /^Received:.*^Envelope-Sender:/smi) {
+    if ($self->get("ALL") =~ /^Received:.*?^Envelope-Sender:/smi) {
       dbg("message: Envelope-Sender header found after 1 or more Received lines, cannot trust envelope-from");
     } else {
       goto ok;
@@ -2871,7 +2872,7 @@ sub get_envelope_from {
   if ($envf = $self->get("Return-Path")) {
     # heuristic: this could have been relayed via a list which then used
     # a *new* Envelope-from.  check
-    if ($self->get("ALL:raw") =~ /^Received:.*^Return-Path:/smi) {
+    if ($self->get("ALL") =~ /^Received:.*?^Return-Path:/smi) {
       dbg("message: Return-Path header found after 1 or more Received lines, cannot trust envelope-from");
     } else {
       goto ok;
@@ -2917,7 +2918,7 @@ sub get_all_hdrs_in_rcvd_index_range {
   if ($getraw) {
     @hdrs = $self->{msg}->get_pristine_header() =~ /^([^ \t].*?\n)(?![ \t])/smgi;
   } else {
-    @hdrs = split(/^/m, $self->{msg}->get_all_headers(1));
+    @hdrs = split(/^/m, $self->{msg}->get_all_headers(0));
   }
 
   foreach my $hdr (@hdrs) {

Modified: spamassassin/trunk/UPGRADE
URL: http://svn.apache.org/viewvc/spamassassin/trunk/UPGRADE?rev=1844383&r1=1844382&r2=1844383&view=diff
==============================================================================
--- spamassassin/trunk/UPGRADE (original)
+++ spamassassin/trunk/UPGRADE Sat Oct 20 02:54:21 2018
@@ -68,6 +68,10 @@ Note for Users Upgrading to SpamAssassin
   filter (pypolicyd-spf / spf-engine etc), from which generated Received-SPF
   header can be parsed by SpamAssassin.
 
+- ALL pseudo-header now returns decoded headers, so it's usage is consistent
+  with single header matching (:raw returns undecoded and unfolded like
+  before).
+
 Note for Users Upgrading to SpamAssassin 3.4.2
 ----------------------------------------------
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm?rev=1844383&r1=1844382&r2=1844383&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message/Node.pm Sat Oct 20 02:54:21 2018
@@ -1068,7 +1068,7 @@ sub get_all_headers {
 	$self->{'truncated_header'} = 1;
 	last HEADER;
       }
-      $lines[$position] = $self->{header_order}->[$position].":".$contents;
+      $lines[$position] = $self->{header_order}->[$position].": ".$contents;
     }
   }
 

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm?rev=1844383&r1=1844382&r2=1844383&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Sat Oct 20 02:54:21 2018
@@ -1823,8 +1823,7 @@ etc.  If C<default_value> is given, it w
 C<header_name> does not exist.
 
 Appending C<:raw> to the header name will inhibit decoding of quoted-printable
-or base-64 encoded strings. If used with pseudo-header ALL*, folding will
-be preserved.
+or base-64 encoded strings.
 
 Appending a modifier C<:addr> to a header field name will cause everything
 except the first email address to be removed from the header field.  It is
@@ -1878,6 +1877,7 @@ There are several special pseudo-headers
 =over 4
 
 =item C<ALL> can be used to mean the text of all the message's headers.
+Each header is decoded and unfolded to single line, unless called with :raw.
 
 =item C<ALL-TRUSTED> can be used to mean the text of all the message's headers
 that could only have been added by trusted relays.
@@ -1939,7 +1939,7 @@ sub _get {
   # ALL: entire pristine or semi-raw headers
   if ($request eq 'ALL') {
     return ($getraw ? $self->{msg}->get_pristine_header()
-                    : $self->{msg}->get_all_headers(1));
+                    : $self->{msg}->get_all_headers(0));
   }
   # ALL-TRUSTED: entire trusted raw headers
   elsif ($request eq 'ALL-TRUSTED') {
@@ -2891,7 +2891,7 @@ sub get_envelope_from {
   if ($envf = $self->get("X-Envelope-From")) {
     # heuristic: this could have been relayed via a list which then used
     # a *new* Envelope-from.  check
-    if ($self->get("ALL") =~ /^Received:.*^X-Envelope-From:/smi) {
+    if ($self->get("ALL") =~ /^Received:.*?^X-Envelope-From:/smi) {
       dbg("message: X-Envelope-From header found after 1 or more Received lines, cannot trust envelope-from");
       return;
     } else {
@@ -2903,7 +2903,7 @@ sub get_envelope_from {
   if ($envf = $self->get("Envelope-Sender")) {
     # heuristic: this could have been relayed via a list which then used
     # a *new* Envelope-from.  check
-    if ($self->get("ALL") =~ /^Received:.*^Envelope-Sender:/smi) {
+    if ($self->get("ALL") =~ /^Received:.*?^Envelope-Sender:/smi) {
       dbg("message: Envelope-Sender header found after 1 or more Received lines, cannot trust envelope-from");
     } else {
       goto ok;
@@ -2920,7 +2920,7 @@ sub get_envelope_from {
   if ($envf = $self->get("Return-Path")) {
     # heuristic: this could have been relayed via a list which then used
     # a *new* Envelope-from.  check
-    if ($self->get("ALL") =~ /^Received:.*^Return-Path:/smi) {
+    if ($self->get("ALL") =~ /^Received:.*?^Return-Path:/smi) {
       dbg("message: Return-Path header found after 1 or more Received lines, cannot trust envelope-from");
     } else {
       goto ok;
@@ -2966,7 +2966,7 @@ sub get_all_hdrs_in_rcvd_index_range {
   if ($getraw) {
     @hdrs = $self->{msg}->get_pristine_header() =~ /^([^ \t].*?\n)(?![ \t])/smgi;
   } else {
-    @hdrs = split(/^/m, $self->{msg}->get_all_headers(1));
+    @hdrs = split(/^/m, $self->{msg}->get_all_headers(0));
   }
 
   foreach my $hdr (@hdrs) {