BUILT_SOURCES = keymap_defs.h version.h
-bin_PROGRAMS = muttng muttng_dotlock pgpringng pgpewrapng @SMIMEAUX_TARGET@
+bin_PROGRAMS = muttng muttng_dotlock pgpringng pgpewrapng smime_keysng
muttng_SOURCES = $(BUILT_SOURCES) \
alias.c attach.c base64.c browser.c buffy.c \
charset.c color.c compress.c crypt.c cryptglue.c commands.c complete.c \
thread.c url.c utf8.c wcwidth.c \
\
pgp.c pgpinvoke.c pgpkey.c pgplib.c gnupgparse.c pgpmicalg.c pgppacket.c \
- crypt-mod-pgp-classic.c
+ crypt-mod-pgp-classic.c smime.c crypt-mod-smime-classic.c
muttng_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(LIBPOP) $(LIBNNTP) \
EXTRA_muttng_SOURCES = \
account.c mutt_sasl.c mutt_socket.c mutt_ssl.c \
- mutt_tunnel.c smime.c pgp.c pgpinvoke.c pgpkey.c \
+ mutt_tunnel.c pgp.c pgpinvoke.c pgpkey.c \
pgplib.c pgpmicalg.c gnupgparse.c resize.c dotlock.c remailer.c \
alias.h browser.h enter.h \
mbyte.h remailer.h url.h state.h \
- pgppacket.c mutt_idna.h mutt_libesmtp.c \
- crypt-mod-pgp-classic.c crypt-mod-smime-classic.c \
- sidebar.h state.h
+ mutt_idna.h mutt_libesmtp.c sidebar.h state.h
EXTRA_DIST = config.rpath COPYRIGHT GPL OPS OPS.PGP OPS.CRYPT OPS.SMIME TODO \
configure acconfig.h \
int unlink_tempfile = 0;
is_message = mutt_is_message_type (a->type, a->subtype);
- if (WithCrypto && is_message && a->hdr && (a->hdr->security & ENCRYPT) &&
+ if (is_message && a->hdr && (a->hdr->security & ENCRYPT) &&
!crypt_valid_passphrase (a->hdr->security))
return (rc);
use_mailcap = (flag == M_MAILCAP ||
if (res != -1) {
/* see if crytpo is needed for this message. if so, we should exit curses */
- if (WithCrypto && cur->security) {
+ if (cur->security) {
if (cur->security & ENCRYPT) {
if (cur->security & APPLICATION_SMIME)
crypt_smime_getkeys (cur->env);
safe_fclose (&fpfilterout); /* XXX - check result? */
- if (WithCrypto) {
- /* update crypto information for this message */
- cur->security &= ~(GOODSIGN|BADSIGN);
- cur->security |= crypt_query (cur->content);
+ /* update crypto information for this message */
+ cur->security &= ~(GOODSIGN|BADSIGN);
+ cur->security |= crypt_query (cur->content);
- /* Remove color cache for this message, in case there
- are color patterns for both ~g and ~V */
- cur->pair = 0;
- }
+ /* Remove color cache for this message, in case there
+ are color patterns for both ~g and ~V */
+ cur->pair = 0;
if (builtin) {
pager_t info;
- if (WithCrypto
- && (cur->security & APPLICATION_SMIME) && (cmflags & M_CM_VERIFY)) {
+ if ((cur->security & APPLICATION_SMIME) && (cmflags & M_CM_VERIFY)) {
if (cur->security & GOODSIGN) {
if (!crypt_smime_verify_sender (cur))
mutt_message (_("S/MIME signature successfully verified."));
mutt_error (_("S/MIME signature could NOT be verified."));
}
- if (WithCrypto
- && (cur->security & APPLICATION_PGP) && (cmflags & M_CM_VERIFY)) {
+ if ((cur->security & APPLICATION_PGP) && (cmflags & M_CM_VERIFY)) {
if (cur->security & GOODSIGN)
mutt_message (_("PGP signature successfully verified."));
else if (cur->security & PARTSIGN)
pipe_set_flags (decode, print, &cmflags, &chflags);
- if (WithCrypto && decode && h->security & ENCRYPT) {
+ if (decode && h->security & ENCRYPT) {
if (!crypt_valid_passphrase (h->security))
return;
endwin ();
mutt_message_hook (Context, h, M_MESSAGEHOOK);
- if (WithCrypto && decode) {
+ if (decode) {
mutt_parse_mime_message (Context, h);
if (h->security & ENCRYPT && !crypt_valid_passphrase (h->security))
return 1;
}
else { /* handle tagged messages */
- if (WithCrypto && decode) {
+ if (decode) {
for (i = 0; i < Context->vcount; i++)
if (Context->hdrs[Context->v2r[i]]->tagged) {
mutt_message_hook (Context, Context->hdrs[Context->v2r[i]],
*cmflags = 0;
*chflags = CH_UPDATE_LEN;
- if (WithCrypto && !decode && decrypt && (hdr->security & ENCRYPT)) {
- if ((WithCrypto & APPLICATION_PGP)
- && mutt_is_multipart_encrypted (hdr->content)) {
+ if (!decode && decrypt && (hdr->security & ENCRYPT)) {
+ if (mutt_is_multipart_encrypted (hdr->content)) {
*chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
*cmflags = M_CM_DECODE_PGP;
}
- else if ((WithCrypto & APPLICATION_PGP)
- && mutt_is_application_pgp (hdr->content) & ENCRYPT)
+ else if (mutt_is_application_pgp (hdr->content) & ENCRYPT)
decode = 1;
- else if ((WithCrypto & APPLICATION_SMIME)
- && mutt_is_application_smime (hdr->content) & ENCRYPT) {
+ else if (mutt_is_application_smime (hdr->content) & ENCRYPT) {
*chflags = CH_NONEWLINE | CH_XMIT | CH_MIME;
*cmflags = M_CM_DECODE_SMIME;
}
if (h) {
- if (WithCrypto) {
- need_passphrase = h->security & ENCRYPT;
- app = h->security;
- }
+ need_passphrase = h->security & ENCRYPT;
+ app = h->security;
mutt_message_hook (Context, h, M_MESSAGEHOOK);
mutt_default_save (buf, sizeof (buf), h);
}
if (h) {
mutt_message_hook (Context, h, M_MESSAGEHOOK);
mutt_default_save (buf, sizeof (buf), h);
- if (WithCrypto) {
- need_passphrase = h->security & ENCRYPT;
- app = h->security;
- }
+ need_passphrase = h->security & ENCRYPT;
+ app = h->security;
h = NULL;
}
}
if (mutt_save_confirm (buf, &st) != 0)
return -1;
- if (WithCrypto && need_passphrase && (decode || decrypt)
+ if (need_passphrase && (decode || decrypt)
&& !crypt_valid_passphrase (app))
return -1;
if (fp && (is_multipart (b) || mutt_is_message_type (b->type, b->subtype)))
mutt_parse_part (fp, b);
- if (WithCrypto && h) {
+ if (h) {
if (h->content == b)
h->security = 0;
{
int off = 0;
- if ((WithCrypto & APPLICATION_PGP) && (WithCrypto & APPLICATION_SMIME)) {
- if (!msg->security)
- mvaddstr (HDR_CRYPT, SW, " Security: ");
- else if (msg->security & APPLICATION_SMIME)
- mvaddstr (HDR_CRYPT, SW, " S/MIME: ");
- else if (msg->security & APPLICATION_PGP)
- mvaddstr (HDR_CRYPT, SW, " PGP: ");
- }
- else if ((WithCrypto & APPLICATION_SMIME))
+ if (!msg->security)
+ mvaddstr (HDR_CRYPT, SW, " Security: ");
+ else if (msg->security & APPLICATION_SMIME)
mvaddstr (HDR_CRYPT, SW, " S/MIME: ");
- else if ((WithCrypto & APPLICATION_PGP))
+ else if (msg->security & APPLICATION_PGP)
mvaddstr (HDR_CRYPT, SW, " PGP: ");
- else
- return;
if ((msg->security & (ENCRYPT | SIGN)) == (ENCRYPT | SIGN))
addstr (_("Sign, Encrypt"));
else
addstr (_("Clear"));
- if ((WithCrypto & APPLICATION_PGP))
- if ((msg->security & APPLICATION_PGP)
- && (msg->security & (ENCRYPT | SIGN))) {
- if ((msg->security & INLINE))
- addstr (_(" (inline)"));
- else
- addstr (_(" (PGP/MIME)"));
- }
+ if ((msg->security & APPLICATION_PGP)
+ && (msg->security & (ENCRYPT | SIGN))) {
+ if ((msg->security & INLINE))
+ addstr (_(" (inline)"));
+ else
+ addstr (_(" (PGP/MIME)"));
+ }
clrtoeol ();
move (HDR_CRYPTINFO, SW);
clrtoeol ();
- if ((WithCrypto & APPLICATION_PGP)
- && msg->security & APPLICATION_PGP && msg->security & SIGN)
+ if (msg->security & APPLICATION_PGP && msg->security & SIGN)
printw ("%s%s", _(" sign as: "),
PgpSignAs ? PgpSignAs : _("<default>"));
- if ((WithCrypto & APPLICATION_SMIME)
- && msg->security & APPLICATION_SMIME && msg->security & SIGN) {
+ if (msg->security & APPLICATION_SMIME && msg->security & SIGN) {
printw ("%s%s", _(" sign as: "),
SmimeDefaultKey ? SmimeDefaultKey : _("<default>"));
}
- if ((WithCrypto & APPLICATION_SMIME)
- && (msg->security & APPLICATION_SMIME)
+ if ((msg->security & APPLICATION_SMIME)
&& (msg->security & ENCRYPT)
&& SmimeCryptAlg && *SmimeCryptAlg) {
mvprintw (HDR_CRYPTINFO, SW + 40, "%s%s", _("Encrypt with: "),
mvprintw (HDR_FCC, SW, TITLE_FMT, Prompts[HDR_FCC - 1]);
mutt_paddstr (W, fcc);
- if (WithCrypto)
- redraw_crypt_lines (msg);
+ redraw_crypt_lines (msg);
#ifdef MIXMASTER
redraw_mix_line (msg->chain);
case OP_COMPOSE_ATTACH_KEY:
- if (!(WithCrypto & APPLICATION_PGP))
- break;
if (idxlen == idxmax) {
p_realloc(&idx, idxmax += 5);
menu->data = idx;
case OP_COMPOSE_PGP_MENU:
- if (!(WithCrypto & APPLICATION_PGP))
- break;
- if ((WithCrypto & APPLICATION_SMIME)
- && msg->security & APPLICATION_SMIME) {
+ if (msg->security & APPLICATION_SMIME) {
if (mutt_yesorno (_("S/MIME already selected. Clear & continue ? "),
M_YES) != M_YES) {
mutt_clear_error ();
case OP_COMPOSE_SMIME_MENU:
- if (!(WithCrypto & APPLICATION_SMIME))
- break;
-
- if ((WithCrypto & APPLICATION_PGP)
- && msg->security & APPLICATION_PGP) {
+ if (msg->security & APPLICATION_PGP) {
if (mutt_yesorno (_("PGP already selected. Clear & continue ? "),
M_YES) != M_YES) {
mutt_clear_error ();
AC_SUBST(LIBGPGME_CFLAGS)
AC_SUBST(LIBGPGME_LIBS)
-
-dnl ---------------- pgp/smime ----------------
-
- AC_ARG_ENABLE(smime, AC_HELP_STRING([--disable-smime], [Disable SMIME support]),
- [ if test x$enableval = xno ; then
- have_smime=no
- fi
- ])
-
- if test x$have_smime != xno ; then
- AC_DEFINE(CRYPT_BACKEND_CLASSIC_SMIME,1, [ Define if you want clasic S/MIME support. ])
- MUTT_LIB_OBJECTS="$MUTT_LIB_OBJECTS smime.o crypt-mod-smime-classic.o"
- SMIMEAUX_TARGET="smime_keysng"
- fi
-
-
dnl ---------------- mixmaster ----------------
AC_ARG_WITH(mixmaster, AC_HELP_STRING([--with-mixmaster[=PATH]], [Include Mixmaster support]),
OPS="$OPS \$(srcdir)/OPS.PGP \$(srcdir)/OPS.SMIME \$(srcdir)/OPS.CRYPT "
AC_SUBST([OPS])
-
-AC_SUBST(SMIMEAUX_TARGET)
-
AC_PATH_PROG(ISPELL, ispell, no)
if test $ISPELL != no; then
AC_DEFINE_UNQUOTED(ISPELL,"$ISPELL",[ Where to find ispell on your system. ])
if (flags & M_CM_REPLYING)
s.flags |= M_REPLYING;
- if (WithCrypto && flags & M_CM_VERIFY)
+ if (flags & M_CM_VERIFY)
s.flags |= M_VERIFY;
rc = mutt_body_handler (body, &s);
}
- else if (WithCrypto
- && (flags & M_CM_DECODE_CRYPT) && (hdr->security & ENCRYPT)) {
+ else if ((flags & M_CM_DECODE_CRYPT) && (hdr->security & ENCRYPT)) {
BODY *cur;
FILE *fp;
- if ((WithCrypto & APPLICATION_PGP)
- && (flags & M_CM_DECODE_PGP) && (hdr->security & APPLICATION_PGP) &&
+ if ((flags & M_CM_DECODE_PGP) && (hdr->security & APPLICATION_PGP) &&
hdr->content->type == TYPEMULTIPART) {
if (crypt_pgp_decrypt_mime (fpin, &fp, hdr->content, &cur))
return (-1);
fputs ("MIME-Version: 1.0\n", fpout);
}
- if ((WithCrypto & APPLICATION_SMIME)
- && (flags & M_CM_DECODE_SMIME) && (hdr->security & APPLICATION_SMIME)
+ if ((flags & M_CM_DECODE_SMIME) && (hdr->security & APPLICATION_SMIME)
&& hdr->content->type == TYPEAPPLICATION) {
if (crypt_smime_decrypt_mime (fpin, &fp, hdr->content, &cur))
return (-1);
#include "mutt.h"
#include "mutt_crypt.h"
-#define CRYPTO_SUPPORT(identifier) (WithCrypto & APPLICATION_ ## identifier)
-
-
/*
Type defintions for crypto module functions.
*/
time_t t;
char p[STRING], tmp[STRING];
- if (!WithCrypto)
- return;
-
if (option (OPTCRYPTTIMESTAMP)) {
t = time (NULL);
setlocale (LC_TIME, "");
void crypt_forget_passphrase (void)
{
- if ((WithCrypto & APPLICATION_PGP))
crypt_pgp_void_passphrase ();
-
- if ((WithCrypto & APPLICATION_SMIME))
crypt_smime_void_passphrase ();
-
- if (WithCrypto)
mutt_message _("Passphrase(s) forgotten.");
}
disable_coredumps ();
# endif
- if ((WithCrypto & APPLICATION_PGP) && (flags & APPLICATION_PGP))
+ if (flags & APPLICATION_PGP)
ret = crypt_pgp_valid_passphrase ();
- if ((WithCrypto & APPLICATION_SMIME) && (flags & APPLICATION_SMIME))
+ if (flags & APPLICATION_SMIME)
ret = crypt_smime_valid_passphrase ();
return ret;
BODY *pbody = NULL, *tmp_pbody = NULL;
BODY *tmp_smime_pbody = NULL;
BODY *tmp_pgp_pbody = NULL;
- int flags = (WithCrypto & APPLICATION_PGP) ? msg->security : 0;
+ int flags = msg->security;
int i;
- if (!WithCrypto)
- return -1;
-
if ((msg->security & SIGN) && !crypt_valid_passphrase (msg->security))
return (-1);
- if ((WithCrypto & APPLICATION_PGP)
- && ((msg->security & PGPINLINE) == PGPINLINE)) {
+ if ((msg->security & PGPINLINE) == PGPINLINE) {
/* they really want to send it inline... go for it */
if (!isendwin ())
mutt_endwin _("Invoking PGP...");
if (!isendwin ())
mutt_endwin (NULL);
- if ((WithCrypto & APPLICATION_SMIME))
- tmp_smime_pbody = msg->content;
- if ((WithCrypto & APPLICATION_PGP))
- tmp_pgp_pbody = msg->content;
+ tmp_smime_pbody = msg->content;
+ tmp_pgp_pbody = msg->content;
if (msg->security & SIGN) {
- if ((WithCrypto & APPLICATION_SMIME)
- && (msg->security & APPLICATION_SMIME)) {
+ if (msg->security & APPLICATION_SMIME) {
if (!(tmp_pbody = crypt_smime_sign_message (msg->content)))
return -1;
pbody = tmp_smime_pbody = tmp_pbody;
}
- if ((WithCrypto & APPLICATION_PGP)
- && (msg->security & APPLICATION_PGP)
+ if ((msg->security & APPLICATION_PGP)
&& (!(flags & ENCRYPT) || option (OPTPGPRETAINABLESIG))) {
if (!(tmp_pbody = crypt_pgp_sign_message (msg->content)))
return -1;
pbody = tmp_pgp_pbody = tmp_pbody;
}
- if (WithCrypto && (msg->security & APPLICATION_SMIME)
+ if ((msg->security & APPLICATION_SMIME)
&& (msg->security & APPLICATION_PGP)) {
/* here comes the draft ;-) */
}
if (msg->security & ENCRYPT) {
- if ((WithCrypto & APPLICATION_SMIME)
- && (msg->security & APPLICATION_SMIME)) {
+ if ((msg->security & APPLICATION_SMIME)) {
if (!(tmp_pbody = crypt_smime_build_smime_entity (tmp_smime_pbody,
keylist))) {
/* signed ? free it! */
pbody = tmp_pbody;
}
- if ((WithCrypto & APPLICATION_PGP)
- && (msg->security & APPLICATION_PGP)) {
+ if ((msg->security & APPLICATION_PGP)) {
if (!(pbody = crypt_pgp_encrypt_message (tmp_pgp_pbody, keylist,
flags & SIGN))) {
if (!(ascii_strcasecmp (p, "multipart/mixed")))
return SIGN;
- if ((WithCrypto & APPLICATION_PGP)
- && !(ascii_strcasecmp (p, "application/pgp-signature")))
+ if (!(ascii_strcasecmp (p, "application/pgp-signature")))
return PGPSIGN;
- if ((WithCrypto & APPLICATION_SMIME)
- && !(ascii_strcasecmp (p, "application/x-pkcs7-signature")))
+ if (!(ascii_strcasecmp (p, "application/x-pkcs7-signature")))
return SMIMESIGN;
- if ((WithCrypto & APPLICATION_SMIME)
- && !(ascii_strcasecmp (p, "application/pkcs7-signature")))
+ if (!(ascii_strcasecmp (p, "application/pkcs7-signature")))
return SMIMESIGN;
return 0;
int mutt_is_multipart_encrypted (BODY * b)
{
- if ((WithCrypto & APPLICATION_PGP)) {
- char *p;
-
- if (!b || b->type != TYPEMULTIPART ||
- !b->subtype || ascii_strcasecmp (b->subtype, "encrypted") ||
- !(p = mutt_get_parameter ("protocol", b->parameter)) ||
- ascii_strcasecmp (p, "application/pgp-encrypted"))
- return 0;
+ char *p;
- return PGPENCRYPT;
- }
+ if (!b || b->type != TYPEMULTIPART ||
+ !b->subtype || ascii_strcasecmp (b->subtype, "encrypted") ||
+ !(p = mutt_get_parameter ("protocol", b->parameter)) ||
+ ascii_strcasecmp (p, "application/pgp-encrypted"))
+ return 0;
- return 0;
+ return PGPENCRYPT;
}
{
int t = 0;
- if (!WithCrypto)
- return 0;
-
if (!m)
return 0;
if (m->type == TYPEAPPLICATION) {
- if ((WithCrypto & APPLICATION_PGP))
- t |= mutt_is_application_pgp (m);
-
- if ((WithCrypto & APPLICATION_SMIME)) {
- t |= mutt_is_application_smime (m);
- if (t && m->goodsig)
- t |= GOODSIGN;
- if (t && m->badsig)
- t |= BADSIGN;
- }
+ t |= mutt_is_application_pgp (m);
+
+ t |= mutt_is_application_smime (m);
+ if (t && m->goodsig)
+ t |= GOODSIGN;
+ if (t && m->badsig)
+ t |= BADSIGN;
}
- else if ((WithCrypto & APPLICATION_PGP) && m->type == TYPETEXT) {
+ else if (m->type == TYPETEXT) {
t |= mutt_is_application_pgp (m);
if (t && m->goodsig)
t |= GOODSIGN;
short hadcr;
size_t bytes;
- if (!WithCrypto)
- return -1;
-
if (!(fp = safe_fopen (tempfile, "w"))) {
mutt_perror (tempfile);
return -1;
void convert_to_7bit (BODY * a)
{
- if (!WithCrypto)
- return;
-
while (a) {
if (a->type == TYPEMULTIPART) {
if (a->encoding != ENC7BIT) {
a->encoding = ENC7BIT;
convert_to_7bit (a->parts);
}
- else if ((WithCrypto & APPLICATION_PGP) && option (OPTPGPSTRICTENC))
+ else if (option (OPTPGPSTRICTENC))
convert_to_7bit (a->parts);
}
else if (a->type == TYPEMESSAGE &&
address_t *tmp = NULL;
FILE *fpout;
- if (!WithCrypto)
- return;
-
mutt_mktemp (tempfname);
if (!(fpout = safe_fopen (tempfname, "w"))) {
mutt_perror (tempfname);
return;
}
- if ((WithCrypto & APPLICATION_PGP))
- set_option (OPTDONTHANDLEPGPKEYS);
+ set_option (OPTDONTHANDLEPGPKEYS);
if (!h) {
for (i = 0; i < Context->vcount; i++) {
break;
}
- if ((WithCrypto & APPLICATION_PGP)
- && (Context->hdrs[Context->v2r[i]]->security & APPLICATION_PGP)) {
+ if (Context->hdrs[Context->v2r[i]]->security & APPLICATION_PGP) {
mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
M_CM_DECODE | M_CM_CHARCONV, 0);
fflush (fpout);
crypt_pgp_invoke_import (tempfname);
}
- if ((WithCrypto & APPLICATION_SMIME)
- && (Context->hdrs[Context->v2r[i]]->security & APPLICATION_SMIME)) {
+ if (Context->hdrs[Context->v2r[i]]->security & APPLICATION_SMIME) {
if (Context->hdrs[Context->v2r[i]]->security & ENCRYPT)
mutt_copy_message (fpout, Context, Context->hdrs[Context->v2r[i]],
M_CM_NOHEADER | M_CM_DECODE_CRYPT
else {
mutt_parse_mime_message (Context, h);
if (!(h->security & ENCRYPT && !crypt_valid_passphrase (h->security))) {
- if ((WithCrypto & APPLICATION_PGP)
- && (h->security & APPLICATION_PGP)) {
+ if (h->security & APPLICATION_PGP) {
mutt_copy_message (fpout, Context, h, M_CM_DECODE | M_CM_CHARCONV, 0);
fflush (fpout);
mutt_endwin (_("Trying to extract PGP keys...\n"));
crypt_pgp_invoke_import (tempfname);
}
- if ((WithCrypto & APPLICATION_SMIME)
- && (h->security & APPLICATION_SMIME)) {
+ if (h->security & APPLICATION_SMIME) {
if (h->security & ENCRYPT)
mutt_copy_message (fpout, Context, h, M_CM_NOHEADER
| M_CM_DECODE_CRYPT | M_CM_DECODE_SMIME, 0);
mutt_unlink (tempfname);
- if ((WithCrypto & APPLICATION_PGP))
- unset_option (OPTDONTHANDLEPGPKEYS);
+ unset_option (OPTDONTHANDLEPGPKEYS);
}
* keys if the user has requested this service.
*/
- if (!WithCrypto)
- return 0;
-
- if ((WithCrypto & APPLICATION_PGP))
- set_option (OPTPGPCHECKTRUST);
+ set_option (OPTPGPCHECKTRUST);
*keylist = NULL;
if (msg->security & ENCRYPT) {
- if ((WithCrypto & APPLICATION_PGP)
- && (msg->security & APPLICATION_PGP)) {
+ if (msg->security & APPLICATION_PGP) {
if ((*keylist = crypt_pgp_findkeys (msg->env->to, msg->env->cc,
msg->env->bcc)) == NULL)
return (-1);
unset_option (OPTPGPCHECKTRUST);
}
- if ((WithCrypto & APPLICATION_SMIME)
- && (msg->security & APPLICATION_SMIME)) {
+ if (msg->security & APPLICATION_SMIME) {
if ((*keylist = crypt_smime_findkeys (msg->env->to, msg->env->cc,
msg->env->bcc)) == NULL)
return (-1);
static void crypt_fetch_signatures (BODY ***signatures, BODY * a, int *n)
{
- if (!WithCrypto)
- return;
-
for (; a; a = a->next) {
if (a->type == TYPEMULTIPART)
crypt_fetch_signatures (signatures, a->parts, n);
short goodsig = 1;
int rc = 0;
- if (!WithCrypto)
- return (-1);
-
protocol = mutt_get_parameter ("protocol", a->parameter);
a = a->parts;
}
- if ((WithCrypto & APPLICATION_PGP)
- && protocol_major == TYPEAPPLICATION
+ if (protocol_major == TYPEAPPLICATION
&& !m_strcasecmp(protocol_minor, "pgp-signature"));
- else if ((WithCrypto & APPLICATION_SMIME)
- && protocol_major == TYPEAPPLICATION
+ else if (protocol_major == TYPEAPPLICATION
&& !(m_strcasecmp(protocol_minor, "x-pkcs7-signature")
&& m_strcasecmp(protocol_minor, "pkcs7-signature")));
else if (protocol_major == TYPEMULTIPART
mutt_mktemp (tempfile);
if (crypt_write_signed (a, s, tempfile) == 0) {
for (i = 0; i < sigcnt; i++) {
- if ((WithCrypto & APPLICATION_PGP)
- && signatures[i]->type == TYPEAPPLICATION
+ if (signatures[i]->type == TYPEAPPLICATION
&& !m_strcasecmp(signatures[i]->subtype, "pgp-signature")) {
if (crypt_pgp_verify_one (signatures[i], s, tempfile) != 0)
goodsig = 0;
continue;
}
- if ((WithCrypto & APPLICATION_SMIME)
- && signatures[i]->type == TYPEAPPLICATION
- &&
- (!m_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature")
- || !m_strcasecmp(signatures[i]->subtype,
- "pkcs7-signature"))) {
+ if (signatures[i]->type == TYPEAPPLICATION
+ && (!m_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature")
+ || !m_strcasecmp(signatures[i]->subtype, "pkcs7-signature")))
+ {
if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0)
goodsig = 0;
*/
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
extern struct crypt_module_specs crypt_mod_pgp_classic;
-#endif
-
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
extern struct crypt_module_specs crypt_mod_smime_classic;
-#endif
#ifdef CRYPT_BACKEND_GPGME
extern struct crypt_module_specs crypt_mod_pgp_gpgme;
void crypt_init (void)
{
-#ifdef CRYPT_BACKEND_CLASSIC_PGP
if (
#ifdef CRYPT_BACKEND_GPGME
(!option (OPTCRYPTUSEGPGME))
#endif
)
crypto_module_register (&crypt_mod_pgp_classic);
-#endif
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
if (
#ifdef CRYPT_BACKEND_GPGME
(!option (OPTCRYPTUSEGPGME))
#endif
)
crypto_module_register (&crypt_mod_smime_classic);
-#endif
if (option (OPTCRYPTUSEGPGME)) {
#ifdef CRYPT_BACKEND_GPGME
/* Show a message that a backend will be invoked. */
void crypt_invoke_message (int type)
{
- if ((WithCrypto & APPLICATION_PGP) && (type & APPLICATION_PGP)) {
+ if (type & APPLICATION_PGP) {
mutt_message _("Invoking PGP...");
}
- else if ((WithCrypto & APPLICATION_SMIME) && (type & APPLICATION_SMIME)) {
+ else if (type & APPLICATION_SMIME) {
mutt_message _("Invoking S/MIME...");
}
}
case OP_DECRYPT_COPY:
case OP_DECRYPT_SAVE:
- if (!WithCrypto)
- break;
- /* fall thru */
case OP_COPY_MESSAGE:
case OP_SAVE:
case OP_DECODE_COPY:
break;
case OP_MAIL_KEY:
- if (!(WithCrypto & APPLICATION_PGP))
- break;
CHECK_ATTACH;
ci_send_message (SENDKEY, NULL, NULL, NULL, NULL);
menu->redraw = REDRAW_FULL;
case OP_EXTRACT_KEYS:
- if (!WithCrypto)
- break;
CHECK_MSGCOUNT;
CHECK_VISIBLE;
crypt_extract_keys_from_messages (tag ? NULL : CURHDR);
case OP_CHECK_TRADITIONAL:
- if (!(WithCrypto & APPLICATION_PGP))
- break;
CHECK_MSGCOUNT;
CHECK_VISIBLE;
if (tag || !(CURHDR->security & PGP_TRADITIONAL_CHECKED))
else if (a->type == TYPEMULTIPART) {
BODY *p;
- if (WithCrypto) {
- if (ascii_strcasecmp (a->subtype, "signed") == 0 ||
- ascii_strcasecmp (a->subtype, "encrypted") == 0)
- return (1);
- }
+ if (ascii_strcasecmp (a->subtype, "signed") == 0 ||
+ ascii_strcasecmp (a->subtype, "encrypted") == 0)
+ return (1);
for (p = a->parts; p; p = p->next) {
if (mutt_can_decode (p))
}
}
- else if (WithCrypto && a->type == TYPEAPPLICATION) {
- if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (a))
+ else if (a->type == TYPEAPPLICATION) {
+ if (mutt_is_application_pgp(a))
return (1);
- if ((WithCrypto & APPLICATION_SMIME) && mutt_is_application_smime (a))
+ if (mutt_is_application_smime (a))
return (1);
}
fseeko (s->fpin, b->offset, 0);
switch (b->encoding) {
case ENCQUOTEDPRINTABLE:
- mutt_decode_quoted (s, b->length, istext ||
- ((WithCrypto & APPLICATION_PGP) &&
- mutt_is_application_pgp (b)), cd);
+ mutt_decode_quoted(s, b->length,
+ istext || mutt_is_application_pgp(b), cd);
break;
case ENCBASE64:
- mutt_decode_base64 (s, b->length, istext ||
- ((WithCrypto & APPLICATION_PGP) &&
- mutt_is_application_pgp (b)), cd);
+ mutt_decode_base64(s, b->length,
+ istext || mutt_is_application_pgp(b), cd);
break;
case ENCUUENCODED:
- mutt_decode_uuencoded (s, b->length, istext
- || ((WithCrypto & APPLICATION_PGP) &&
- mutt_is_application_pgp (b)), cd);
+ mutt_decode_uuencoded(s, b->length,
+ istext || mutt_is_application_pgp(b), cd);
break;
default:
- mutt_decode_xbit (s, b->length, istext
- || ((WithCrypto & APPLICATION_PGP) &&
- mutt_is_application_pgp (b)), cd);
+ mutt_decode_xbit(s, b->length,
+ istext || mutt_is_application_pgp(b), cd);
break;
}
/* avoid copying this part twice since removing the transfer-encoding is
* the only operation needed.
*/
- if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
+ if (mutt_is_application_pgp (b))
handler = crypt_pgp_application_pgp_handler;
else
if (ascii_strcasecmp
if (ascii_strcasecmp ("alternative", b->subtype) == 0)
handler = alternative_handler;
- else if (WithCrypto && ascii_strcasecmp ("signed", b->subtype) == 0) {
+ else if (ascii_strcasecmp ("signed", b->subtype) == 0) {
p = mutt_get_parameter ("protocol", b->parameter);
if (!p)
else if (s->flags & M_VERIFY)
handler = mutt_signed_handler;
}
- else if ((WithCrypto & APPLICATION_PGP)
- && m_strcasecmp("encrypted", b->subtype) == 0) {
+ else if (m_strcasecmp("encrypted", b->subtype) == 0) {
p = mutt_get_parameter ("protocol", b->parameter);
if (!p)
if (!handler)
handler = multipart_handler;
}
- else if (WithCrypto && b->type == TYPEAPPLICATION) {
- if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
+ else if (b->type == TYPEAPPLICATION) {
+ if (mutt_is_application_pgp (b))
handler = crypt_pgp_application_pgp_handler;
- if ((WithCrypto & APPLICATION_SMIME) && mutt_is_application_smime (b))
+ if (mutt_is_application_smime (b))
handler = crypt_smime_application_smime_handler;
}
/* The recursion allows messages without depth to return 0. */
if (optional)
optional = count != 0;
-
+
snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
snprintf (dest, destlen, fmt, count);
}
ch = ' ';
- if (WithCrypto && hdr->security & GOODSIGN)
+ if (hdr->security & GOODSIGN)
ch = 'S';
- else if (WithCrypto && hdr->security & ENCRYPT)
+ else if (hdr->security & ENCRYPT)
ch = 'P';
- else if (WithCrypto && hdr->security & SIGN)
+ else if (hdr->security & SIGN)
ch = 's';
- else if ((WithCrypto & APPLICATION_PGP) && hdr->security & PGPKEY)
+ else if (hdr->security & PGPKEY)
ch = 'K';
- snprintf (buf2, sizeof (buf2),
- "%c%c%c", (THREAD_NEW ? 'n' : (THREAD_OLD ? 'o' :
- ((hdr->read
- && (ctx
- && ctx->msgnotreadyet !=
- hdr->msgno))
- ? (hdr->
- replied ? 'r' : ' ') : (hdr->
- old ?
- 'O' :
- 'N')))),
+ snprintf(buf2, sizeof (buf2), "%c%c%c",
+ (THREAD_NEW ? 'n'
+ : (THREAD_OLD
+ ? 'o'
+ : ((hdr->read && (ctx && ctx->msgnotreadyet != hdr->msgno))
+ ? (hdr->replied ? 'r' : ' ')
+ : (hdr->old ? 'O' : 'N')))),
hdr->deleted ? 'D' : (hdr->attach_del ? 'd' : ch),
- hdr->tagged ? '*' : (hdr->
- flagged ? '!' : (Tochars
- &&
- ((i =
- mutt_user_is_recipient
- (hdr)) <
- m_strlen(Tochars)) ?
- Tochars[i] : ' ')));
+ hdr->tagged ? '*'
+ : (hdr->flagged ? '!'
+ : (Tochars && ((i = mutt_user_is_recipient(hdr)) < m_strlen(Tochars))
+ ? Tochars[i] : ' ')));
mutt_format_s (dest, destlen, prefix, buf2);
break;
}
- else if ((WithCrypto & APPLICATION_PGP)
- && ascii_strncasecmp ("pgp:", cur->data, 4) == 0) {
+ else if (ascii_strncasecmp("pgp:", cur->data, 4) == 0) {
msg->security = mutt_parse_crypt_hdr (cur->data + 4, 0);
if (msg->security)
msg->security |= APPLICATION_PGP;
}
#endif
else if (DefaultHook && !(data & (M_CHARSETHOOK | M_ACCOUNTHOOK))
- && (!WithCrypto || !(data & M_CRYPTHOOK))
- ) {
+ && !(data & M_CRYPTHOOK))
+ {
char tmp[HUGE_STRING];
m_strcpy(tmp, sizeof(tmp), pattern.data);
map = SortBrowserMethods;
break;
case DT_SORT_KEYS:
- if ((WithCrypto & APPLICATION_PGP))
- map = SortKeyMethods;
+ map = SortKeyMethods;
break;
case DT_SORT_AUX:
map = SortAuxMethods;
map = SortBrowserMethods;
break;
case DT_SORT_KEYS:
- if ((WithCrypto & APPLICATION_PGP))
- map = SortKeyMethods;
- else
- map = SortMethods;
+ map = SortKeyMethods;
break;
default:
map = SortMethods;
#ifdef HAVE_COLOR
"color",
#endif
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
- "class_smime",
-#endif
#ifdef CRYPT_BACKEND_GPGME
"gpgme",
#endif
create_bindings (OpAlias, MENU_ALIAS);
- if ((WithCrypto & APPLICATION_PGP))
- create_bindings (OpPgp, MENU_PGP);
-
- if ((WithCrypto & APPLICATION_SMIME))
- create_bindings (OpSmime, MENU_SMIME);
+ create_bindings (OpPgp, MENU_PGP);
+ create_bindings (OpSmime, MENU_SMIME);
#ifdef CRYPT_BACKEND_GPGME
create_bindings (OpPgp, MENU_KEY_SELECT_PGP);
return OpQuery;
case MENU_PGP:
- return (WithCrypto & APPLICATION_PGP) ? OpPgp : NULL;
+ return OpPgp;
#ifdef CRYPT_BACKEND_GPGME
case MENU_KEY_SELECT_PGP:
);
puts (
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
- "+CRYPT_BACKEND_CLASSIC_SMIME "
-#else
- "-CRYPT_BACKEND_CLASSIC_SMIME "
-#endif
#ifdef CRYPT_BACKEND_GPGME
"+CRYPT_BACKEND_GPGME "
#else
#define SMIMEBADSIGN (APPLICATION_SMIME | BADSIGN)
#define SMIMEOPAQUE (APPLICATION_SMIME | SIGNOPAQUE)
-
-/* WITHCRYPTO actually replaces ifdefs so make the code more readable.
- Because it is defined as a constant and known at compile time, the
- compiler can do dead code elimination and thus it behaves
- effectively as a conditional compile directive. It is set to false
- if no crypto backend is configures or to a bit vector denoting the
- configured backends. */
-#if defined(CRYPT_BACKEND_CLASSIC_SMIME) || defined (CRYPT_BACKEND_GPGME)
-# define WithCrypto (APPLICATION_PGP | APPLICATION_SMIME)
-#else
-# define WithCrypto APPLICATION_PGP
-#endif
-
-
#define KEYFLAG_CANSIGN (1 << 0)
#define KEYFLAG_CANENCRYPT (1 << 1)
#define KEYFLAG_ISX509 (1 << 2)
break;
case TYPEAPPLICATION:
- if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (m))
+ if (mutt_is_application_pgp (m))
return 0;
- if ((WithCrypto & APPLICATION_SMIME) && mutt_is_application_smime (m))
+ if (mutt_is_application_smime (m))
return 0;
break;
int t = b->type;
char *s = b->subtype;
- if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b))
+ if (mutt_is_application_pgp (b))
return 0;
if (t == TYPETEXT)
return 1;
}
- if ((WithCrypto & APPLICATION_PGP) && t == TYPEAPPLICATION) {
+ if (t == TYPEAPPLICATION) {
if (!ascii_strcasecmp ("pgp-keys", s))
return 1;
}
for (msgno = ctx->msgcount - new_messages; msgno < ctx->msgcount; msgno++) {
h = ctx->hdrs[msgno];
- if (WithCrypto) {
- /* NOTE: this _must_ be done before the check for mailcap! */
- h->security = crypt_query (h->content);
- }
+ /* NOTE: this _must_ be done before the check for mailcap! */
+ h->security = crypt_query (h->content);
if (!ctx->pattern) {
ctx->v2r[ctx->vcount] = msgno;
case OP_CHECK_TRADITIONAL:
CHECK_MODE (IsHeader (extra));
- if (!(WithCrypto & APPLICATION_PGP))
- break;
if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED)) {
ch = -1;
rc = OP_CHECK_TRADITIONAL;
break;
case OP_DECRYPT_SAVE:
- if (!WithCrypto) {
- ch = -1;
- break;
- }
- /* fall through */
case OP_SAVE:
if (IsAttach (extra)) {
mutt_save_attachment_list (extra->fp, 0, extra->bdy, extra->hdr,
case OP_DECODE_SAVE:
case OP_DECODE_COPY:
case OP_DECRYPT_COPY:
- if (!WithCrypto && ch == OP_DECRYPT_COPY) {
- ch = -1;
- break;
- }
CHECK_MODE (IsHeader (extra));
if (mutt_save_message (extra->hdr,
(ch == OP_DECRYPT_SAVE) ||
case OP_MAIL_KEY:
- if (!(WithCrypto & APPLICATION_PGP)) {
- ch = -1;
- break;
- }
CHECK_MODE (IsHeader (extra));
CHECK_ATTACH;
ci_send_message (SENDKEY, NULL, NULL, extra->ctx, extra->hdr);
break;
case OP_EXTRACT_KEYS:
- if (!WithCrypto) {
- ch = -1;
- break;
- }
CHECK_MODE (IsHeader (extra));
crypt_extract_keys_from_messages (extra->hdr);
redraw = REDRAW_FULL;
if ((msg = mx_open_message (ctx, cur->msgno))) {
mutt_parse_part (msg->fp, cur->content);
- if (WithCrypto)
- cur->security = crypt_query (cur->content);
+ cur->security = crypt_query (cur->content);
mx_close_message (&msg);
}
if (pat->op != M_HEADER) {
mutt_parse_mime_message (ctx, h);
- if (WithCrypto && (h->security & ENCRYPT)
- && !crypt_valid_passphrase (h->security)) {
+ if ((h->security & ENCRYPT) && !crypt_valid_passphrase (h->security))
+ {
mx_close_message (&msg);
if (fp) {
fclose (fp);
case M_COLLAPSED:
return (pat->not ^ (h->collapsed && h->num_hidden > 1));
case M_CRYPT_SIGN:
- if (!WithCrypto)
- break;
return (pat->not ^ ((h->security & SIGN) ? 1 : 0));
case M_CRYPT_VERIFIED:
- if (!WithCrypto)
- break;
return (pat->not ^ ((h->security & GOODSIGN) ? 1 : 0));
case M_CRYPT_ENCRYPT:
- if (!WithCrypto)
- break;
return (pat->not ^ ((h->security & ENCRYPT) ? 1 : 0));
case M_PGP_KEY:
- if (!(WithCrypto & APPLICATION_PGP))
- break;
return (pat->not ^ ((h->security & APPLICATION_PGP)
&& (h->security & PGPKEY)));
case M_XLABEL:
char prompt[LONG_STRING];
- if (!(WithCrypto & APPLICATION_PGP))
- return msg->security;
-
/* If autoinline and no crypto options set, then set inline. */
if (option (OPTPGPAUTOINLINE) && !((msg->security & APPLICATION_PGP)
&& (msg->security & (SIGN | ENCRYPT))))
h->content->length = ftello (msg->fp) - h->content->offset;
/* This needs to be done in case this is a multipart message */
- if (!WithCrypto)
- h->security = crypt_query (h->content);
+ h->security = crypt_query (h->content);
mutt_clear_error ();
rewind (msg->fp);
mutt_free_list (&tmp);
tmp = next;
}
- else if ((WithCrypto & APPLICATION_PGP)
- && (m_strncmp("Pgp:", tmp->data, 4) == 0 /* this is generated
- * by old mutt versions
- */
+ else if ((m_strncmp("Pgp:", tmp->data, 4) == 0 /* this is generated
+ * by old mutt versions
+ */
|| m_strncmp("X-Mutt-PGP:", tmp->data, 11) == 0)) {
hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1);
hdr->security |= APPLICATION_PGP;
mutt_free_list (&tmp);
tmp = next;
}
- else if ((WithCrypto & APPLICATION_SMIME)
- && m_strncmp("X-Mutt-SMIME:", tmp->data, 13) == 0) {
+ else if (m_strncmp("X-Mutt-SMIME:", tmp->data, 13) == 0) {
hdr->security = mutt_parse_crypt_hdr (strchr (tmp->data, ':') + 1, 1);
hdr->security |= APPLICATION_SMIME;
char pgp_sign_as[LONG_STRING] = "\0", *q;
char smime_cryptalg[LONG_STRING] = "\0";
- if (!WithCrypto)
- return 0;
-
for (p = vskipspaces(p); *p; p++) {
-
switch (*p) {
case 'e':
case 'E':
}
/* the cryptalg field must not be empty */
- if ((WithCrypto & APPLICATION_SMIME) && *smime_cryptalg)
+ if (*smime_cryptalg)
m_strreplace(&SmimeCryptAlg, smime_cryptalg);
- if ((WithCrypto & APPLICATION_PGP) && (set_signas || *pgp_sign_as))
+ if (set_signas || *pgp_sign_as)
m_strreplace(&PgpSignAs, pgp_sign_as);
return pgp;
/* decrypt pgp/mime encoded messages */
- if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME) & hdr->security)
- && mutt_is_multipart_encrypted (newhdr->content)) {
- int ccap =
- WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME) & hdr->security;
+ if ((APPLICATION_PGP | APPLICATION_SMIME) & hdr->security
+ && mutt_is_multipart_encrypted (newhdr->content))
+ {
+ int ccap = (APPLICATION_PGP | APPLICATION_SMIME) & hdr->security;
newhdr->security |= ENCRYPT | ccap;
if (!crypt_valid_passphrase (ccap))
goto err;
* resending messages
*/
- if (WithCrypto && mutt_is_multipart_signed (newhdr->content)) {
+ if (mutt_is_multipart_signed (newhdr->content)) {
newhdr->security |= SIGN;
- if ((WithCrypto & APPLICATION_PGP)
- &&
- ascii_strcasecmp (mutt_get_parameter
+ if (ascii_strcasecmp (mutt_get_parameter
("protocol", newhdr->content->parameter),
"application/pgp-signature") == 0)
newhdr->security |= APPLICATION_PGP;
- else if ((WithCrypto & APPLICATION_SMIME))
+ else
newhdr->security |= APPLICATION_SMIME;
/* destroy the signature */
goto bail;
- if ((WithCrypto & APPLICATION_PGP)
- && (mutt_is_application_pgp (b) & (ENCRYPT | SIGN))) {
+ if (mutt_is_application_pgp (b) & (ENCRYPT | SIGN)) {
mutt_body_handler (b, &s);
/* Fix encryption flags. */
/* No inline if multipart. */
- if (WithCrypto && (newhdr->security & INLINE) && newhdr->content->next)
+ if ((newhdr->security & INLINE) && newhdr->content->next)
newhdr->security &= ~INLINE;
- /* Do we even support multiple mechanisms? */
- newhdr->security &= WithCrypto | ~(APPLICATION_PGP | APPLICATION_SMIME);
-
/* Theoretically, both could be set. Take the one the user wants to set by default. */
if ((newhdr->security & APPLICATION_PGP)
&& (newhdr->security & APPLICATION_SMIME)) {
&& (compose
|| (parent_type == -1
&& ascii_strcasecmp ("alternative", m->subtype)))
- && (!(WithCrypto & APPLICATION_PGP)
- || !mutt_is_multipart_encrypted (m))
+ && (!mutt_is_multipart_encrypted (m))
) {
idx =
mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax, level,
new->level = level;
/* We don't support multipart messages in the compose menu yet */
- if (!compose && !m->collapsed &&
- ((m->type == TYPEMULTIPART && (!(WithCrypto & APPLICATION_PGP)
- || !mutt_is_multipart_encrypted (m))
- )
- || mutt_is_message_type (m->type, m->subtype))) {
- idx =
- mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax,
- level + 1, compose);
+ if (!compose && !m->collapsed
+ && ((m->type == TYPEMULTIPART && !mutt_is_multipart_encrypted(m))
+ || mutt_is_message_type (m->type, m->subtype)))
+ {
+ idx = mutt_gen_attach_list (m->parts, m->type, idx, idxlen, idxmax,
+ level + 1, compose);
}
}
}
break;
/* functions which are passed through from the pager */
case OP_CHECK_TRADITIONAL:
- if (!(WithCrypto & APPLICATION_PGP)
- || (hdr && hdr->security & PGP_TRADITIONAL_CHECKED)) {
+ if (hdr && hdr->security & PGP_TRADITIONAL_CHECKED) {
op = OP_NULL;
break;
}
return;
- if (WithCrypto && ((hdr->security & ENCRYPT) ||
- (mutt_is_application_smime (hdr->content) &
- SMIMEOPAQUE))) {
+ if ((hdr->security & ENCRYPT) ||
+ (mutt_is_application_smime (hdr->content) & SMIMEOPAQUE))
+ {
need_secured = 1;
if ((hdr->security & ENCRYPT) && !crypt_valid_passphrase (hdr->security)) {
mx_close_message (&msg);
return;
}
- if ((WithCrypto & APPLICATION_SMIME)
- && (hdr->security & APPLICATION_SMIME)) {
+ if (hdr->security & APPLICATION_SMIME) {
if (hdr->env)
crypt_smime_getkeys (hdr->env);
else
need_secured = 0;
}
- if ((WithCrypto & APPLICATION_PGP) && (hdr->security & APPLICATION_PGP)) {
+ if (hdr->security & APPLICATION_PGP) {
if (mutt_is_multipart_encrypted (hdr->content))
secured = !crypt_pgp_decrypt_mime (msg->fp, &fp, hdr->content, &cur);
else
}
}
- if (!WithCrypto || !need_secured) {
+ if (!need_secured) {
fp = msg->fp;
cur = hdr->content;
}
break;
case OP_EXTRACT_KEYS:
- if ((WithCrypto & APPLICATION_PGP)) {
- crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
- menu->
- tagprefix ? cur :
- idx[menu->current]->
- content);
- menu->redraw = REDRAW_FULL;
- }
+ crypt_pgp_extract_keys_from_attachment_list (fp, menu->tagprefix,
+ menu->
+ tagprefix ? cur :
+ idx[menu->current]->
+ content);
+ menu->redraw = REDRAW_FULL;
break;
case OP_CHECK_TRADITIONAL:
- if ((WithCrypto & APPLICATION_PGP)
- && crypt_pgp_check_traditional (fp, menu->tagprefix ? cur
+ if (crypt_pgp_check_traditional (fp, menu->tagprefix ? cur
: idx[menu->current]->content,
- menu->tagprefix)) {
+ menu->tagprefix))
+ {
hdr->security = crypt_query (cur);
menu->redraw = REDRAW_FULL;
}
}
#endif
- if (WithCrypto && (hdr->security & (~PGP_TRADITIONAL_CHECKED))) {
+ if (hdr->security & (~PGP_TRADITIONAL_CHECKED)) {
mutt_message
- _
- ("Deletion of attachments from encrypted messages is unsupported.");
+ _("Deletion of attachments from encrypted messages is unsupported.");
}
else {
if (!menu->tagprefix) {
p_delete(&idx);
idxmax = 0;
- if (WithCrypto && need_secured && secured) {
+ if (need_secured && secured) {
fclose (fp);
mutt_free_body (&cur);
}
mutt_parse_mime_message (ctx, cur);
mutt_message_hook (ctx, cur, M_MESSAGEHOOK);
- if (WithCrypto && (cur->security & ENCRYPT) && option (OPTFORWDECODE)) {
+ if ((cur->security & ENCRYPT) && option (OPTFORWDECODE)) {
/* make sure we have the user's passphrase before proceeding... */
crypt_valid_passphrase (cur->security);
}
int cmflags = M_CM_PREFIX | M_CM_DECODE | M_CM_CHARCONV | M_CM_REPLYING;
int chflags = CH_DECODE;
- if (WithCrypto && (cur->security & ENCRYPT)) {
+ if ((cur->security & ENCRYPT)) {
/* make sure we have the user's passphrase before proceeding... */
crypt_valid_passphrase (cur->security);
}
else if (i == -1)
return -1;
}
- /* if (WithCrypto && (flags & SENDKEY)) */
- else if ((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)) {
+ else if (flags & SENDKEY) {
BODY *tmp;
- if ((WithCrypto & APPLICATION_PGP)
- && (tmp = crypt_pgp_make_key_attachment (NULL)) == NULL)
+ if ((tmp = crypt_pgp_make_key_attachment (NULL)) == NULL)
return -1;
tmp->next = msg->content;
}
- if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED))
+ if (flags & SENDPOSTPONED)
signas = m_strdup(PgpSignAs);
/* Delay expansion of aliases until absolutely necessary--shouldn't
* can take effect.
*/
- if (WithCrypto && !(flags & SENDMAILX)) {
+ if (!(flags & SENDMAILX)) {
if (option (OPTCRYPTAUTOSIGN))
msg->security |= SIGN;
if (option (OPTCRYPTAUTOENCRYPT))
if (option (OPTCRYPTREPLYSIGNENCRYPTED) && cur
&& (cur->security & ENCRYPT))
msg->security |= SIGN;
- if (WithCrypto & APPLICATION_PGP && (msg->security & (ENCRYPT | SIGN))) {
+ if (msg->security & (ENCRYPT | SIGN)) {
if (option (OPTPGPAUTOINLINE))
msg->security |= INLINE;
if (option (OPTPGPREPLYINLINE) && cur && (cur->security & INLINE))
}
}
- if (WithCrypto && msg->security) {
+ if (msg->security) {
/*
* When reypling / forwarding, use the original message's
* crypto system. According to the documentation,
* disable individual mechanisms at run-time?
*/
if (cur) {
- if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP)
- && (cur->security & APPLICATION_PGP))
+ if (option (OPTCRYPTAUTOPGP) && (cur->security & APPLICATION_PGP))
msg->security |= APPLICATION_PGP;
- else if ((WithCrypto & APPLICATION_SMIME)
- && option (OPTCRYPTAUTOSMIME)
+ else if (option (OPTCRYPTAUTOSMIME)
&& (cur->security & APPLICATION_SMIME))
msg->security |= APPLICATION_SMIME;
}
* for the decision.
*/
if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) {
- if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME)
- && option (OPTSMIMEISDEFAULT))
+ if (option (OPTCRYPTAUTOSMIME) && option (OPTSMIMEISDEFAULT))
msg->security |= APPLICATION_SMIME;
- else if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP))
+ else if (option (OPTCRYPTAUTOPGP))
msg->security |= APPLICATION_PGP;
- else if ((WithCrypto & APPLICATION_SMIME)
- && option (OPTCRYPTAUTOSMIME))
+ else if (option (OPTCRYPTAUTOSMIME))
msg->security |= APPLICATION_SMIME;
}
}
&& !(flags & (SENDRESEND | SENDPOSTPONED)))
msg->env->from->personal = m_strdup(Realname);
- if (!((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)))
+ if (!(flags & SENDKEY))
safe_fclose (&tempfp);
if (flags & SENDMAILX) {
clear_content = NULL;
free_clear_content = 0;
- if (WithCrypto) {
- if (msg->security) {
- /* save the decrypted attachments */
- clear_content = msg->content;
+ if (msg->security) {
+ /* save the decrypted attachments */
+ clear_content = msg->content;
- if ((crypt_get_keys (msg, &pgpkeylist) == -1) ||
- mutt_protect (msg, pgpkeylist) == -1) {
- msg->content = mutt_remove_multipart (msg->content);
+ if ((crypt_get_keys (msg, &pgpkeylist) == -1) ||
+ mutt_protect (msg, pgpkeylist) == -1) {
+ msg->content = mutt_remove_multipart (msg->content);
- p_delete(&pgpkeylist);
+ p_delete(&pgpkeylist);
- decode_descriptions (msg->content);
- goto main_loop;
- }
- encode_descriptions (msg->content, 0);
+ decode_descriptions (msg->content);
+ goto main_loop;
}
+ encode_descriptions (msg->content, 0);
+ }
- /*
- * at this point, msg->content is one of the following three things:
- * - multipart/signed. In this case, clear_content is a child.
- * - multipart/encrypted. In this case, clear_content exists
- * independently
- * - application/pgp. In this case, clear_content exists independently.
- * - something else. In this case, it's the same as clear_content.
- */
+ /*
+ * at this point, msg->content is one of the following three things:
+ * - multipart/signed. In this case, clear_content is a child.
+ * - multipart/encrypted. In this case, clear_content exists
+ * independently
+ * - application/pgp. In this case, clear_content exists independently.
+ * - something else. In this case, it's the same as clear_content.
+ */
- /* This is ugly -- lack of "reporting back" from mutt_protect(). */
+ /* This is ugly -- lack of "reporting back" from mutt_protect(). */
- if (clear_content && (msg->content != clear_content)
- && (msg->content->parts != clear_content))
- free_clear_content = 1;
- }
+ if (clear_content && (msg->content != clear_content)
+ && (msg->content->parts != clear_content))
+ free_clear_content = 1;
if (!option (OPTNOCURSES) && !(flags & SENDMAILX))
mutt_message _("Sending message...");
BODY *save_sig = NULL;
BODY *save_parts = NULL;
- if (WithCrypto && msg->security && option (OPTFCCCLEAR))
+ if (msg->security && option (OPTFCCCLEAR))
msg->content = clear_content;
/* check to see if the user wants copies of all attachments */
if (!option (OPTFCCATTACH) && msg->content->type == TYPEMULTIPART) {
- if (WithCrypto
- && (m_strcmp(msg->content->subtype, "encrypted") == 0 ||
- m_strcmp(msg->content->subtype, "signed") == 0)) {
+ if ((m_strcmp(msg->content->subtype, "encrypted") == 0 ||
+ m_strcmp(msg->content->subtype, "signed") == 0))
+ {
if (clear_content->type == TYPEMULTIPART) {
if (!(msg->security & ENCRYPT) && (msg->security & SIGN)) {
/* save initial signature and attachments */
msg->content = tmpbody;
- if (WithCrypto && save_sig) {
+ if (save_sig) {
/* cleanup the second signature structures */
if (save_content->parts) {
mutt_free_body (&save_content->parts->next);
msg->content->parts->next = save_sig;
msg->content->parts->parts->next = save_parts;
}
- else if (WithCrypto && save_content) {
+ else if (save_content) {
/* destroy the new encrypted body. */
mutt_free_body (&save_content);
}
*/
if (fcc_error || (i = send_message (msg)) == -1) {
if (!(flags & SENDBATCH)) {
- if (!WithCrypto);
- else if ((msg->security & ENCRYPT) || ((msg->security & SIGN)
- && msg->content->type ==
- TYPEAPPLICATION)) {
+ if ((msg->security & ENCRYPT)
+ || ((msg->security & SIGN)
+ && msg->content->type == TYPEAPPLICATION)) {
mutt_free_body (&msg->content); /* destroy PGP data */
msg->content = clear_content; /* restore clear text. */
}
_("Mail sent."));
#endif
- if (WithCrypto && (msg->security & ENCRYPT))
+ if (msg->security & ENCRYPT)
p_delete(&pgpkeylist);
- if (WithCrypto && free_clear_content)
+ if (free_clear_content)
mutt_free_body (&clear_content);
if (flags & SENDREPLY) {
cleanup:
- if ((WithCrypto & APPLICATION_PGP) && (flags & SENDPOSTPONED)) {
+ if (flags & SENDPOSTPONED) {
if (signas) {
p_delete(&PgpSignAs);
PgpSignAs = signas;
return (ferror (f) ? -1 : 0);
}
-# define write_as_text_part(a) (mutt_is_text_part(a) \
- || ((WithCrypto & APPLICATION_PGP)\
- && mutt_is_application_pgp(a)))
+# define write_as_text_part(a) (mutt_is_text_part(a) || mutt_is_application_pgp(a))
int mutt_write_mime_body (BODY * a, FILE * f)
{
}
/* This is pretty gross, but it's the best solution for now... */
- if ((WithCrypto & APPLICATION_PGP)
- && a->type == TYPEAPPLICATION
- && m_strcmp(a->subtype, "pgp-encrypted") == 0) {
+ if (a->type == TYPEAPPLICATION && !m_strcmp(a->subtype, "pgp-encrypted")) {
fputs ("Version: 1\n", f);
return 0;
}
BODY *body;
FILE *fp;
int cmflags, chflags;
- int pgp = WithCrypto ? hdr->security : 0;
+ int pgp = hdr->security;
- if (WithCrypto) {
- if ((option (OPTMIMEFORWDECODE) || option (OPTFORWDECRYPT)) &&
- (hdr->security & ENCRYPT)) {
- if (!crypt_valid_passphrase (hdr->security))
- return (NULL);
- }
+ if ((option (OPTMIMEFORWDECODE) || option (OPTFORWDECRYPT)) &&
+ (hdr->security & ENCRYPT)) {
+ if (!crypt_valid_passphrase (hdr->security))
+ return (NULL);
}
mutt_mktemp (buffer);
if (!attach_msg && option (OPTMIMEFORWDECODE)) {
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = M_CM_DECODE | M_CM_CHARCONV;
- if ((WithCrypto & APPLICATION_PGP))
- pgp &= ~PGPENCRYPT;
- if ((WithCrypto & APPLICATION_SMIME))
- pgp &= ~SMIMEENCRYPT;
+ pgp &= ~(PGPENCRYPT|SMIMEENCRYPT);
}
- else if (WithCrypto && option (OPTFORWDECRYPT) && (hdr->security & ENCRYPT)) {
- if ((WithCrypto & APPLICATION_PGP)
- && mutt_is_multipart_encrypted (hdr->content)) {
+ else if (option (OPTFORWDECRYPT) && (hdr->security & ENCRYPT)) {
+ if (mutt_is_multipart_encrypted (hdr->content)) {
chflags |= CH_MIME | CH_NONEWLINE;
cmflags = M_CM_DECODE_PGP;
pgp &= ~PGPENCRYPT;
}
- else if ((WithCrypto & APPLICATION_PGP)
- && (mutt_is_application_pgp (hdr->content) & PGPENCRYPT)) {
+ else if (mutt_is_application_pgp (hdr->content) & PGPENCRYPT) {
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = M_CM_DECODE | M_CM_CHARCONV;
pgp &= ~PGPENCRYPT;
}
- else if ((WithCrypto & APPLICATION_SMIME)
- && mutt_is_application_smime (hdr->content) & SMIMEENCRYPT) {
+ else if (mutt_is_application_smime (hdr->content) & SMIMEENCRYPT) {
chflags |= CH_MIME | CH_TXTPLAIN;
cmflags = M_CM_DECODE | M_CM_CHARCONV;
pgp &= ~SMIMEENCRYPT;
body->hdr->offset = 0;
/* we don't need the user headers here */
body->hdr->env = mutt_read_rfc822_header (fp, body->hdr, 0, 0);
- if (WithCrypto)
- body->hdr->security = pgp;
+ body->hdr->security = pgp;
mutt_update_encoding (body);
body->parts = body->hdr->content;
/* (postponment) if the mail is to be signed or encrypted, save this info */
- if ((WithCrypto & APPLICATION_PGP)
- && post && (hdr->security & APPLICATION_PGP)) {
+ if (post && (hdr->security & APPLICATION_PGP)) {
fputs ("X-Mutt-PGP: ", msg->fp);
if (hdr->security & ENCRYPT)
fputc ('E', msg->fp);
}
/* (postponment) if the mail is to be signed or encrypted, save this info */
- if ((WithCrypto & APPLICATION_SMIME)
- && post && (hdr->security & APPLICATION_SMIME)) {
+ if (post && (hdr->security & APPLICATION_SMIME)) {
fputs ("X-Mutt-SMIME: ", msg->fp);
if (hdr->security & ENCRYPT) {
fputc ('E', msg->fp);
# include <sys/resource.h>
#endif
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
-
#include "mutt_crypt.h"
struct smime_command_context {
{
char *p;
- if (!(WithCrypto & APPLICATION_SMIME))
- return msg->security;
-
switch (mutt_multi_choice
- (_
- ("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear? "),
+ (_("S/MIME (e)ncrypt, (s)ign, encrypt (w)ith, sign (a)s, (b)oth, or (c)lear? "),
_("eswabfc"))) {
case 1: /* (e)ncrypt */
msg->security |= ENCRYPT;
return (msg->security);
}
-
-
-#endif /* CRYPT_BACKEND_CLASSIC_SMIME */
* please see the file GPL in the top level source directory.
*/
-#ifdef CRYPT_BACKEND_CLASSIC_SMIME
#include "mutt_crypt.h"
-
-
-
-
void smime_void_passphrase (void);
int smime_valid_passphrase (void);
void smime_invoke_import (char *, char *);
int smime_send_menu (HEADER * msg, int *redraw);
-
-#endif