Update of /cvsroot/mhonarc/mhonarc/MHonArc/lib
In directory subversions:/tmp/cvs-serv6096
Modified Files:
readmail.pl
Log Message:
* Added malformed recovering case where terminating boundary delimiter
for a multipart message is not present.
Index: readmail.pl
===================================================================
RCS file: /cvsroot/mhonarc/mhonarc/MHonArc/lib/readmail.pl,v
retrieving revision 2.20
retrieving revision 2.21
diff -C2 -r2.20 -r2.21
*** readmail.pl 11 Oct 2002 01:57:53 -0000 2.20
--- readmail.pl 15 Oct 2002 22:06:53 -0000 2.21
***************
*** 528,535 ****
## Get boundary
$boundary = "";
! if ($content =~ m/boundary\s*=\s*"([^"]*)"/i) {
$boundary = $1;
} else {
! ($boundary) = $content =~ m/boundary\s*=\s*(\S+)/i;
$boundary =~ s/;$//; # chop ';' if grabbed
}
--- 528,535 ----
## Get boundary
$boundary = "";
! if ($content =~ m/\bboundary\s*=\s*"([^"]*)"/i) {
$boundary = $1;
} else {
! ($boundary) = $content =~ m/\bboundary\s*=\s*(\S+)/i;
$boundary =~ s/;$//; # chop ';' if grabbed
}
***************
*** 538,541 ****
--- 538,542 ----
if ($boundary =~ /\S/) {
my $found = 0;
+ my $have_end = 0;
my $start_pos = 0;
substr($$body, 0, 0) = "\n";
***************
*** 561,565 ****
# check if hit end
! last if $$body =~ /\A--/;
# remove EOL at the beginning
--- 562,569 ----
# check if hit end
! if ($$body =~ /\A--/) {
! $have_end = 1;
! last;
! }
# remove EOL at the beginning
***************
*** 567,570 ****
--- 571,581 ----
$start_pos = 0;
}
+ if (!$have_end) {
+ warn qq/Warning: No end boundary delimiter found in /,
+ qq/message body\n/;
+ push(@parts, $$body);
+ $parts[$#parts] =~ s/^\r//;
+ $$body = "";
+ }
if ($found) {
# discard front-matter
***************
*** 572,576 ****
} else {
# no boundary separators in message!
! warn qq/Warning: No boundaries found in message body\n/;
if ($$body =~ m/\A\n[\w\-]+:\s/) {
# remove \n added above if part looks like it has
--- 583,588 ----
} else {
# no boundary separators in message!
! warn qq/Warning: No boundary delimiters found in /,
! qq/multipart body\n/;
if ($$body =~ m/\A\n[\w\-]+:\s/) {
# remove \n added above if part looks like it has
---------------------------------------------------------------------
To sign-off this list, send email to majordomo(_at_)mhonarc(_dot_)org with the
message text UNSUBSCRIBE MHONARC-DEV