Bug 130

Summary: Migrate to using MIME::Tools
Product: Spamassassin Reporter: Craig Hughes <craig>
Component: LibrariesAssignee: SpamAssassin Developer Mailing List <dev>
Status: RESOLVED FIXED    
Severity: enhancement CC: quinlan, schaefer, shanew
Priority: P2    
Version: 2.30CVS   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 872, 885    

Description Craig Hughes 2002-03-25 17:26:07 UTC
There are a number of reasons for wanting to do this.  From decoding multipart 
messages correctly, to being able to easily add reports as a new MIME part, to 
dealing with Content-encoding difficulties.
Comment 1 Craig Hughes 2002-03-25 17:26:29 UTC
*** Bug 18 has been marked as a duplicate of this bug. ***
Comment 2 Craig Hughes 2002-03-25 17:32:51 UTC
*** Bug 87 has been marked as a duplicate of this bug. ***
Comment 3 Craig Hughes 2002-03-25 17:33:21 UTC
*** Bug 115 has been marked as a duplicate of this bug. ***
Comment 4 Craig Hughes 2002-04-05 10:39:24 UTC
Reassigning to list -- originally accepted before bugzilla policy 
change/clarification
Comment 5 Chris 2002-04-19 15:58:33 UTC
What do you want done with MIME::Tools?  I can work something together, it is a pretty easy to use 
module.
Comment 6 Craig Hughes 2002-04-19 16:43:18 UTC
Subject: Re: [SAdev]  Migrate to using MIME::Tools

What I want to do is replace all the kludgy base64 decoding and mime parsing
hacks currently in the code with calls to MIME::Tools, then intelligently looks
a each MIME part and do the right thing with them.  Also do things like look at
the encodings used, and stuff like that, as we're currently doing, but using the
lib instead of our own version thereof so we don't hit all the weird border
cases and have trouble with foreign charsets, odd encodings, etc, etc.

Comment 7 Craig Hughes 2002-04-19 16:44:23 UTC
Subject: Re: [SAdev]  Migrate to using MIME::Tools

What I want to do is replace all the kludgy base64 decoding and mime parsing
hacks currently in the code with calls to MIME::Tools, then intelligently looks
a each MIME part and do the right thing with them.  Also do things like look at
the encodings used, and stuff like that, as we're currently doing, but using the
lib instead of our own version thereof so we don't hit all the weird border
cases and have trouble with foreign charsets, odd encodings, etc, etc.


_______________________________________________
Spamassassin-devel mailing list
Spamassassin-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/spamassassin-devel

Comment 8 Craig Hughes 2002-05-13 23:19:35 UTC
*** Bug 310 has been marked as a duplicate of this bug. ***
Comment 9 Craig Hughes 2002-06-09 23:19:18 UTC
Aw bugger.  I guess it failed to make it in for 2.30 -- sounds like 3.0 is going to have a bunch of 
changes to the core parsing stuff, so maybe it'll fit in with that stuff.  To quote Shel Silverstein, 
my favorite poet:

Lazy lazy lazy lazy lazy lazy Jane.
She wants a drink of water
so
she waits and waits and waits and waits and waits for it to rain
Comment 10 Daniel Quinlan 2002-06-10 13:47:50 UTC
Please make sure the new code does the right thing for uuencoded
text (that is, independent whether uuencoded files are part of a MIME
section or not) as well.
Comment 11 Matthew Cline 2002-08-26 18:30:18 UTC
MIME::Tools doesn't look that hard to use, but there's a few things to
discuss before I'll take a shot at it.

First is that the full tests are given the original message, only
modified by removing any non-text attachments.  As far as I can tell,
MIME::Parser can't be used for that, since it will decode MIME parts
with base64, uuencode or Quoted-Printable decodings, so after removing
the non-text parts, the text parts will all be decoded.  However,
among the current full tests, all but the check_signature() and
check_for_faraway_charset_in_body() tests use
$self->get_full_message_as_text() rather than the $fulltext argument,
check_for_faraway_charset_in_body() only needs it to check the MIME
headers (which can be done better by using MIME::Tools), and I don't
think any signature checking tests need the full, unaltered body.

So I would suggest that full tests be given the result of
$self->get_full_message_as_text() as their argument, and
check_signature() be made a normal body test.  I can then start
putting in MIME::Tools, and make a new "multipart" test for
check_for_faraway_charset_in_body(), which will give it the result of
MIME::Parser to play with.
Comment 12 Malte S. Stretz 2002-08-27 02:45:08 UTC
I receive quite many spams (~25%) with broken MIME-Boundaries. Eg  
 
  Content-Type: multipart/mixed;  
    boundary="----=_NextPart_000_00A0_51A14E8D.B2728A86"  
  ...  
   
  ------=_NextPart_000_00A0_51A14E8D.B2728A86 
  Content-Type: text/plain; charset="iso-8859-1" 
  Content-Transfer-Encoding: base64 
 
SA triggers MIME_MISSING_BOUNDARY but does parse these right because it just 
ignores the boundary string and decodes each base64. Seems like Outlook does 
this too, else that spam wouldn't make any sense. Will MIME::Tools handle 
these, too? 
Comment 13 Matthew Cline 2002-08-27 04:21:29 UTC
Looks like it deals with missing boundaries; even outputs a fixed-up
version for you.
Comment 14 Malte S. Stretz 2002-08-27 04:36:31 UTC
That's very nice. Now I can finally read all my spam :) Hmmm... Although this 
would be nice, SA should not do so only if defang_mime is enabled. 
Comment 15 Matthew Cline 2002-10-09 17:19:46 UTC
Are we going to be doing this for 3.0?  The bugzilla version still says
2.30CVS...
Comment 16 Matt Sergeant 2002-10-10 01:43:51 UTC
Subject: Re: [SAdev]  Migrate to using MIME::Tools

Possibly, but unlikely. SA3 CVS already has it's own MIME mail parser in 
it that I've tested on a few hundred thousand emails and it seems to 
work pretty well.

Matt.

Comment 17 Craig Hughes 2002-10-10 11:58:38 UTC
I'm going to go ahead and close this, since I think it's supplanted by the new MIME 
parsing stuff.  It's always nice to clear out very very old tickets.  Actually, is there a ticket 
tracking the new MIME parser, so we can just mark this one as a dupe of that one?
Comment 18 Craig Hughes 2002-12-11 12:58:07 UTC
Closed, since nobody complained.  Couldn't find a dupe.