diff options
author | Kevin McCarthy <kevin@8t8.us> | 2018-12-11 14:11:30 -0800 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2018-12-17 13:30:53 -0800 |
commit | cac6705aa51f281f6eba22136f6ce51490c62dff (patch) | |
tree | fda22ce1f6b238407047a5304bfc3bd58dfe8133 /handler.c | |
parent | 09dd4a5d7b69dc688c4a7f3c07b74b66bea7315f (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 'handler.c')
-rw-r--r-- | handler.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -1695,9 +1695,22 @@ static int valid_pgp_encrypted_handler (BODY *b, STATE *s) BODY *octetstream; octetstream = b->parts->next; + + /* clear out any mime headers before the handler, so they can't be + * spoofed. */ + mutt_free_envelope (&b->mime_headers); + mutt_free_envelope (&octetstream->mime_headers); + rc = crypt_pgp_encrypted_handler (octetstream, s); b->goodsig |= octetstream->goodsig; + /* Relocate protected headers onto the multipart/encrypted part */ + if (!rc && octetstream->mime_headers) + { + b->mime_headers = octetstream->mime_headers; + octetstream->mime_headers = NULL; + } + return rc; } @@ -1707,10 +1720,23 @@ static int malformed_pgp_encrypted_handler (BODY *b, STATE *s) BODY *octetstream; octetstream = b->parts->next->next; + + /* clear out any mime headers before the handler, so they can't be + * spoofed. */ + mutt_free_envelope (&b->mime_headers); + mutt_free_envelope (&octetstream->mime_headers); + /* exchange encodes the octet-stream, so re-run it through the decoder */ rc = run_decode_and_handler (octetstream, s, crypt_pgp_encrypted_handler, 0); b->goodsig |= octetstream->goodsig; + /* Relocate protected headers onto the multipart/encrypted part */ + if (!rc && octetstream->mime_headers) + { + b->mime_headers = octetstream->mime_headers; + octetstream->mime_headers = NULL; + } + return rc; } |