[Dovecot] BODYSTRUCTURE bug?
Hi! I've found a bug in Content-Type parsing. It's old instance of dovecot 1.1. Maybe fixed in newer versions. I have a mail with header: Content-Type: multipart/signed; boundary="------------080705010808010608030700"; protocol="application/x-pkcs7-signature";micalg="SHA1" and it works, but when the boundary is in different order Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";micalg="SHA1"; boundary="------------080705010808010608030700" dovecot returns wrong BODYSTRUCTURE: ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 226233 2955 NIL NIL NIL NIL) If this has been fixed, in which version? -- Aleksander 'A.L.E.C' Machniak LAN Management System Developer [http://lms.org.pl] Roundcube Webmail Developer [http://roundcube.net] --------------------------------------------------- PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
On 10.5.2012, at 11.54, A.L.E.C wrote:
Hi! I've found a bug in Content-Type parsing. It's old instance of dovecot 1.1. Maybe fixed in newer versions.
I have a mail with header:
Content-Type: multipart/signed; boundary="------------080705010808010608030700"; protocol="application/x-pkcs7-signature";micalg="SHA1"
and it works, but when the boundary is in different order
Content-Type: multipart/signed; protocol="application/x-pkcs7-signature";micalg="SHA1"; boundary="------------080705010808010608030700"
dovecot returns wrong BODYSTRUCTURE:
("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 226233 2955 NIL NIL NIL NIL)
If this has been fixed, in which version?
This works fine in v1.0.15 and v1.1.20. Are you sure the problem is the order of the parameters, and not that the second one is broken in some other way? Or I guess it might be that in your specific version this is broken, but I don't remember such bug.
On 05/10/2012 11:02 AM, Timo Sirainen wrote:
This works fine in v1.0.15 and v1.1.20. Are you sure the problem is the order of the parameters, and not that the second one is broken in some other way? Or I guess it might be that in your specific version this is broken, but I don't remember such bug.
Yes. I'm sure. Dovecot version is 1.1.19 on gentoo. I'm attaching the message source which works. The diff to non-working version is: @@ -2,8 +2,8 @@ MIME-Version: 1.0 Date: Thu, 10 May 2012 10:23:27 +0200 Content-Type: multipart/signed; - boundary=------------010606060406010200080606; - protocol=application/x-pkcs7-signature; micalg=sha1 + protocol=application/x-pkcs7-signature; micalg=sha1; + boundary=------------010606060406010200080606 Subject: Potwierdzenie wykonania przelewu From: kontakt@mbank.pl X-Priority: 3 (Normal) -- Aleksander 'A.L.E.C' Machniak LAN Management System Developer [http://lms.org.pl] Roundcube Webmail Developer [http://roundcube.net] --------------------------------------------------- PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
On 10.5.2012, at 12.22, A.L.E.C wrote:
On 05/10/2012 11:02 AM, Timo Sirainen wrote:
This works fine in v1.0.15 and v1.1.20. Are you sure the problem is the order of the parameters, and not that the second one is broken in some other way? Or I guess it might be that in your specific version this is broken, but I don't remember such bug.
Yes. I'm sure. Dovecot version is 1.1.19 on gentoo. I'm attaching the message source which works. The diff to non-working version is:
- protocol=application/x-pkcs7-signature; micalg=sha1
The message is broken. If you look at RFC 2045, what it comes down to is that '/' character cannot be in the value unless the whole value is "quoted". So this isn't a Dovecot bug, but anyway Dovecot v1.2+ happens to parse this in the way you want because it uses a different RFC 2231 parser, which just happens to parse this in a more forgiving way.
On 05/10/2012 11:39 AM, Timo Sirainen wrote:
- protocol=application/x-pkcs7-signature; micalg=sha1
The message is broken. If you look at RFC 2045, what it comes down to is that '/' character cannot be in the value unless the whole value is "quoted". So this isn't a Dovecot bug, but anyway Dovecot v1.2+ happens to parse this in the way you want because it uses a different RFC 2231 parser, which just happens to parse this in a more forgiving way.
Yes. However, changing to protocol="application/x-pkcs7-signature" doesn't fix the issue. -- Aleksander 'A.L.E.C' Machniak LAN Management System Developer [http://lms.org.pl] Roundcube Webmail Developer [http://roundcube.net] --------------------------------------------------- PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
On 10.5.2012, at 13.05, A.L.E.C wrote:
On 05/10/2012 11:39 AM, Timo Sirainen wrote:
- protocol=application/x-pkcs7-signature; micalg=sha1
The message is broken. If you look at RFC 2045, what it comes down to is that '/' character cannot be in the value unless the whole value is "quoted". So this isn't a Dovecot bug, but anyway Dovecot v1.2+ happens to parse this in the way you want because it uses a different RFC 2231 parser, which just happens to parse this in a more forgiving way.
Yes. However, changing to protocol="application/x-pkcs7-signature" doesn't fix the issue.
If you delete dovecot.index.cache file, it should fix it.
On 05/10/2012 12:10 PM, Timo Sirainen wrote:
Yes. However, changing to protocol="application/x-pkcs7-signature" doesn't fix the issue.
If you delete dovecot.index.cache file, it should fix it.
No it doesn't fix. Besides that I'm testing every change by adding new modified file into folder, so I suppose cache is not the issue. If you say it works in 1.2+ it's all I want. -- Aleksander 'A.L.E.C' Machniak LAN Management System Developer [http://lms.org.pl] Roundcube Webmail Developer [http://roundcube.net] --------------------------------------------------- PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
On Thu, 2012-05-10 at 12:20 +0200, A.L.E.C wrote:
On 05/10/2012 12:10 PM, Timo Sirainen wrote:
Yes. However, changing to protocol="application/x-pkcs7-signature" doesn't fix the issue.
If you delete dovecot.index.cache file, it should fix it.
No it doesn't fix. Besides that I'm testing every change by adding new modified file into folder, so I suppose cache is not the issue.
If you say it works in 1.2+ it's all I want.
Well, with quotes it works also in dovecot-1.1 hg, and I don't see why it wouldn't work in v1.1.19 as well:
[tss@hurina] ~/cvs/dovecot-1.1/src/imap% export MAIL=~/Maildir [tss@hurina] ~/cvs/dovecot-1.1/src/imap% rm -f ~/Maildir/dovecot.index.cache;printf "1 select inbox\n2 fetch 1 body\n" | ./imap ..
- 1 FETCH (BODY ("text" "plain" ("charset" "us-ascii") NIL NIL "7bit" 1025 42))
[tss@hurina] ~/cvs/dovecot-1.1/src/imap% perl -i -pe 's,protocol=application/x-pkcs7-signature,protocol="application/x-pkcs7-signature",' ~/Maildir/cur/test.txt [tss@hurina] ~/cvs/dovecot-1.1/src/imap% rm -f ~/Maildir/dovecot.index.cache;printf "1 select inbox\n2 fetch 1 body\n" | ./imap ..
- 1 FETCH (BODY (((("text" "plain" ("charset" "iso-8859-2" "format" "flowed") NIL NIL "quoted-printable" 14 2)("text" "html" ("charset" "iso-8859-2") NIL NIL "quoted-printable" 11 1) "alternative")("application" "pdf" ("name" "Potwierdzenie wykonania przelewu.pdf") NIL NIL "base64" 0) "mixed") "signed"))
On 05/10/2012 12:44 PM, Timo Sirainen wrote:
Well, with quotes it works also in dovecot-1.1 hg, and I don't see why it wouldn't work in v1.1.19 as well:
But you're sure boundary is after protocol? Then it's strange I've got different result. -- Aleksander 'A.L.E.C' Machniak LAN Management System Developer [http://lms.org.pl] Roundcube Webmail Developer [http://roundcube.net] --------------------------------------------------- PGP: 19359DC1 @@ GG: 2275252 @@ WWW: http://alec.pl
On 10.5.2012, at 14.03, A.L.E.C wrote:
On 05/10/2012 12:44 PM, Timo Sirainen wrote:
Well, with quotes it works also in dovecot-1.1 hg, and I don't see why it wouldn't work in v1.1.19 as well:
But you're sure boundary is after protocol?
Yes, it's the mail you sent with the patch (although looks like I had modified it a bit, tried again with the exact same mail and the result is the same).
Then it's strange I've got different result.
Yes. :)
participants (2)
-
A.L.E.C
-
Timo Sirainen