Subject: | MIME::Words: unexpected case |
Using MIMEDefang I suddenly saw this in my mail log:
Feb 19 17:51:02 chip mimedefang-multiplexor[25672]: Slave 2 stderr:
MIME::Words: unexpected case: (<EF><BF><BD>rsmkallelse07.doc) pos 0
Please alert developer.
(The <XX> are hexadecimal representation of 8-bit characters.)
So, I'm alerting the developer.
The error is at MIME/Words.pm line 234:
---8<---
### Case 4: bug!
die "MIME::Words: unexpected case:\n($encstr) pos $pos\n\t".
"Please alert developer.\n";
---8<---
Since it's a "die", it kills the MIMEDefang slave so the mail with the
bad file name is never received nor permanently rejected by us.
In order to receive the problematic mail with as little delay as
possible I put this did this:
----------8<----------
--- Words.pm Sat Mar 18 00:35:22 2006
+++ /usr/local/lib/perl5/site_perl/5.8.7/MIME/Words.pm Mon Feb 19
18:45:05 2007
@@ -181,6 +181,7 @@
sub decode_mimewords {
my $encstr = shift;
+ my $orgencstr = $encstr;
my %params = @_;
my @tokens;
$@ = ''; ### error-return
@@ -231,6 +232,11 @@
}
### Case 4: bug!
+
+ warn "MIME::Words: unexpected case:\n$orgencstr\n($encstr) pos
$pos\n\t".
+ "Please alert developer.\n";
+ last;
+
die "MIME::Words: unexpected case:\n($encstr) pos $pos\n\t".
"Please alert developer.\n";
}
----------8<----------
Wich gave me this in the log:
Feb 19 19:14:24 chip mimedefang-multiplexor[25672]: Slave 7 stderr:
MIME::Words: unexpected case: <EF><BF><BD>rsmkallelse07.doc
(<EF><BF><BD>rsmkallelse07.doc) pos 0 Please alert developer.
IOW, no more info than I allready had.
Unfortunately I don't have the mail as it was before our system handled
it, and the mail as stored here does not trigger this problem when I try
to send it through the system (though that could be because of errors on
my part).
I'm attaching it anyway since it might still be useful.
My first thought is to wrap calls to decode_mimewords() in evals, but a
second thought is that it would be nice to be able to specify a default
behaviour for bad data. (Also, there's a little bunch of calls to this
function in MIMEDefang...)
In a system such as MIMEDefang it might be better to do a warning and
return something like the string "[Error!]" that lets the system do it's
work on a malformed mail while still making it obvious that something
wasn't right.
Malformed headers are, unfortunately, something to be expected in mail
so software has to be able to handle them without dying...
Regards
/Jonas
Subject: | 1171904007.22016_0.dale |
Message body not shown because it is not plain text.