David Champion wrote: > > If the signature was checked, I think it would be useful to keep this > > information at the same time the attachment is deleted. > > It looks like I forgot to post part of my thinking: when taking > action that invalidates a signature, we should change the signature > to application/invalidated-pgp-signature or somesuch (and leave the > signature content as-is). Then they can delete the sig if they wish.
Determining the applicable signatures could be... interesting when more than one is involved (e.g. nested forwarded signed emails with attachments). I wonder if the effort is worth it? On the other hand, simply printing a warning that the signature may be invalidated when any attachment is deleted (if the SIGN or PARTSIGN bit is set in the header) seems comparatively easy. The attached patch seems to work. -Kevin
# HG changeset patch # User Kevin McCarthy <[email protected]> # Date 1426196928 25200 # Thu Mar 12 14:48:48 2015 -0700 # Node ID 62855b01272a37d87fa0d340e1b16f6d4d4bf0e0 # Parent 09be71b645a7cd022490325d27c09ae6190ba8c8 Allow attachments from unencrypted emails to be deleted. Print a warning if the message is signed or partly signed. Thanks to David Haguenauer for the original patch! diff --git a/recvattach.c b/recvattach.c --- a/recvattach.c +++ b/recvattach.c @@ -1114,60 +1114,63 @@ if (Context->magic == M_POP) { mutt_flushinp (); mutt_error _("Can't delete attachment from POP server."); break; } #endif - if (WithCrypto && hdr->security & ~PGP_TRADITIONAL_CHECKED) + if (WithCrypto && (hdr->security & ENCRYPT)) { - mutt_message _( - "Deletion of attachments from encrypted messages is unsupported."); - } + mutt_message _( + "Deletion of attachments from encrypted messages is unsupported."); + break; + } + if (WithCrypto && (hdr->security & (SIGN | PARTSIGN))) + { + mutt_message _( + "Deletion of attachments from signed messages may invalidate the signature."); + } + if (!menu->tagprefix) + { + if (idx[menu->current]->parent_type == TYPEMULTIPART) + { + idx[menu->current]->content->deleted = 1; + if (option (OPTRESOLVE) && menu->current < menu->max - 1) + { + menu->current++; + menu->redraw = REDRAW_MOTION_RESYNCH; + } + else + menu->redraw = REDRAW_CURRENT; + } + else + mutt_message _( + "Only deletion of multipart attachments is supported."); + } else { - if (!menu->tagprefix) - { - if (idx[menu->current]->parent_type == TYPEMULTIPART) - { - idx[menu->current]->content->deleted = 1; - if (option (OPTRESOLVE) && menu->current < menu->max - 1) - { - menu->current++; - menu->redraw = REDRAW_MOTION_RESYNCH; - } - else - menu->redraw = REDRAW_CURRENT; - } - else - mutt_message _( - "Only deletion of multipart attachments is supported."); - } - else - { - int x; + int x; - for (x = 0; x < menu->max; x++) - { - if (idx[x]->content->tagged) - { - if (idx[x]->parent_type == TYPEMULTIPART) - { - idx[x]->content->deleted = 1; - menu->redraw = REDRAW_INDEX; - } - else - mutt_message _( - "Only deletion of multipart attachments is supported."); - } - } - } - } + for (x = 0; x < menu->max; x++) + { + if (idx[x]->content->tagged) + { + if (idx[x]->parent_type == TYPEMULTIPART) + { + idx[x]->content->deleted = 1; + menu->redraw = REDRAW_INDEX; + } + else + mutt_message _( + "Only deletion of multipart attachments is supported."); + } + } + } break; case OP_UNDELETE: CHECK_READONLY; if (!menu->tagprefix) { idx[menu->current]->content->deleted = 0; if (option (OPTRESOLVE) && menu->current < menu->max - 1)
signature.asc
Description: PGP signature
