Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: DBMail: dev

dbmail: fetch multipart rfc822 message errors

 

 

DBMail dev RSS feed   Index | Next | Previous | View Threaded


talanchor at mail

Aug 7, 2013, 5:26 AM

Post #1 of 6 (25 views)
Permalink
dbmail: fetch multipart rfc822 message errors

It seams like dbmail fails to parse incomming message correctly, if it has content type "message/rfc822" with submessage with content type "multipart/digest".
I've attached test files from latest imaptest (fetch-body-message-rfc822-mime and fetch-body-message-rfc822-mime.mbox, which contains the problem message itself) and log files (test.log and rawlog.1).
dbmail doesn't "see" internal message parts at all and returns NIL to commands like "fetch 1 (body.peek[1.2.TEXT])" or "fetch 1 (body.peek[1.1.HEADER])".
I'm not sure for now what can be done to fix this, so I just want to bring up your attention to this problem if you don't know about it yet.
Maybe the problem is not with dbmail itself, but rather with gmime parser. I've tried to build dbmail with latest gmime (2.6.16), but the problem is still there.
Attachments: fetch-body-message-rfc822-mime.mbox (0.41 KB)
  fetch-body-message-rfc822-mime (2.18 KB)
  test.log (7.66 KB)
  rawlog.1 (7.87 KB)


paul at nfg

Aug 7, 2013, 7:42 AM

Post #2 of 6 (24 views)
Permalink
Re: dbmail: fetch multipart rfc822 message errors [In reply to]

@talanchor,


I'm taking the liberty to CC both Timo and Jeff, since this also affects
both imaptest and GMime.


On 07-08-13 14:26, . . wrote:
> It seams like dbmail fails to parse incomming message correctly, if it
> has content type "message/rfc822" with submessage with content type
> "multipart/digest".

No it doesn't. But malformed MIME is indeed not parsed as imaptest expects.

This appears to be a very recently added test in imaptest. The mime
formatting appears broken. Perhaps that's intentional.

