mutt_parse_mime_message(m, en->email);
if ((en->email->security & SEC_ENCRYPT) &&
!crypt_valid_passphrase(en->email->security))
+ {
return 1;
+ }
}
mutt_endwin();
/**
* crypt_valid_passphrase - Check that we have a usable passphrase, ask if not
* @param flags Flags, see #SecurityFlags
- * @retval 0 Success
- * @retval -1 Failure
+ * @retval true Success
+ * @retval false Failed
*/
-int crypt_valid_passphrase(SecurityFlags flags)
+bool crypt_valid_passphrase(SecurityFlags flags)
{
- int rc = 0;
+ bool rc = false;
#ifndef DEBUG
disable_coredumps();
void (*void_passphrase)(void);
/**
* valid_passphrase - Ensure we have a valid passphrase
- * @retval 1 Success
- * @retval 0 Failed
+ * @retval true Success
+ * @retval false Failed
*
* If the passphrase is within the expiry time (backend-specific), use it.
* If not prompt the user again.
*/
- int (*valid_passphrase)(void);
+ bool (*valid_passphrase)(void);
/**
* decrypt_mime - Decrypt an encrypted MIME part
* @param[in] fp_in File containing the encrypted part
*
* This is handled by gpg-agent.
*/
-static int pgp_gpgme_valid_passphrase(void)
+static bool pgp_gpgme_valid_passphrase(void)
{
- return 1;
+ return true;
}
// clang-format off
*
* This is handled by gpg-agent.
*/
-static int smime_gpgme_valid_passphrase(void)
+static bool smime_gpgme_valid_passphrase(void)
{
- return 1;
+ return true;
}
// clang-format off
/**
* crypt_pgp_valid_passphrase - Wrapper for CryptModuleSpecs::valid_passphrase()
*/
-int crypt_pgp_valid_passphrase(void)
+bool crypt_pgp_valid_passphrase(void)
{
if (CRYPT_MOD_CALL_CHECK(PGP, valid_passphrase))
return CRYPT_MOD_CALL(PGP, valid_passphrase)();
- return 0;
+ return false;
}
/**
/**
* crypt_smime_valid_passphrase - Wrapper for CryptModuleSpecs::valid_passphrase()
*/
-int crypt_smime_valid_passphrase(void)
+bool crypt_smime_valid_passphrase(void)
{
if (CRYPT_MOD_CALL_CHECK(SMIME, valid_passphrase))
return CRYPT_MOD_CALL(SMIME, valid_passphrase)();
- return 0;
+ return false;
}
/**
void crypt_pgp_set_sender(const char *sender);
struct Body *crypt_pgp_sign_message(struct Body *a);
struct Body *crypt_pgp_traditional_encryptsign(struct Body *a, int flags, char *keylist);
-int crypt_pgp_valid_passphrase(void);
+bool crypt_pgp_valid_passphrase(void);
int crypt_pgp_verify_one(struct Body *sigbdy, struct State *s, const char *tempf);
void crypt_pgp_void_passphrase(void);
void crypt_smime_invoke_import(char *infile, char *mailbox);
void crypt_smime_set_sender(const char *sender);
struct Body *crypt_smime_sign_message(struct Body *a);
-int crypt_smime_valid_passphrase(void);
+bool crypt_smime_valid_passphrase(void);
int crypt_smime_verify_one(struct Body *sigbdy, struct State *s, const char *tempf);
void crypt_smime_void_passphrase(void);
int crypt_get_keys(struct Email *msg, char **keylist, bool oppenc_mode);
void crypt_opportunistic_encrypt(struct Email *msg);
SecurityFlags crypt_query(struct Body *m);
-int crypt_valid_passphrase(SecurityFlags flags);
+bool crypt_valid_passphrase(SecurityFlags flags);
SecurityFlags mutt_is_application_pgp(struct Body *m);
SecurityFlags mutt_is_application_smime(struct Body *m);
SecurityFlags mutt_is_malformed_multipart_pgp_encrypted(struct Body *b);
/**
* pgp_class_valid_passphrase - Implements CryptModuleSpecs::valid_passphrase()
*/
-int pgp_class_valid_passphrase(void)
+bool pgp_class_valid_passphrase(void)
{
time_t now = time(NULL);
if (pgp_use_gpg_agent())
{
*PgpPass = '\0';
- return 1; /* handled by gpg-agent */
+ return true; /* handled by gpg-agent */
}
if (now < PgpExptime)
{
/* Use cached copy. */
- return 1;
+ return true;
}
pgp_class_void_passphrase();
if (mutt_get_password(_("Enter PGP passphrase:"), PgpPass, sizeof(PgpPass)) == 0)
{
PgpExptime = mutt_date_add_timeout(time(NULL), C_PgpTimeout);
- return 1;
+ return true;
}
else
PgpExptime = 0;
- return 0;
+ return false;
}
/**
int pgp_class_encrypted_handler(struct Body *a, struct State *s);
void pgp_class_extract_key_from_attachment(FILE *fp, struct Body *top);
void pgp_class_void_passphrase(void);
-int pgp_class_valid_passphrase(void);
+bool pgp_class_valid_passphrase(void);
int pgp_class_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
struct Body *pgp_class_traditional_encryptsign(struct Body *a, SecurityFlags flags, char *keylist);
/**
* smime_class_valid_passphrase - Implements CryptModuleSpecs::valid_passphrase()
*/
-int smime_class_valid_passphrase(void)
+bool smime_class_valid_passphrase(void)
{
time_t now = time(NULL);
if (now < SmimeExptime)
{
/* Use cached copy. */
- return 1;
+ return true;
}
smime_class_void_passphrase();
if (mutt_get_password(_("Enter S/MIME passphrase:"), SmimePass, sizeof(SmimePass)) == 0)
{
SmimeExptime = mutt_date_add_timeout(time(NULL), C_SmimeTimeout);
- return 1;
+ return true;
}
else
SmimeExptime = 0;
- return 0;
+ return false;
}
/*
void smime_class_invoke_import(char *infile, char *mailbox);
int smime_class_send_menu(struct Email *msg);
struct Body *smime_class_sign_message(struct Body *a);
-int smime_class_valid_passphrase(void);
+bool smime_class_valid_passphrase(void);
int smime_class_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
int smime_class_verify_sender(struct Email *e);
void smime_class_void_passphrase(void);