]> granicus.if.org Git - mutt/commitdiff
Handle improperly encoded pgp/mime octetstream part.
authorKevin McCarthy <kevin@8t8.us>
Fri, 21 Dec 2018 18:13:17 +0000 (10:13 -0800)
committerKevin McCarthy <kevin@8t8.us>
Fri, 21 Dec 2018 18:13:17 +0000 (10:13 -0800)
Some clients (or even mail servers) improperly encode the octetstream
part.

Thanks to Riccardo Schirone for the original merge request patch.
This commit also handles the attachment menu, and makes the decoding
conditional so it's not done if it isn't necessary.

crypt-gpgme.c
handler.c
pgp.c

index d1cd407e43bd66d984cc40177324174a2a338dea..cb2f248bca5aa113ac9307bf2ba3ad4515d5bd1e 100644 (file)
@@ -2038,7 +2038,12 @@ int pgp_gpgme_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   first_part->warnsig = 0;
 
   if (mutt_is_valid_multipart_pgp_encrypted (b))
+  {
     b = b->parts->next;
+    /* Some clients improperly encode the octetstream part. */
+    if (b->encoding != ENC7BIT)
+      need_decode = 1;
+  }
   else if (mutt_is_malformed_multipart_pgp_encrypted (b))
   {
     b = b->parts->next->next;
index ebcd384f9b689d26daab2324565a8c8775659339..92ce18676ac41c7cda4dede2bc02de23e597a35f 100644 (file)
--- a/handler.c
+++ b/handler.c
@@ -1701,7 +1701,11 @@ static int valid_pgp_encrypted_handler (BODY *b, STATE *s)
   mutt_free_envelope (&b->mime_headers);
   mutt_free_envelope (&octetstream->mime_headers);
 
-  rc = crypt_pgp_encrypted_handler (octetstream, s);
+  /* Some clients improperly encode the octetstream part. */
+  if (octetstream->encoding != ENC7BIT)
+    rc = run_decode_and_handler (octetstream, s, crypt_pgp_encrypted_handler, 0);
+  else
+    rc = crypt_pgp_encrypted_handler (octetstream, s);
   b->goodsig |= octetstream->goodsig;
 
   /* Relocate protected headers onto the multipart/encrypted part */
diff --git a/pgp.c b/pgp.c
index f3ee034f752800738ac141aa0738c4c318d2c344..6224fc3239abd2b01bad012bded202c763e46e8d 100644 (file)
--- a/pgp.c
+++ b/pgp.c
@@ -1044,7 +1044,12 @@ int pgp_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur)
   int rv = 0;
 
   if (mutt_is_valid_multipart_pgp_encrypted (b))
+  {
     b = b->parts->next;
+    /* Some clients improperly encode the octetstream part. */
+    if (b->encoding != ENC7BIT)
+      need_decode = 1;
+  }
   else if (mutt_is_malformed_multipart_pgp_encrypted (b))
   {
     b = b->parts->next->next;