diff options
author | Kevin McCarthy <kevin@8t8.us> | 2020-07-13 12:43:39 -0700 |
---|---|---|
committer | Kevin McCarthy <kevin@8t8.us> | 2020-07-13 18:11:06 -0700 |
commit | 35d63818c53ad20185244075ab0e79328a47b9cb (patch) | |
tree | 5fb9f1ed9ec80d4ea838948bcaaea058ae100ce4 /pgp.c | |
parent | 044903603e2c35f62729c569e8473a6feadc13a1 (diff) |
Improve GPGME inline processing.
Properly deal with multiple blocks:
* Extract the inline block to armored_data, instead of the entire
message. Use the code from pgp.c to find the block boundaries.
* The copy_clearsigned() function, probably originally ported from the
classic code too, assumes the first blank line starts the clear text.
But this is only true if the passed in data is just the block.
* Use the Charset armor header if found for encrypted content
conversion, as pgp.d does.
* Reset all states in each loop.
It looks like the pgp.c code wasn't resetting pgp_keyblock and
gpgcharset, so reset those in pgp.c too.
Diffstat (limited to 'pgp.c')
-rw-r--r-- | pgp.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -442,22 +442,18 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0) { + needpass = 0; clearsign = 0; + pgp_keyblock = 0; could_not_decrypt = 0; decrypt_okay_rc = 0; if (mutt_strcmp ("MESSAGE-----\n", buf + 15) == 0) needpass = 1; else if (mutt_strcmp ("SIGNED MESSAGE-----\n", buf + 15) == 0) - { clearsign = 1; - needpass = 0; - } else if (!mutt_strcmp ("PUBLIC KEY BLOCK-----\n", buf + 15)) - { - needpass = 0; pgp_keyblock = 1; - } else { /* XXX - we may wish to recode here */ @@ -657,6 +653,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) mutt_unlink (mutt_b2s (tmpfname)); safe_fclose (&pgpout); safe_fclose (&pgperr); + FREE (&gpgcharset); if (s->flags & MUTT_DISPLAY) { |