From 59230eb119bd2ceffa14fc887b7ee215e2e3b186 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Thu, 25 Apr 2002 13:23:57 +0000 Subject: [PATCH] Fiy handling of multiparts which have encrypted sub-parts, at least for PGP. --- recvattach.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/recvattach.c b/recvattach.c index 7e210349..55ee4add 100644 --- a/recvattach.c +++ b/recvattach.c @@ -842,6 +842,7 @@ void mutt_view_attachments (HEADER *hdr) #if defined(HAVE_PGP) || defined(HAVE_SMIME) int secured = 0; + int need_secured = 0; #endif @@ -870,6 +871,8 @@ void mutt_view_attachments (HEADER *hdr) #if defined(HAVE_PGP) || defined(HAVE_SMIME) if (hdr->security & ENCRYPT) { + need_secured = 1; + if (!crypt_valid_passphrase(hdr->security)) { mx_close_message (&msg); @@ -890,16 +893,20 @@ void mutt_view_attachments (HEADER *hdr) { if (mutt_is_multipart_encrypted(hdr->content)) secured = !pgp_decrypt_mime (msg->fp, &fp, hdr->content, &cur); + else + need_secured = 0; } #endif - if (!secured) + if (need_secured && !secured) { mx_close_message (&msg); + mutt_error _("Can't decrypt encrypted message!"); return; } } - else + + if (!need_secured) #endif /* HAVE_SMIME || HAVVE_PGP */ { fp = msg->fp; @@ -1152,7 +1159,7 @@ void mutt_view_attachments (HEADER *hdr) #if defined(HAVE_PGP) || defined(HAVE_SMIME) - if (secured) + if (need_secured && secured) { fclose (fp); mutt_free_body (&cur); -- 2.40.0