PGPENCRYPT, PGPKEY, SMIMEENCRYPT, and SMIMEOPAQUE are all combination
flags, with multiple bits set. In a few places these flags were
bitwise-and'ed incorrectly: expecting a non-zero result to indicate
all the bits in the flag were set. Change those to explicitly compare
the result against the original flag.
ch = "P";
else if ((WithCrypto != 0) && (hdr->security & SIGN))
ch = "s";
- else if (((WithCrypto & APPLICATION_PGP) != 0) && (hdr->security & PGPKEY))
+ else if (((WithCrypto & APPLICATION_PGP) != 0) && ((hdr->security & PGPKEY) == PGPKEY))
ch = "K";
else
ch = " ";
case MUTT_PGP_KEY:
if (!(WithCrypto & APPLICATION_PGP))
break;
- return (pat->not ^ ((h->security & APPLICATION_PGP) && (h->security & PGPKEY)));
+ return (pat->not ^ ((h->security & PGPKEY) == PGPKEY));
case MUTT_XLABEL:
if (!h->env)
return 0;
secured = !crypt_smime_decrypt_mime(fp, &new_fp, m, &new_body);
/* S/MIME nesting */
- if ((mutt_is_application_smime(new_body) & SMIMEOPAQUE))
+ if ((mutt_is_application_smime(new_body) & SMIMEOPAQUE) == SMIMEOPAQUE)
{
struct Body *outer_new_body = new_body;
FILE *outer_fp = new_fp;
pgp &= ~PGPENCRYPT;
}
else if (((WithCrypto & APPLICATION_PGP) != 0) &&
- (mutt_is_application_pgp(hdr->content) & PGPENCRYPT))
+ ((mutt_is_application_pgp(hdr->content) & PGPENCRYPT) == PGPENCRYPT))
{
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = MUTT_CM_DECODE | MUTT_CM_CHARCONV;
pgp &= ~PGPENCRYPT;
}
else if (((WithCrypto & APPLICATION_SMIME) != 0) &&
- mutt_is_application_smime(hdr->content) & SMIMEENCRYPT)
+ ((mutt_is_application_smime(hdr->content) & SMIMEENCRYPT) == SMIMEENCRYPT))
{
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = MUTT_CM_DECODE | MUTT_CM_CHARCONV;