While working on another patch, I stumbled across some odd behavior.  If
you postpone a message marked for encryption (but not for signing), when
you resume the message it overwrites PgpSignAs.

I notice that ci_send_message() goes through some effort to back up and
restore PgpSignAs, but still this could be unexpected behavior.

The attached patch "fixes" the problem, but since this seems to be
semi-deliberate I thought I'd ask the list before doing anything about
it.

I'd appreciate if someone familiar with this would chime in.  :-)

thanks,

-Kevin
diff --git a/headers.c b/headers.c
--- a/headers.c
+++ b/headers.c
@@ -185,17 +185,17 @@
          mutt_error (_("%s: unable to attach file"), path);
        }
       }
       keep = 0;
     }
     else if ((WithCrypto & APPLICATION_PGP)
              && ascii_strncasecmp ("pgp:", cur->data, 4) == 0)
     {
-      msg->security = mutt_parse_crypt_hdr (cur->data + 4, 0, APPLICATION_PGP);
+      msg->security = mutt_parse_crypt_hdr (cur->data + 4, 1, APPLICATION_PGP);
       if (msg->security)
        msg->security |= APPLICATION_PGP;
       keep = 0;
     }
 
     if (keep)
     {
       last = &cur->next;
diff --git a/postpone.c b/postpone.c
--- a/postpone.c
+++ b/postpone.c
@@ -506,21 +506,21 @@
 
   /* the cryptalg field must not be empty */
   if ((WithCrypto & APPLICATION_SMIME) && *smime_cryptalg)
     mutt_str_replace (&SmimeCryptAlg, smime_cryptalg);
 
   /* Set {Smime,Pgp}SignAs, if desired. */
 
   if ((WithCrypto & APPLICATION_PGP) && (crypt_app == APPLICATION_PGP)
-      && (set_signas || *sign_as))
+      && set_signas && *sign_as)
     mutt_str_replace (&PgpSignAs, sign_as);
 
   if ((WithCrypto & APPLICATION_SMIME) && (crypt_app == APPLICATION_SMIME)
-      && (set_signas || *sign_as))
+      && set_signas && *sign_as)
     mutt_str_replace (&SmimeDefaultKey, sign_as);
 
   return flags;
 }
 
 
 
 int mutt_prepare_template (FILE *fp, CONTEXT *ctx, HEADER *newhdr, HEADER *hdr,

Attachment: signature.asc
Description: PGP signature

Reply via email to