summaryrefslogtreecommitdiffstats
path: root/pgp.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2018-12-11 14:11:30 -0800
committerKevin McCarthy <kevin@8t8.us>2018-12-17 13:30:53 -0800
commitcac6705aa51f281f6eba22136f6ce51490c62dff (patch)
treefda22ce1f6b238407047a5304bfc3bd58dfe8133 /pgp.c
parent09dd4a5d7b69dc688c4a7f3c07b74b66bea7315f (diff)
Add protected header received email support.
Add $crypt_protected_headers_read config variable to enable reading and updating the index/header cache. Print protected Subject header in the pager as parts are rendered. Once opened, update the index, subject hash, and header cache.
Diffstat (limited to 'pgp.c')
-rw-r--r--pgp.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/pgp.c b/pgp.c
index d61415fc..f3ee034f 100644
--- a/pgp.c
+++ b/pgp.c
@@ -1132,13 +1132,37 @@ int pgp_encrypted_handler (BODY *a, STATE *s)
if ((tattach = pgp_decrypt_part (a, s, fpout, a)) != NULL)
{
if (s->flags & MUTT_DISPLAY)
+ {
state_attach_puts (_("[-- The following data is PGP/MIME encrypted --]\n\n"), s);
+ mutt_protected_headers_handler (tattach, s);
+ }
+
+ /* Store any protected headers in the parent so they can be
+ * accessed for index updates after the handler recursion is done.
+ * This is done before the handler to prevent a nested encrypted
+ * handler from freeing the headers. */
+ mutt_free_envelope (&a->mime_headers);
+ a->mime_headers = tattach->mime_headers;
+ tattach->mime_headers = NULL;
+
fpin = s->fpin;
s->fpin = fpout;
rc = mutt_body_handler (tattach, s);
s->fpin = fpin;
+ /* Embedded multipart signed protected headers override the
+ * encrypted headers. We need to do this after the handler so
+ * they can be printed in the pager. */
+ if (mutt_is_multipart_signed (tattach) &&
+ tattach->parts &&
+ tattach->parts->mime_headers)
+ {
+ mutt_free_envelope (&a->mime_headers);
+ a->mime_headers = tattach->parts->mime_headers;
+ tattach->parts->mime_headers = NULL;
+ }
+
/*
* if a multipart/signed is the _only_ sub-part of a
* multipart/encrypted, cache signature verification