summaryrefslogtreecommitdiff
path: root/mail/mutt-devel/files/patch-smime-recvattach
blob: 92fa0e2df698c4ee7abd4ec0d88002c7342f3948 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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);