Re: mutt/2139: messages with base64-encoded CRLF pgp bits can't be read
The following reply was made to PR mutt/2139; it has been noted by GNATS.
From: Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc:
Subject: Re: mutt/2139: messages with base64-encoded CRLF pgp bits can't be read
Date: Tue, 22 Nov 2005 13:13:12 +0100
On 2005-11-21 21:41:36 +0100, asp16@xxxxxxxxx wrote:
> However, I myself was still experiencing the problem for some
> messages. After a bit of investigation, I found out that Mutt was
> failing for base64-encoded messages. For example, this one,
> created by Mutt itself:
> http://people.debian.org/~adeodato/tmp/2005-11-21/base64.mbox
> On further investigation, I saw that it only failed if the result
> of base64-decoding the text contained CRLF. If one takes the
> above message, and recodes the base64 chunk to not contain CRLF,
> it can be opened without problems:
The problem seems to be that mutt's MIME handler doesn't apply
text-mode rules to CRLFs in application/pgp messages, even though it
should. (Another reason why application/pgp is a bad thing in the
first place.)
The following patch should fix this:
--- handler.c 21 Oct 2005 04:35:37 -0000 3.23
+++ handler.c 22 Nov 2005 12:09:55 -0000
@@ -1740,7 +1740,7 @@
void mutt_decode_attachment (BODY *b, STATE *s)
{
- int istext = mutt_is_text_part (b);
+ int istext = mutt_is_text_part (b) || ((WithCrypto & APPLICATION_PGP) &&
mutt_is_application_pgp (b));
iconv_t cd = (iconv_t)(-1);
if (istext && s->flags & M_CHARCONV)
One might be tempted to fix this by changing mutt_is_text_part in
the first place (where application/pgp is currently explicitly
flagged as a non-text part). The reason for not doing this is that
mutt_is_text_part is elsewhere used to control all kinds of
character set related logic that does not apply (or only poorly
applies) to application/pgp. (Yet another reason why
application/pgp is a bad thing in the first place. Did I mention
that already?)
Regards,
--
Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx>