Add the same save/restore behavior for SmimeDefaultKey as for PgpSignAs
in ci_send_message().

-Kevin
# HG changeset patch
# User Kevin McCarthy <[email protected]>
# Date 1422914186 28800
#      Mon Feb 02 13:56:26 2015 -0800
# Node ID 07de948b60c68b9300eba39bc73bd447e72f47e5
# Parent  3f4dc0ce66aed8c47d0e4872db84f8bf88159823
Protect SmimeDefaultKey for postpone/resume.

PgpSignAs is saved and restored in ci_send_message(), but
SmimeDefaultKey was not.

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) && pgp_signas)
     {
       FREE (&PgpSignAs);
-      PgpSignAs = signas;
+      PgpSignAs = pgp_signas;
+    }
+    if ((WithCrypto & APPLICATION_SMIME) && smime_default_key)
+    {
+      FREE (&SmimeDefaultKey);
+      SmimeDefaultKey = smime_default_key;
     }
   }
    
   safe_fclose (&tempfp);
   mutt_free_header (&msg);
   
   return rv;
 }

Attachment: signature.asc
Description: PGP signature

Reply via email to