m_strcmp(tmp->path, Context->path))) {
switch (tmp->magic) {
case M_MBOX:
- case M_MMDF:
/* only check on force or $mail_check reached */
if (force == 1 || (now - last1 >= Buffy.mail_check)) {
if (!count) {
}
else if (cur->security & SIGN) {
/* find out whether or not the verify signature */
- if (query_quadoption (OPT_VERIFYSIG, _("Verify PGP signature?")) ==
+ if (query_quadoption2(mod_crypt.verify_sig, _("Verify PGP signature?")) ==
M_YES) {
cmflags |= M_CM_VERIFY;
}
#include "recvattach.h"
#include "sort.h"
+@import "lib-lua/base.cpkg"
+
+@package mod_crypt {
+ bool autosmime = 1;
+ /*
+ ** .pp
+ ** This variable controls whether or not Madmutt may automatically enable
+ ** S/MIME encryption/signing for messages. See also ``$$crypt_autoencrypt'',
+ ** ``$$crypt_replyencrypt'',
+ ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
+ */
+ bool autopgp = 1;
+ /*
+ ** .pp
+ ** This variable controls whether or not Madmutt may automatically enable
+ ** PGP encryption/signing for messages. See also ``$$crypt_autoencrypt'',
+ ** ``$$crypt_replyencrypt'',
+ ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
+ */
+ bool autosign = 0;
+ /*
+ ** .pp
+ ** Setting this variable will cause Madmutt to always attempt to
+ ** cryptographically sign outgoing messages. This can be overridden
+ ** by use of the \fIpgp-menu\fP, when signing is not required or
+ ** encryption is requested as well. If ``$$smime_is_default'' is \fIset\fP,
+ ** then OpenSSL is used instead to create S/MIME messages and settings can
+ ** be overridden by use of the \fIsmime-menu\fP.
+ ** (Crypto only)
+ */
+ bool autoencrypt = 0;
+ /*
+ ** .pp
+ ** Setting this variable will cause Madmutt to always attempt to PGP
+ ** encrypt outgoing messages. This is probably only useful in
+ ** connection to the \fIsend-hook\fP command. It can be overridden
+ ** by use of the \fIpgp-menu\fP, when encryption is not required or
+ ** signing is requested as well. If ``$$smime_is_default'' is \fIset\fP,
+ ** then OpenSSL is used instead to create S/MIME messages and
+ ** settings can be overridden by use of the \fIsmime-menu\fP.
+ ** (Crypto only)
+ */
+ bool replyencrypt = 1;
+ /*
+ ** .pp
+ ** If \fIset\fP, automatically PGP or OpenSSL encrypt replies to messages which are
+ ** encrypted.
+ ** (Crypto only)
+ */
+ bool replysign = 0;
+ /*
+ ** .pp
+ ** If \fIset\fP, automatically PGP or OpenSSL sign replies to messages which are
+ ** signed.
+ ** .pp
+ ** \fBNote:\fP this does not work on messages that are encrypted \fBand\fP signed!
+ ** (Crypto only)
+ */
+ bool replysignencrypted = 1;
+ /*
+ ** .pp
+ ** If \fIset\fP, automatically PGP or OpenSSL sign replies to messages
+ ** which are encrypted. This makes sense in combination with
+ ** ``$$crypt_replyencrypt'', because it allows you to sign all
+ ** messages which are automatically encrypted. This works around
+ ** the problem noted in ``$$crypt_replysign'', that Madmutt is not able
+ ** to find out whether an encrypted message is also signed.
+ ** (Crypto only)
+ */
+ quadopt_t verify_sig = M_YES;
+ /*
+ ** .pp
+ ** If ``\fIyes\fP'', always attempt to verify PGP or S/MIME signatures.
+ ** If ``\fIask\fP'', ask whether or not to verify the signature.
+ ** If ``\fIno\fP'', never attempt to verify cryptographic signatures.
+ ** (Crypto only)
+ */
+};
+
/* Values used for comparing addresses. */
#define CRYPT_KV_VALID 1
#define CRYPT_KV_ADDR 2
s++;
if (*s == ',' || *s == '=' || *s == '+'
|| *s == '<' || *s == '>' || *s == '#' || *s == ';'
- || *s == '\\' || *s == '\"' || *s == ' ')
+ || *s == '\\' || *s == '"' || *s == ' ')
n++;
else if (hexval(*s) >= 0 && hexval(*s + 1) >= 0) {
s++;
else
return NULL; /* invalid escape sequence */
}
- else if (*s == '\"')
+ else if (*s == '"')
return NULL; /* invalid encoding */
else if (*s == ',' || *s == '=' || *s == '+'
|| *s == '<' || *s == '>' || *s == '#' || *s == ';')
return (rc);
}
+
+/* vim:set ft=c: */
#include <lib-mime/mime.h>
#include "state.h"
+#include "crypt.li"
#define ENCRYPT (1 << 0)
#define SIGN (1 << 1)
** will be saved for later references. Also see ``$$record'',
** and ``$fcc-hook''.
*/
- {"crypt_autopgp", DT_BOOL, R_NONE, OPTCRYPTAUTOPGP, "yes" },
- /*
- ** .pp
- ** This variable controls whether or not Madmutt may automatically enable
- ** PGP encryption/signing for messages. See also ``$$crypt_autoencrypt'',
- ** ``$$crypt_replyencrypt'',
- ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
- */
- {"crypt_autosmime", DT_BOOL, R_NONE, OPTCRYPTAUTOSMIME, "yes" },
- /*
- ** .pp
- ** This variable controls whether or not Madmutt may automatically enable
- ** S/MIME encryption/signing for messages. See also ``$$crypt_autoencrypt'',
- ** ``$$crypt_replyencrypt'',
- ** ``$$crypt_autosign'', ``$$crypt_replysign'' and ``$$smime_is_default''.
- */
{"date_format", DT_STR, R_BOTH, UL &DateFmt, "!%a, %b %d, %Y at %I:%M:%S%p %Z"},
/*
** .pp
** when you are at the end of a message and invoke the \fInext-page\fP
** function.
*/
- {"crypt_autosign", DT_BOOL, R_NONE, OPTCRYPTAUTOSIGN, "no" },
- /*
- ** .pp
- ** Setting this variable will cause Madmutt to always attempt to
- ** cryptographically sign outgoing messages. This can be overridden
- ** by use of the \fIpgp-menu\fP, when signing is not required or
- ** encryption is requested as well. If ``$$smime_is_default'' is \fIset\fP,
- ** then OpenSSL is used instead to create S/MIME messages and settings can
- ** be overridden by use of the \fIsmime-menu\fP.
- ** (Crypto only)
- */
- {"crypt_autoencrypt", DT_BOOL, R_NONE, OPTCRYPTAUTOENCRYPT, "no" },
- /*
- ** .pp
- ** Setting this variable will cause Madmutt to always attempt to PGP
- ** encrypt outgoing messages. This is probably only useful in
- ** connection to the \fIsend-hook\fP command. It can be overridden
- ** by use of the \fIpgp-menu\fP, when encryption is not required or
- ** signing is requested as well. If ``$$smime_is_default'' is \fIset\fP,
- ** then OpenSSL is used instead to create S/MIME messages and
- ** settings can be overridden by use of the \fIsmime-menu\fP.
- ** (Crypto only)
- */
- {"crypt_replyencrypt", DT_BOOL, R_NONE, OPTCRYPTREPLYENCRYPT, "yes" },
- /*
- ** .pp
- ** If \fIset\fP, automatically PGP or OpenSSL encrypt replies to messages which are
- ** encrypted.
- ** (Crypto only)
- */
- {"crypt_replysign", DT_BOOL, R_NONE, OPTCRYPTREPLYSIGN, "no" },
- /*
- ** .pp
- ** If \fIset\fP, automatically PGP or OpenSSL sign replies to messages which are
- ** signed.
- ** .pp
- ** \fBNote:\fP this does not work on messages that are encrypted \fBand\fP signed!
- ** (Crypto only)
- */
- {"crypt_replysignencrypted", DT_BOOL, R_NONE, OPTCRYPTREPLYSIGNENCRYPTED, "no" },
- /*
- ** .pp
- ** If \fIset\fP, automatically PGP or OpenSSL sign replies to messages
- ** which are encrypted. This makes sense in combination with
- ** ``$$crypt_replyencrypt'', because it allows you to sign all
- ** messages which are automatically encrypted. This works around
- ** the problem noted in ``$$crypt_replysign'', that Madmutt is not able
- ** to find out whether an encrypted message is also signed.
- ** (Crypto only)
- */
- {"crypt_verify_sig", DT_QUAD, R_NONE, OPT_VERIFYSIG, "yes" },
- /*
- ** .pp
- ** If ``\fIyes\fP'', always attempt to verify PGP or S/MIME signatures.
- ** If ``\fIask\fP'', ask whether or not to verify the signature.
- ** If ``\fIno\fP'', never attempt to verify cryptographic signatures.
- ** (Crypto only)
- */
{"smime_is_default", DT_BOOL, R_NONE, OPTSMIMEISDEFAULT, "no" },
/*
** .pp
## ask-no
## ask-yes
## assumed_charset
+## autoencrypt
+## autopgp
+## autosign
+## autosmime
## beep
## beep_new
## bindir
## operating_system
## quit
## record
+## replyencrypt
+## replysign
+## replysignencrypted
## send_charset
## sendmail
## sendmail_wait
## username
## use_sslv3
## use_tlsv1
+## verify_sig
## version
## yes
#include "../mutt.h"
#include "../charset.h"
#include "../buffy.h"
+#include "../crypt.h"
#include <lib-sys/mutt_ssl.li>
static lua_State *L;
{"Mime", luaopen_Mime},
{"Buffy", luaopen_Buffy},
{"mod_ssl", luaopen_mod_ssl},
+ {"mod_crypt", luaopen_mod_crypt},
};
int i;
OPT_REPLYTO,
OPT_RECALL,
OPT_SUBJECT,
- OPT_VERIFYSIG, /* verify PGP signatures */
OPT_LISTREPLY,
#ifdef USE_NNTP
OPT_TOMODERATED,
/* PGP options */
- OPTCRYPTAUTOSIGN,
- OPTCRYPTAUTOENCRYPT,
- OPTCRYPTAUTOPGP,
- OPTCRYPTAUTOSMIME,
- OPTCRYPTREPLYENCRYPT,
- OPTCRYPTREPLYSIGN,
- OPTCRYPTREPLYSIGNENCRYPTED,
OPTSMIMEISDEFAULT,
OPTPGPAUTODEC,
OPTPGPRETAINABLESIG,
* can take effect.
*/
- if (option (OPTCRYPTAUTOSIGN))
+ if (mod_crypt.autosign)
msg->security |= SIGN;
- if (option (OPTCRYPTAUTOENCRYPT))
+ if (mod_crypt.autoencrypt)
msg->security |= ENCRYPT;
- if (option (OPTCRYPTREPLYENCRYPT) && cur && (cur->security & ENCRYPT))
+ if (mod_crypt.replyencrypt && cur && (cur->security & ENCRYPT))
msg->security |= ENCRYPT;
- if (option (OPTCRYPTREPLYSIGN) && cur && (cur->security & SIGN))
+ if (mod_crypt.replysign && cur && (cur->security & SIGN))
msg->security |= SIGN;
- if (option (OPTCRYPTREPLYSIGNENCRYPTED) && cur
- && (cur->security & ENCRYPT))
+ if (mod_crypt.replysignencrypted && cur && (cur->security & ENCRYPT))
msg->security |= SIGN;
if (msg->security) {
* disable individual mechanisms at run-time?
*/
if (cur) {
- if (option (OPTCRYPTAUTOPGP) && (cur->security & APPLICATION_PGP))
+ if (mod_crypt.autopgp && (cur->security & APPLICATION_PGP))
msg->security |= APPLICATION_PGP;
- else if (option (OPTCRYPTAUTOSMIME)
- && (cur->security & APPLICATION_SMIME))
+ else if (mod_crypt.autosmime && (cur->security & APPLICATION_SMIME))
msg->security |= APPLICATION_SMIME;
}
* for the decision.
*/
if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) {
- if (option (OPTCRYPTAUTOSMIME) && option (OPTSMIMEISDEFAULT))
+ if (mod_crypt.autosmime && option(OPTSMIMEISDEFAULT))
msg->security |= APPLICATION_SMIME;
- else if (option (OPTCRYPTAUTOPGP))
+ else if (mod_crypt.autopgp)
msg->security |= APPLICATION_PGP;
- else if (option (OPTCRYPTAUTOSMIME))
+ else if (mod_crypt.autosmime)
msg->security |= APPLICATION_SMIME;
}
}
../lib-lua/madmutt.li \
../lib-sys/mutt_ssl.li \
../alias.li \
+ ../crypt.li \
../buffy.li \
../charset.li