[Mimedefang] Debugging MIME Parsing Errors

Richard Laager rlaager at wiktel.com
Mon Oct 14 10:46:32 EDT 2013


We have a user who is forwarding a Delta airlines email. They've
forwarded it several times for testing. Sometimes it gets bounced with
the "Message contained too many MIME parts." message, while other times
it goes through.

I have $MaxMIMEParts set to 100.

I've looked at the code and it seems to me that when parsing fails, it
is *assumed* to be due to having too many parts. Unless parse() returns
undef for too many parts and something else that's false for other
parser failures? But if that's the case, why the check that
$MaxMIMEParts > 0? So I'm not sure if this is really because of too many
MIME parts or not.

Here's the MIMEDefang code I'm referring to:

    push_status_tag("Parsing Message");
    $entity = $parser->parse(\*FILE);
    pop_status_tag();
    close FILE;

    if (!defined($entity) && $MaxMIMEParts > 0) {
        # Message is too complex; bounce it
        action_bounce("Message contained too many MIME parts.  We do not accept such complicated messages.");
        signal_unchanged();
        signal_complete();
        return;
    }

    if (!$entity) {
        fatal("$MsgID: Couldn't parse MIME in $file: $!");
        signal_complete();
        return -1;
    }

What's the best way to debug this? It seems like I need to keep a copy
of the raw message from a time when it failed. Would
KEEP_FAILED_DIRECTORIES=yes apply here, or is this not a case of "the
filter failing" (since the filter didn't actually crash)?

-- 
Richard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <https://lists.mimedefang.org/pipermail/mimedefang_lists.mimedefang.org/attachments/20131014/0ad7de73/attachment.sig>


More information about the MIMEDefang mailing list