> I've attached test files from latest imaptest
> (fetch-body-message-rfc822-mime and fetch-body-message-rfc822-mime.mbox,

Apparently, if a mime boundary ends with white-space before the newline,
it's not parsed as such by GMime. I'm eyeballing rfc2046, and I think
GMime is in the wrong here. Whitespace at the end should be allowed.

But the example message is broken in other ways:

--foo

From: m1 [at] example
Subject: m1

m1 body
--foo

here, a spurious newline before a mime-part. Reading rfc2046 I'd say
that is not allowed, and indeed GMime doesn't like it. And finally:

--foo
X-Mime: m2 header

From: m2 [at] example
Subject: m2

m2 body

--foo--

this definitely breaks RFC822: the end of the headers is defined by two
newlines (CRFL's), so here the rfc822 headers end after the first x-mime
header.

Normally, if 'broken' MIME is found in the wild, I'd be happy to work
around it. But here we have an artificial construct, which appears to be
aimed at exercising the tolerance of dovecot's mime parser.

It would be completely bonkers for me to work around that, just to pass
a dubious test.


--
________________________________________________________________
Paul J Stevens pjstevns @ gmail, twitter, skype, linkedin

* Premium Hosting Services and Web Application Consultancy *

www.nfg.nl/info [at] nfg/+31.85.877.99.97
________________________________________________________________
Attachments: fetch-body-message-rfc822-mime.mbox (0.41 KB)


talanchor at mail

Aug 7, 2013, 8:30 AM

Post #3 of 6 (23 views)
Permalink
Re: dbmail: fetch multipart rfc822 message errors [In reply to]

>>> Apparently, if a mime boundary ends with white-space before the newline,
>>> it's not parsed as such by GMime. I'm eyeballing rfc2046, and I think
>>> GMime is in the wrong here. Whitespace at the end should be allowed.

Yes, it was prohibited in rfc1521, which was obsoleted by rfc2046, where it's allowed.

>>> here, a spurious newline before a mime-part. Reading rfc2046 I'd say
>>> that is not allowed, and indeed GMime doesn't like it. And finally:

I guess this newline refers to an empty mimepart header (and the
second non-empty header is the header of internal message), so it
should be correct.

>>> this definitely breaks RFC822: the end of the headers is defined by two
>>> newlines (CRFL's), so here the rfc822 headers end after the first x-mime
>>> header.

Maybe it's the same issue as in previous case: first header should refer
to mimepart header, which is closed by two CRLFs, and then goes internal
message's header, which is closed by two CRLFs too.


Среда, 7 августа 2013, 16:42 +02:00 от Paul J Stevens <paul [at] nfg>:
>@talanchor,
>
>
>I'm taking the liberty to CC both Timo and Jeff, since this also affects
>both imaptest and GMime.
>
>
>On 07-08-13 14:26, . . wrote:
>> It seams like dbmail fails to parse incomming message correctly, if it
>> has content type "message/rfc822" with submessage with content type
>> "multipart/digest".
>
>No it doesn't. But malformed MIME is indeed not parsed as imaptest expects.
>
>This appears to be a very recently added test in imaptest. The mime
>formatting appears broken. Perhaps that's intentional.
>
>> I've attached test files from latest imaptest
>> (fetch-body-message-rfc822-mime and fetch-body-message-rfc822-mime.mbox,
>
>Apparently, if a mime boundary ends with white-space before the newline,
>it's not parsed as such by GMime. I'm eyeballing rfc2046, and I think
>GMime is in the wrong here. Whitespace at the end should be allowed.
>
>But the example message is broken in other ways:
>
>--foo
>
>From: m1 [at] example
>Subject: m1
>
>m1 body
>--foo
>
>here, a spurious newline before a mime-part. Reading rfc2046 I'd say
>that is not allowed, and indeed GMime doesn't like it. And finally:
>
>--foo
>X-Mime: m2 header
>
>From: m2 [at] example
>Subject: m2
>
>m2 body
>
>--foo--
>
>this definitely breaks RFC822: the end of the headers is defined by two
>newlines (CRFL's), so here the rfc822 headers end after the first x-mime
>header.
>
>Normally, if 'broken' MIME is found in the wild, I'd be happy to work
>around it. But here we have an artificial construct, which appears to be
>aimed at exercising the tolerance of dovecot's mime parser.
>
>It would be completely bonkers for me to work around that, just to pass
>a dubious test.
>
>
>--
>________________________________________________________________
>Paul J Stevens pjstevns @ gmail, twitter, skype, linkedin
>
>  * Premium Hosting Services and Web Application Consultancy *
>
>            www.nfg.nl/info [at] nfg/+31.85.877.99.97
>________________________________________________________________
>


--
. .


talanchor at mail

Aug 7, 2013, 8:44 AM

Post #4 of 6 (23 views)
Permalink
Re: dbmail: fetch multipart rfc822 message errors [In reply to]

It seems like gmime treats body parts as "text/plain", whereas it should be " message/rfc822 "
because of "Content-Type: multipart/digest". Maybe this is the reason of incorrect parsing.

From rfc2046:
5.1.5. Digest Subtype
This document defines a "digest" subtype of the "multipart" Content-
Type. This type is syntactically identical to "multipart/mixed", but
the semantics are different. In particular, in a digest, the default
Content-Type value for a body part is changed from "text/plain" to
"message/rfc822".
_______________________________________________
Dbmail-dev mailing list
Dbmail-dev [at] dbmail
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev


talanchor at mail

Aug 8, 2013, 7:45 AM

Post #5 of 6 (20 views)
Permalink
Re: dbmail: fetch multipart rfc822 message errors [In reply to]

I've tried this test with dbmail + new gmime, and it still fails.
It seems like now the test message is broken up into more
parts than before, but there are no nested messages as the result of parsing.


paul at nfg

Aug 8, 2013, 11:35 AM

Post #6 of 6 (20 views)
Permalink
Re: dbmail: fetch multipart rfc822 message errors [In reply to]

No need to Cc Jeff. I'll look into it next week.

". ." <talanchor [at] mail> schreef:
> I've tried this test with dbmail + new gmime, and it still fails.
>It seems like now the test message is broken up into more
>parts than before, but there are no nested messages as the result of
>parsing.
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Dbmail-dev mailing list
>Dbmail-dev [at] dbmail
>http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail-dev

--
Verzonden van mijn Android telefoon met K-9 Mail.

DBMail dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.