void crypt_extract_keys_from_messages (HEADER * h)
{
int i;
- char tempfname[_POSIX_PATH_MAX], *mbox;
+ BUFFER *tempfname = NULL;
+ char *mbox;
ADDRESS *tmp = NULL;
FILE *fpout;
if (!WithCrypto)
return;
- mutt_mktemp (tempfname, sizeof (tempfname));
- if (!(fpout = safe_fopen (tempfname, "w")))
+ tempfname = mutt_buffer_pool_get ();
+ mutt_buffer_mktemp (tempfname);
+ if (!(fpout = safe_fopen (mutt_b2s (tempfname), "w")))
{
- mutt_perror (tempfname);
- return;
+ mutt_perror (mutt_b2s (tempfname));
+ goto cleanup;
}
if ((WithCrypto & APPLICATION_PGP))
fflush(fpout);
mutt_endwin (_("Trying to extract PGP keys...\n"));
- crypt_pgp_invoke_import (tempfname);
+ crypt_pgp_invoke_import (mutt_b2s (tempfname));
}
if ((WithCrypto & APPLICATION_SMIME)
if (mbox)
{
mutt_endwin (_("Trying to extract S/MIME certificates...\n"));
- crypt_smime_invoke_import (tempfname, mbox);
+ crypt_smime_invoke_import (mutt_b2s (tempfname), mbox);
tmp = NULL;
}
}
mutt_copy_message (fpout, Context, h, MUTT_CM_DECODE|MUTT_CM_CHARCONV, 0);
fflush(fpout);
mutt_endwin (_("Trying to extract PGP keys...\n"));
- crypt_pgp_invoke_import (tempfname);
+ crypt_pgp_invoke_import (mutt_b2s (tempfname));
}
if ((WithCrypto & APPLICATION_SMIME)
if (mbox) /* else ? */
{
mutt_message (_("Trying to extract S/MIME certificates...\n"));
- crypt_smime_invoke_import (tempfname, mbox);
+ crypt_smime_invoke_import (mutt_b2s (tempfname), mbox);
}
}
}
if (isendwin())
mutt_any_key_to_continue (NULL);
- mutt_unlink (tempfname);
+ mutt_unlink (mutt_b2s (tempfname));
if ((WithCrypto & APPLICATION_PGP))
unset_option (OPTDONTHANDLEPGPKEYS);
+
+cleanup:
+ mutt_buffer_pool_release (&tempfname);
}
int mutt_signed_handler (BODY *a, STATE *s)
{
- char tempfile[_POSIX_PATH_MAX];
+ BUFFER *tempfile = NULL;
int signed_type;
int inconsistent = 0;
if (sigcnt)
{
- mutt_mktemp (tempfile, sizeof (tempfile));
- if (crypt_write_signed (a, s, tempfile) == 0)
+ tempfile = mutt_buffer_pool_get ();
+ mutt_buffer_mktemp (tempfile);
+ if (crypt_write_signed (a, s, mutt_b2s (tempfile)) == 0)
{
for (i = 0; i < sigcnt; i++)
{
&& signatures[i]->type == TYPEAPPLICATION
&& !ascii_strcasecmp (signatures[i]->subtype, "pgp-signature"))
{
- if (crypt_pgp_verify_one (signatures[i], s, tempfile) != 0)
+ if (crypt_pgp_verify_one (signatures[i], s, mutt_b2s (tempfile)) != 0)
goodsig = 0;
continue;
&& (!ascii_strcasecmp(signatures[i]->subtype, "x-pkcs7-signature")
|| !ascii_strcasecmp(signatures[i]->subtype, "pkcs7-signature")))
{
- if (crypt_smime_verify_one (signatures[i], s, tempfile) != 0)
+ if (crypt_smime_verify_one (signatures[i], s, mutt_b2s (tempfile)) != 0)
goodsig = 0;
continue;
}
}
- mutt_unlink (tempfile);
+ mutt_unlink (mutt_b2s (tempfile));
+ mutt_buffer_pool_release (&tempfile);
b->goodsig = goodsig;
b->badsig = !goodsig;
-static char *smime_extract_certificate (char *infile)
+static char *smime_extract_certificate (const char *infile)
{
FILE *fpout = NULL, *fperr = NULL;
char pk7out[_POSIX_PATH_MAX], certfile[_POSIX_PATH_MAX];
/* Add a certificate and update index file (externally). */
-void smime_invoke_import (char *infile, char *mailbox)
+void smime_invoke_import (const char *infile, const char *mailbox)
{
char tmpfname[_POSIX_PATH_MAX], *certfile = NULL, buf[STRING];
FILE *smimein=NULL, *fpout = NULL, *fperr = NULL;