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/01/08 01:59:59 UTC
svn commit: r897070 -
/spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm
Author: mmartinec
Date: Fri Jan 8 00:59:58 2010
New Revision: 897070
URL: http://svn.apache.org/viewvc?rev=897070&view=rev
Log:
Bug 6275: X-Spam-* header fields are inserted in the middle of a Return-Path
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?rev=897070&r1=897069&r2=897070&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/PerMsgStatus.pm Fri Jan 8 00:59:58 2010
@@ -895,7 +895,7 @@
my @pristine_headers = split(/^/m, $self->{msg}->get_pristine_header());
for (my $line = 0; $line <= $#pristine_headers; $line++) {
next unless ($pristine_headers[$line] =~ /^X-Spam-(?!Prev-)/i);
- splice @pristine_headers, $line, 1 while ($pristine_headers[$line] =~ /^(?:X-Spam-(?!Prev-)|\s+\S)/i);
+ splice @pristine_headers, $line, 1 while ($pristine_headers[$line] =~ /^(?:X-Spam-(?!Prev-)|[ \t])/i);
$line--;
}
my $separator = '';
@@ -946,29 +946,27 @@
$addition = 'headers_spam';
}
- # Break the pristine header set up into two blocks; "pre" is the stuff that
- # we want to ensure comes before any SpamAssassin markup headers, like the
- # Return-Path header (see bug 3409).
+ # Break the pristine header set into two blocks; $new_hdrs_pre is the stuff
+ # that we want to ensure comes before any SpamAssassin markup headers,
+ # like the Return-Path header (see bug 3409).
#
- # "post" is all the rest of the message headers, placed after the
- # SpamAssassin markup hdrs. Once one of those headers is seen, all further
- # headers go into that set; it's assumed that it's an old copy of the
- # header, or attempted spoofing, if it crops up halfway through the
- # headers.
+ # all the rest of the message headers (as left in @pristine_headers), is
+ # to be placed after the SpamAssassin markup hdrs. Once one of those headers
+ # is seen, all further headers go into that set; it's assumed that it's an
+ # old copy of the header, or attempted spoofing, if it crops up halfway
+ # through the headers.
my $new_hdrs_pre = '';
- my $new_hdrs_post = '';
- foreach my $hdr (@pristine_headers) {
- if ($new_hdrs_post eq '' && $hdr =~ /^Return-Path:/i) {
- $new_hdrs_pre .= $hdr;
- } else {
- $new_hdrs_post .= $hdr;
+ if (@pristine_headers && $pristine_headers[0] =~ /^Return-Path:/i) {
+ $new_hdrs_pre .= shift(@pristine_headers);
+ while (@pristine_headers && $pristine_headers[0] =~ /^[ \t]/) {
+ $new_hdrs_pre .= shift(@pristine_headers);
}
}
$new_hdrs_pre .= $self->_get_added_headers($addition);
# fix up line endings appropriately
- my $newmsg = $new_hdrs_pre.$new_hdrs_post.$separator;
+ my $newmsg = $new_hdrs_pre . join('',@pristine_headers) . $separator;
$self->_fixup_report_line_endings(\$newmsg);
return $newmsg.$self->{msg}->get_pristine_body();