Kevin J. McCarthy wrote: > Add the same save/restore behavior for SmimeDefaultKey as for PgpSignAs > in ci_send_message().
I was about to push this, when I realized I hadn't completely fixed the problem. The line: > + if ((WithCrypto & APPLICATION_PGP) && pgp_signas) doesn't restore the value if pgp_signas is NULL. This will prevent the value from being restored to empty/<default>, which is important if the postponed email contained a sign_as value. Attached is a revised patch that takes away those null checks. -Kevin
# HG changeset patch # User Kevin McCarthy <[email protected]> # Date 1423076648 28800 # Wed Feb 04 11:04:08 2015 -0800 # Node ID d2f5832a9e6879e11ab633d66f8bc0b606ea99ca # Parent 3f4dc0ce66aed8c47d0e4872db84f8bf88159823 Protect SmimeDefaultKey for postpone/resume. PgpSignAs is saved and restored in ci_send_message(), but SmimeDefaultKey was not. Also, fix a bug where an empty PgpSignAs was not restored back to empty if the postponed email contained a SignAs value. diff --git a/send.c b/send.c --- a/send.c +++ b/send.c @@ -1125,18 +1125,19 @@ BODY *pbody; int i, killfrom = 0; int fcc_error = 0; int free_clear_content = 0; BODY *save_content = NULL; BODY *clear_content = NULL; char *pgpkeylist = NULL; - /* save current value of "pgp_sign_as" */ - char *signas = NULL; + /* save current value of "pgp_sign_as" and "smime_default_key" */ + char *pgp_signas = NULL; + char *smime_default_key = NULL; char *tag = NULL, *err = NULL; char *ctype; int rv = -1; if (!flags && !msg && quadoption (OPT_RECALL) != M_NO && mutt_num_postponed (1)) { @@ -1146,18 +1147,23 @@ if ((i = query_quadoption (OPT_RECALL, _("Recall postponed message?"))) == -1) return rv; if(i == M_YES) flags |= SENDPOSTPONED; } - if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED)) - signas = safe_strdup(PgpSignAs); + if (flags & SENDPOSTPONED) + { + if (WithCrypto & APPLICATION_PGP) + pgp_signas = safe_strdup(PgpSignAs); + if (WithCrypto & APPLICATION_SMIME) + smime_default_key = safe_strdup(SmimeDefaultKey); + } /* Delay expansion of aliases until absolutely necessary--shouldn't * be necessary unless we are prompting the user or about to execute a * send-hook. */ if (!msg) { @@ -1862,22 +1868,27 @@ } } rv = 0; cleanup: - if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED)) + if (flags & SENDPOSTPONED) { - if(signas) + if (WithCrypto & APPLICATION_PGP) { FREE (&PgpSignAs); - PgpSignAs = signas; + PgpSignAs = pgp_signas; + } + if (WithCrypto & APPLICATION_SMIME) + { + FREE (&SmimeDefaultKey); + SmimeDefaultKey = smime_default_key; } } safe_fclose (&tempfp); mutt_free_header (&msg); return rv; }
signature.asc
Description: PGP signature
