case OP_COMPOSE_PGP_MENU:
if (!(WithCrypto & APPLICATION_PGP))
break;
+ if (!crypt_has_module_backend (APPLICATION_PGP))
+ {
+ mutt_error _("No PGP backend configured");
+ break;
+ }
if ((WithCrypto & APPLICATION_SMIME)
&& (msg->security & APPLICATION_SMIME))
{
case OP_COMPOSE_SMIME_MENU:
if (!(WithCrypto & APPLICATION_SMIME))
break;
+ if (!crypt_has_module_backend (APPLICATION_SMIME))
+ {
+ mutt_error _("No S/MIME backend configured");
+ break;
+ }
if ((WithCrypto & APPLICATION_PGP)
&& (msg->security & APPLICATION_PGP))
mutt_message _("Invoking S/MIME...");
}
+/* Returns 1 if a module backend is registered for the type */
+int crypt_has_module_backend (int type)
+{
+ if ((WithCrypto & APPLICATION_PGP) &&
+ (type & APPLICATION_PGP) &&
+ crypto_module_lookup (APPLICATION_PGP))
+ return 1;
+
+ if ((WithCrypto & APPLICATION_SMIME) &&
+ (type & APPLICATION_SMIME) &&
+ crypto_module_lookup (APPLICATION_SMIME))
+ return 1;
+
+ return 0;
+}
+
\f
/*
/* Show a message that a backend will be invoked. */
void crypt_invoke_message (int type);
+/* Returns 1 if a module backend is registered for the type */
+int crypt_has_module_backend (int type);
+
/* Silently forget about a passphrase. */
void crypt_pgp_void_passphrase (void);
msg->security = 0;
}
+ /* Deal with the corner case where the crypto module backend is not available.
+ * This can happen if configured without pgp/smime and with gpgme, but
+ * $crypt_use_gpgme is unset.
+ */
+ if (msg->security &&
+ !crypt_has_module_backend (msg->security))
+ {
+ mutt_error _("No crypto backend configured. Disabling message security setting.");
+ mutt_sleep (1);
+ msg->security = 0;
+ }
+
/* specify a default fcc. if we are in batchmode, only save a copy of
* the message if the value of $copy is yes or ask-yes */