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 2007/07/07 06:44:53 UTC
svn commit: r554131 - /spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
Author: felicity
Date: Fri Jul 6 21:44:52 2007
New Revision: 554131
URL: http://svn.apache.org/viewvc?view=rev&rev=554131
Log:
more correctly detect missing mime-part headers
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm?view=diff&rev=554131&r1=554130&r2=554131
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Message.pm Fri Jul 6 21:44:52 2007
@@ -717,6 +717,13 @@
if ($body->[$line] =~ /^--\Q$boundary\E\s*$/) {
# Make note that we found the opening boundary
$self->{mime_boundary_state}->{$boundary} = 1;
+
+ # if the line after the opening boundary isn't a header, flag it.
+ # we need to make sure that there's actually another line though.
+ if ($line+1 < $tmp_line && $body->[$line+1] !~ /^[\041-\071\073-\176]+:/) {
+ $self->{'missing_mime_headers'} = 1;
+ }
+
last;
}
}
@@ -774,10 +781,18 @@
# rfc 1521 says /^--boundary--$/, some MUAs may just require /^--boundary--/
# but this causes problems with horizontal lines when the boundary is
# made up of dashes as well, etc.
- if (defined $boundary && $line =~ /^--\Q${boundary}\E--\s*$/) {
- # Make a note that we've seen the end boundary
- $self->{mime_boundary_state}->{$boundary}--;
- last;
+ if (defined $boundary) {
+ if ($line =~ /^--\Q${boundary}\E--\s*$/) {
+ # Make a note that we've seen the end boundary
+ $self->{mime_boundary_state}->{$boundary}--;
+ last;
+ }
+ elsif ($line_count && $body->[-$line_count] !~ /^[\041-\071\073-\176]+:/) {
+ # if we aren't on an end boundary and there are still lines left, it
+ # means we hit a new start boundary. therefore, the next line ought
+ # to be a mime header. if it's not, mark it.
+ $self->{'missing_mime_headers'} = 1;
+ }
}
# make sure we start with a new clean node
@@ -791,7 +806,7 @@
if (!$in_body) {
# s/\s+$//; # bug 5127: don't clean this up (yet)
- if (m/^[\041-\071\073-\176]+:/) {
+ if (/^[\041-\071\073-\176]+:/) {
if ($header) {
my ( $key, $value ) = split ( /:\s*/, $header, 2 );
$part_msg->header( $key, $value );
@@ -799,7 +814,7 @@
$header = $_;
next;
}
- elsif (/^[ \t]/) {
+ elsif (/^[ \t]/ && $header) {
# $_ =~ s/^\s*//; # bug 5127, again
$header .= $_;
next;
@@ -809,9 +824,6 @@
my ( $key, $value ) = split ( /:\s*/, $header, 2 );
$part_msg->header( $key, $value );
}
- else {
- $self->{'missing_mime_headers'} = 1;
- }
$in_body = 1;
# if there's a blank line separator, that's good. if there isn't,