if (!(WithCrypto & APPLICATION_PGP))
break;
new = mutt_mem_calloc(1, sizeof(struct AttachPtr));
- new->content = crypt_pgp_make_key_attachment(NULL);
+ new->content = crypt_pgp_make_key_attachment();
if (new->content)
{
update_idx(menu, actx, new);
/**
* data_object_to_tempfile - Copy a data object to a temporary file
*
- * The tempfile name may be optionally passed in.
* If ret_fp is passed in, the file will be rewound, left open, and returned
* via that parameter.
* The tempfile name is returned, and must be freed.
*/
-static char *data_object_to_tempfile(gpgme_data_t data, char *tempf, FILE **ret_fp)
+static char *data_object_to_tempfile(gpgme_data_t data, FILE **ret_fp)
{
int err;
- char tempfb[PATH_MAX];
+ char tempf[PATH_MAX];
FILE *fp = NULL;
ssize_t nread = 0;
- if (!tempf)
- {
- mutt_mktemp(tempfb, sizeof(tempfb));
- tempf = tempfb;
- }
- fp = mutt_file_fopen(tempf, tempf == tempfb ? "w+" : "a+");
+ mutt_mktemp(tempf, sizeof(tempf));
+ fp = mutt_file_fopen(tempf, "w+");
if (!fp)
{
mutt_perror(_("Can't create temporary file"));
gpgme_release(ctx);
- outfile = data_object_to_tempfile(ciphertext, NULL, NULL);
+ outfile = data_object_to_tempfile(ciphertext, NULL);
gpgme_data_release(ciphertext);
return outfile;
}
return NULL;
}
- sigfile = data_object_to_tempfile(signature, NULL, NULL);
+ sigfile = data_object_to_tempfile(signature, NULL);
gpgme_data_release(signature);
if (!sigfile)
{
bool complete, armor_header;
FILE *fp = NULL;
- char *fname = data_object_to_tempfile(data, NULL, &fp);
+ char *fname = data_object_to_tempfile(data, &fp);
if (!fname)
{
mutt_file_fclose(&fp);
s);
}
- tmpfname = data_object_to_tempfile(plaintext, NULL, &pgpout);
+ tmpfname = data_object_to_tempfile(plaintext, &pgpout);
if (!tmpfname)
{
mutt_file_fclose(&pgpout);
/**
* pgp_gpgme_make_key_attachment - Implements CryptModuleSpecs::pgp_make_key_attachment()
*/
-struct Body *pgp_gpgme_make_key_attachment(char *tempf)
+struct Body *pgp_gpgme_make_key_attachment(void)
{
#ifdef HAVE_GPGME_OP_EXPORT_KEYS
gpgme_ctx_t context = NULL;
goto bail;
}
- tempf = data_object_to_tempfile(keydata, tempf, NULL);
+ char *tempf = data_object_to_tempfile(keydata, NULL);
if (!tempf)
goto bail;
char * pgp_gpgme_find_keys(struct Address *addrlist, bool oppenc_mode);
void pgp_gpgme_init(void);
void pgp_gpgme_invoke_import(const char *fname);
-struct Body *pgp_gpgme_make_key_attachment(char *tempf);
+struct Body *pgp_gpgme_make_key_attachment(void);
int pgp_gpgme_send_menu(struct Header *msg);
struct Body *pgp_gpgme_sign_message(struct Body *a);
int pgp_gpgme_verify_one(struct Body *sigbdy, struct State *s, const char *tempfile);
struct Body *(*pgp_encrypt_message)(struct Body *a, char *keylist, int sign);
/**
* pgp_make_key_attachment - Generate a public key attachment
- * @param tempf Filename to use (OPTIONAL)
* @retval ptr New Body containing the attachment
* @retval NULL Error
*/
- struct Body *(*pgp_make_key_attachment)(char *tempf);
+ struct Body *(*pgp_make_key_attachment)(void);
/**
* pgp_check_traditional - Look for inline (non-MIME) PGP content
* @param fp File pointer to the current attachment
/**
* crypt_pgp_make_key_attachment - Wrapper for CryptModuleSpecs::pgp_make_key_attachment()
*/
-struct Body *crypt_pgp_make_key_attachment(char *tempf)
+struct Body *crypt_pgp_make_key_attachment(void)
{
if (CRYPT_MOD_CALL_CHECK(PGP, pgp_make_key_attachment))
- return (CRYPT_MOD_CALL(PGP, pgp_make_key_attachment))(tempf);
+ return (CRYPT_MOD_CALL(PGP, pgp_make_key_attachment))();
return NULL;
}
int crypt_pgp_encrypted_handler(struct Body *a, struct State *s);
void crypt_pgp_extract_keys_from_attachment_list(FILE *fp, int tag, struct Body *top);
void crypt_pgp_invoke_getkeys(struct Address *addr);
-struct Body *crypt_pgp_make_key_attachment(char *tempf);
+struct Body *crypt_pgp_make_key_attachment(void);
int crypt_pgp_send_menu(struct Header *msg);
int crypt_smime_application_handler(struct Body *m, struct State *s);
int crypt_smime_decrypt_mime(FILE *a, FILE **b, struct Body *c, struct Body **d);
/**
* pgp_class_make_key_attachment - Implements CryptModuleSpecs::pgp_make_key_attachment()
*/
-struct Body *pgp_class_make_key_attachment(char *tempf)
+struct Body *pgp_class_make_key_attachment(void)
{
struct Body *att = NULL;
char buf[LONG_STRING];
- char tempfb[PATH_MAX], tmp[STRING];
+ char tempf[PATH_MAX], tmp[STRING];
FILE *tempfp = NULL;
FILE *devnull = NULL;
struct stat sb;
snprintf(tmp, sizeof(tmp), "0x%s", pgp_fpr_or_lkeyid(pgp_principal_key(key)));
pgp_free_key(&key);
- if (!tempf)
- {
- mutt_mktemp(tempfb, sizeof(tempfb));
- tempf = tempfb;
- }
+ mutt_mktemp(tempf, sizeof(tempf));
- tempfp = mutt_file_fopen(tempf, tempf == tempfb ? "w" : "a");
+ tempfp = mutt_file_fopen(tempf, "w");
if (!tempfp)
{
mutt_perror(_("Can't create temporary file"));
{
mutt_perror(_("Can't open /dev/null"));
mutt_file_fclose(&tempfp);
- if (tempf == tempfb)
- unlink(tempf);
+ unlink(tempf);
return NULL;
}
PGP_SECRING, /**< Secret keys */
};
-struct Body *pgp_class_make_key_attachment(char *tempf);
+struct Body *pgp_class_make_key_attachment(void);
struct PgpKeyInfo *pgp_ask_for_key(char *tag, char *whatfor, short abilities, enum PgpRing keyring);
struct PgpKeyInfo *pgp_getkeybyaddr(struct Address *a, short abilities, enum PgpRing keyring, bool oppenc_mode);
struct Body *b = NULL;
if (((WithCrypto & APPLICATION_PGP) != 0) &&
- (b = crypt_pgp_make_key_attachment(NULL)) == NULL)
+ (b = crypt_pgp_make_key_attachment()) == NULL)
{
return -1;
}