<<< Date Index >>>     <<< Thread Index >>>

Re: Problem with extracing attachments from S/MIME mails



On Mon, Aug 30, 2004 at 18:40:58 +0200, Bernhard Walle wrote:
> But: It's simply a bug and it need to be fixed.
> 

Thomas Roessler sent me a patch he already committed to the cvs which solves
the problem for me. I've attached it, perhaps Bernhard can give it a try.
It's also now part of the FreeBSD-port (version mutt-devel-1.5.6_10)

Best regards

--
Udo Schweigert, Siemens AG   | Voice      : +49 89 636 42170
CT IC CERT, Siemens CERT     | Fax        : +49 89 636 41166
D-81730 Muenchen / Germany   | email      : udo.schweigert@xxxxxxxxxxx
diff -u -r3.13 recvattach.c
--- recvattach.c        12 Apr 2004 20:33:33 -0000      3.13
+++ recvattach.c        30 Aug 2004 20:26:30 -0000
@@ -913,18 +913,33 @@
       mx_close_message (&msg);
       return;
     }
-    if ((WithCrypto & APPLICATION_SMIME) && hdr->security & APPLICATION_SMIME)
+    if ((WithCrypto & APPLICATION_SMIME) && (hdr->security & 
APPLICATION_SMIME))
     {
       if (hdr->env)
          crypt_smime_getkeys (hdr->env);
 
       if (mutt_is_application_smime(hdr->content))
+      {
        secured = ! crypt_smime_decrypt_mime (msg->fp, &fp,
                                               hdr->content, &cur);
+       
+       /* S/MIME nesting */
+       if ((mutt_is_application_smime (cur) & SMIMEOPAQUE))
+       {
+         BODY *_cur = cur;
+         FILE *_fp = fp;
+         
+         fp = NULL; cur = NULL;
+         secured = !crypt_smime_decrypt_mime (_fp, &fp, _cur, &cur);
+         
+         mutt_free_body (&_cur);
+         safe_fclose (&_fp);
+       }
+      }
       else
        need_secured = 0;
     }
-    if ((WithCrypto & APPLICATION_PGP) && hdr->security & APPLICATION_PGP)
+    if ((WithCrypto & APPLICATION_PGP) && (hdr->security & APPLICATION_PGP))
     {
       if (mutt_is_multipart_encrypted(hdr->content))
        secured = !crypt_pgp_decrypt_mime (msg->fp, &fp, hdr->content, &cur);