]> granicus.if.org Git - neomutt/commitdiff
Fix mutt_parse_crypt_hdr() sign_as behavior.
authorKevin McCarthy <kevin@8t8.us>
Mon, 2 Feb 2015 21:25:17 +0000 (13:25 -0800)
committerKevin McCarthy <kevin@8t8.us>
Mon, 2 Feb 2015 21:25:17 +0000 (13:25 -0800)
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
string).

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".

postpone.c

index 801ef1042141d23fb62bc70c0fd1c1191ab4eb5f..f612973157b47e0ac5606cc152b945d4ee92b058 100644 (file)
@@ -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;