Bug 5331

Summary: Message::find_parts() omits some parts
Product: Spamassassin Reporter: Justin Mason <jm>
Component: LibrariesAssignee: SpamAssassin Developer Mailing List <dev>
Status: NEW ---    
Severity: normal    
Priority: P5    
Version: SVN Trunk (Latest Devel Version)   
Target Milestone: Undefined   
Hardware: Other   
OS: other   
Whiteboard:
Attachments: sample message
sample mail
attach email as text/plain :)
script copied from VBounce.pm
Another sample email which did not go through any filter

Description Justin Mason 2007-02-14 04:58:29 UTC
this is an undocumented limitation which breaks the VBounce plugin
on some messages.
Comment 1 Justin Mason 2007-02-14 04:59:24 UTC
also, it needs a test suite. ;)
Comment 2 Theo Van Dinter 2007-02-14 08:36:17 UTC
That's true if recursion == 0, otherwise there's no limit unless I'm not
understanding what you're saying. :)

Can you be more specific/give an example?
Comment 3 Justin Mason 2007-02-14 08:47:42 UTC
Created attachment 3863 [details]
sample message

ah, you're right -- I misread the code.

the attached message demos what I thought was the bug, but the real problem
must be something different though.  basically, the VBounce.pm code -- which
used find_parts(qr/message\//, 0, 1) -- would never recurse into the final,
'Undelivered Message' part.

This can be demoed by syncing to svn r507439, setting 

  whitelist_bounce_relays mail.mydomain.com

in the config and running through "spamassassin -L -t" -- __MY_SERVERS_FOUND
should fire, but does not...
Comment 4 Vincent Li 2007-04-13 13:04:38 UTC
Created attachment 3901 [details]
sample mail

I have:
whitelist_bounce_relays smtp.mydomain.com mail.mydomain.com in local.cf

but the attached email did not get "__MY_SERVERS_FOUND" hit

[16961] dbg: rules: ran header rule __BOUNCE_CTYPE ======> got hit:
"multipart/report"
[16961] dbg: rules: ran header rule __CTYPE_HAS_BOUNDARY ======> got hit:
"boundary"
[16961] dbg: rules: ran header rule __CT ======> got hit: "m"
[16961] dbg: rules: ran header rule __MISSING_REF ======> got hit: "UNSET"
[16961] dbg: rules: ran header rule __BOUNCE_RPATH_MD ======> got hit:
"MAILER-DAEMON@"
[16961] dbg: rules: ran header rule __DATE_700 ======> got hit: "-0700"
[16961] dbg: rules: ran header rule __NAKED_TO ======> got hit:
"vincent@mydomain.com"
[16961] dbg: rules: ran header rule __MIME_VERSION ======> got hit: "1"
[16961] dbg: rules: ran header rule __HAS_RCVD ======> got hit: "f"
[16961] dbg: rules: ran header rule __DOS_RCVD_FRI ======> got hit: " Fri, "
[16961] dbg: rules: ran header rule __TOCC_EXISTS ======> got hit: "v"
[16961] dbg: rules: ran header rule __MSGID_OK_HOST ======> got hit:
"@smtp.mydomain.com>"
[16961] dbg: rules: ran header rule __MSGID_OK_DIGITS ======> got hit:
"2007041318"
[16961] dbg: rules: ran header rule __MSOE_MID_WRONG_CASE ======> got hit: "
[16961] dbg: rules: ran header rule __HAS_MSGID ======> got hit: "<"
[16961] dbg: rules: ran header rule __SANE_MSGID ======> got hit:
"<20070413180244.6A3192D82338@smtp.mydomain.com>
[16961] dbg: rules: ran header rule __BOUNCE_UNDELIVERABLE_ML ======> got hit:
"Undelivered Mail"
[16961] dbg: rules: ran header rule __HAS_SUBJECT ======> got hit: "U"
[16961] dbg: rules: ran eval rule __ENV_AND_HDR_FROM_MATCH ======> got hit (1)
[16961] dbg: rules: ran eval rule UNPARSEABLE_RELAY ======> got hit (1)
[16961] dbg: rules: ran body rule __HAS_ANY_EMAIL ======> got hit: "g@vcn.bc.c"

[16961] dbg: rules: ran body rule __NONEMPTY_BODY ======> got hit: "U"
[16961] dbg: rules: ran uri rule __DOS_HAS_ANY_URI ======> got hit: "h"
[16961] dbg: rules: ran eval rule __HAVE_BOUNCE_RELAYS ======> got hit (1)
Comment 5 Vincent Li 2007-04-13 13:16:13 UTC
Created attachment 3902 [details]
attach email as text/plain :)
Comment 6 Vincent Li 2007-04-13 16:05:34 UTC
Created attachment 3904 [details]
script copied from VBounce.pm


I copy and paste part of VBounce.pm to a script sa.pl and run the post email
through the script like ./sa.pl < /tmp/mail, it got following result:

Found $foundnlnl = 0
relay = smtp.mydomain.com
relay = smtp.mydomain.com
relay = (star.mydomain.com
relay = smtp.mydomain.com
relay = [192.168.1.58]

If I run the sample email posted by Justin through the script, it got:

Found $foundnlnl = 1
relay = mail.mydomain.com
relay = [127.0.0.1]

From what I understand, for some reason, the VBounce module found no empty line
which separate the email head and body in my posted sample email, returned 0
and exited.
Comment 7 Vincent Li 2007-04-13 16:29:23 UTC
Created attachment 3905 [details]
Another sample email which did not go through any filter