Commit 9ec02bba authored by Kevin J. McCarthy's avatar Kevin J. McCarthy

Fix mutt_parse_crypt_hdr() sign_as behavior.

Currently, if a message is postponed with only the E encryption flag,
when it is resumed, pgp_sign_as will be overwritten (with an empty

This intention of the behavior was probably to restore the exact state
of pgp_sign_as upon resuming.  However, if the message wasn't marked for
signing, the state of pgp_sign_as is not known.  This patch changes the
mutt_parse_crypt_hdr() to only set an empty pgp_sign_as if there is an S
flag (and if set_empty_signas is true).

mutt_edit_headers() also uses the function, but it doesn't want to
overwrite pgp_sign_as with just an S flag.  The set_signas parameter is
renamed to (a hopefully clearer) "set_empty_signas".
parent fe6346e6
......@@ -409,7 +409,7 @@ int mutt_get_postponed (CONTEXT *ctx, HEADER *hdr, HEADER **cur, char *fcc, size
int mutt_parse_crypt_hdr (const char *p, int set_signas, int crypt_app)
int mutt_parse_crypt_hdr (const char *p, int set_empty_signas, int crypt_app)
char smime_cryptalg[LONG_STRING] = "\0";
char sign_as[LONG_STRING] = "\0", *q;
......@@ -511,11 +511,13 @@ int mutt_parse_crypt_hdr (const char *p, int set_signas, int crypt_app)
/* Set {Smime,Pgp}SignAs, if desired. */
if ((WithCrypto & APPLICATION_PGP) && (crypt_app == APPLICATION_PGP)
&& (set_signas || *sign_as))
&& (flags & SIGN)
&& (set_empty_signas || *sign_as))
mutt_str_replace (&PgpSignAs, sign_as);
if ((WithCrypto & APPLICATION_SMIME) && (crypt_app == APPLICATION_SMIME)
&& (set_signas || *sign_as))
&& (flags & SIGN)
&& (set_empty_signas || *sign_as))
mutt_str_replace (&SmimeDefaultKey, sign_as);
return flags;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment