Andreas Krennmair:
[apps/madmutt.git] / recvattach.c
index db4b5fd..aaba8b8 100644 (file)
@@ -861,7 +861,7 @@ mutt_attach_display_loop (MUTTMENU *menu, int op, FILE *fp, HEADER *hdr,
         break;
       /* functions which are passed through from the pager */
       case OP_CHECK_TRADITIONAL:
-        if (!(WithCrypto & APPLICATION_PGP))
+        if (!(WithCrypto & APPLICATION_PGP) || (hdr && hdr->security & PGP_TRADITIONAL_CHECKED))
         {
           op = OP_NULL;
           break;
@@ -958,18 +958,33 @@ void mutt_view_attachments (HEADER *hdr)
       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);