if (fgets (buf, sizeof (buf), idx))
cert_num++;
}
- fclose (idx);
+ m_fclose(&idx);
for (;;) {
*qry = 0;
cur++;
}
- fclose (idx);
+ m_fclose(&idx);
/* Make Helpstring */
helpstr[0] = 0;
fpout = m_tempfile (tmpfname, sizeof(tmpfname), NONULL(Tempdir), NULL);
if (!fpout) {
- fclose (fperr);
+ m_fclose(&fperr);
mutt_perror (tmpfname);
return 1;
}
certificate, NULL, NULL, NULL, NULL, NULL,
SmimeGetCertEmailCommand)) == -1) {
mutt_message (_("Error: unable to create OpenSSL subprocess!"));
- fclose (fperr);
- fclose (fpout);
+ m_fclose(&fperr);
+ m_fclose(&fpout);
return 1;
}
else if (copy)
ret = 2;
- fclose (fpout);
- fclose (fperr);
+ m_fclose(&fpout);
+ m_fclose(&fperr);
return ret;
}
fpout = m_tempfile (pk7out, sizeof(tmpfname), NONULL(Tempdir), NULL);
if (!fpout) {
- fclose (fperr);
+ m_fclose(&fperr);
mutt_perror (pk7out);
return NULL;
}
SmimePk7outCommand)) == -1) {
mutt_any_key_to_continue (_
("Error: unable to create OpenSSL subprocess!"));
- fclose (fperr);
- fclose (fpout);
+ m_fclose(&fperr);
+ m_fclose(&fpout);
mutt_unlink (pk7out);
return NULL;
}
empty = (fgetc (fpout) == EOF);
- fclose (fpout);
+ m_fclose(&fpout);
if (empty) {
mutt_perror (pk7out);
mutt_copy_stream (fperr, stdout);
- fclose (fperr);
+ m_fclose(&fperr);
mutt_unlink (pk7out);
return NULL;
}
fpout = m_tempfile (certfile, sizeof(certfile), NONULL(Tempdir), NULL);
if (!fpout) {
- fclose (fperr);
+ m_fclose(&fperr);
mutt_unlink (pk7out);
mutt_perror (certfile);
return NULL;
SmimeGetCertCommand)) == -1) {
mutt_any_key_to_continue (_
("Error: unable to create OpenSSL subprocess!"));
- fclose (fperr);
- fclose (fpout);
+ m_fclose(&fperr);
+ m_fclose(&fpout);
mutt_unlink (pk7out);
mutt_unlink (certfile);
return NULL;
empty = (fgetc (fpout) == EOF);
if (empty) {
mutt_copy_stream (fperr, stdout);
- fclose (fpout);
- fclose (fperr);
+ m_fclose(&fpout);
+ m_fclose(&fperr);
mutt_unlink (certfile);
return NULL;
}
- fclose (fpout);
- fclose (fperr);
+ m_fclose(&fpout);
+ m_fclose(&fperr);
return m_strdup(certfile);
}
m_tempfile (certfile, sizeof(certfile), NONULL(Tempdir), NULL);
if (!fpout) {
- fclose (fperr);
+ m_fclose(&fperr);
mutt_perror (certfile);
return NULL;
}
SmimeGetSignerCertCommand)) == -1) {
mutt_any_key_to_continue (_
("Error: unable to create OpenSSL subprocess!"));
- fclose (fperr);
- fclose (fpout);
+ m_fclose(&fperr);
+ m_fclose(&fpout);
mutt_unlink (pk7out);
mutt_unlink (certfile);
return NULL;
rewind (fperr);
fflush (fperr);
empty = (fgetc (fpout) == EOF);
+ m_fclose(&fpout);
+
if (empty) {
mutt_endwin (NULL);
mutt_copy_stream (fperr, stdout);
mutt_any_key_to_continue (NULL);
- fclose (fpout);
- fclose (fperr);
+ m_fclose(&fperr);
mutt_unlink (certfile);
return NULL;
}
- fclose (fpout);
- fclose (fperr);
+ m_fclose(&fperr);
return m_strdup(certfile);
}
fpout = m_tempfile (tmpfname, sizeof(tmpfname), NONULL(Tempdir), NULL);
if (!fpout) {
- fclose (fperr);
+ m_fclose(&fperr);
mutt_perror (tmpfname);
return;
}
}
fputs (buf, smimein);
fputc ('\n', smimein);
- fclose (smimein);
+ m_fclose(&smimein);
mutt_wait_filter (thepid);
mutt_copy_stream (fpout, stdout);
mutt_copy_stream (fperr, stdout);
- fclose (fpout);
- fclose (fperr);
-
+ m_fclose(&fpout);
+ m_fclose(&fperr);
}
-
-
int smime_verify_sender (HEADER * h)
{
char *mbox = NULL, *certfile, tempfname[_POSIX_PATH_MAX];
mutt_copy_message (fpout, Context, h, 0, 0);
fflush (fpout);
- fclose (fpout);
+ m_fclose(&fpout);
if (h->env->from) {
h->env->from = mutt_expand_aliases (h->env->from);
smimeerr = m_tempfile (smimeerrfile, sizeof(smimeerrfile), NONULL(Tempdir), NULL);
if (!smimeerr) {
mutt_perror (smimeerrfile);
- fclose (fpout);
+ m_fclose(&fpout);
mutt_unlink (tempfile);
return NULL;
}
if (!fptmp) {
mutt_perror (smimeinfile);
mutt_unlink (tempfile);
- fclose (fpout);
- fclose (smimeerr);
+ m_fclose(&fpout);
+ m_fclose(&smimeerr);
return NULL;
}
mutt_write_mime_header (a, fptmp);
fputc ('\n', fptmp);
mutt_write_mime_body (a, fptmp);
- fclose (fptmp);
+ m_fclose(&fptmp);
if ((thepid =
smime_invoke_encrypt (&smimein, NULL, NULL, -1,
fileno (fpout), fileno (smimeerr),
smimeinfile, certfile)) == -1) {
- fclose (smimeerr);
+ m_fclose(&smimeerr);
mutt_unlink (smimeinfile);
mutt_unlink (certfile);
return (NULL);
}
- fclose (smimein);
+ m_fclose(&smimein);
mutt_wait_filter (thepid);
mutt_unlink (smimeinfile);
fflush (fpout);
rewind (fpout);
empty = (fgetc (fpout) == EOF);
- fclose (fpout);
+ m_fclose(&fpout);
fflush (smimeerr);
rewind (smimeerr);
err = 1;
fputs (buf, stdout);
}
- fclose (smimeerr);
+ m_fclose(&smimeerr);
/* pause if there is any error output from SMIME */
if (err)
smimeout = m_tempfile (signedfile, sizeof(signedfile), NONULL(Tempdir), NULL);
if (!smimeout) {
mutt_perror (signedfile);
- fclose (sfp);
+ m_fclose(&sfp);
mutt_unlink (filetosign);
return NULL;
}
mutt_write_mime_header (a, sfp);
fputc ('\n', sfp);
mutt_write_mime_body (a, sfp);
- fclose (sfp);
+ m_fclose(&sfp);
filetosign)) == -1) {
mutt_perror (_("Can't open OpenSSL subprocess!"));
- fclose (smimeout);
+ m_fclose(&smimeout);
mutt_unlink (signedfile);
mutt_unlink (filetosign);
return NULL;
}
fputs (SmimePass, smimein);
fputc ('\n', smimein);
- fclose (smimein);
+ m_fclose(&smimein);
mutt_wait_filter (thepid);
err = 1;
fputs (buffer, stdout);
}
- fclose (smimeerr);
+ m_fclose(&smimeerr);
fflush (smimeout);
rewind (smimeout);
empty = (fgetc (smimeout) == EOF);
- fclose (smimeout);
+ m_fclose(&smimeout);
mutt_unlink (filetosign);
sigbdy->length = ftello (s->fpout);
sigbdy->offset = 0;
- fclose (s->fpout);
+ m_fclose(&s->fpout);
/* restore final destination and substitute the tempfile for input */
s->fpout = fp;
if ((thepid = smime_invoke_verify (NULL, &smimeout, NULL,
-1, -1, fileno (smimeerr),
tempfile, signedfile, 0)) != -1) {
- fflush (smimeout);
- fclose (smimeout);
+ m_fclose(&smimeout);
if (mutt_wait_filter (thepid))
badsig = -1;
fflush (smimeerr);
rewind (smimeerr);
mutt_copy_stream (smimeerr, s->fpout);
- fclose (smimeerr);
+ m_fclose(&smimeerr);
state_attach_puts (_("[-- End of OpenSSL output --]\n\n"), s);
sigbdy->offset = tmpoffset;
/* restore the original source stream */
- fclose (s->fpin);
+ m_fclose(&s->fpin);
s->fpin = fp;
smimeerr = m_tempfile(errfile, sizeof(errfile), NONULL(Tempdir), NULL);
if (!smimeerr) {
mutt_perror (errfile);
- fclose (smimeout);
+ m_fclose(&smimeout);
return NULL;
}
mutt_unlink (errfile);
tmpfp = m_tempfile (tmpfname, sizeof(tmpfname), NONULL(Tempdir), NULL);
if (!tmpfp) {
mutt_perror (tmpfname);
- fclose (smimeout);
- fclose (smimeerr);
+ m_fclose(&smimeout);
+ m_fclose(&smimeerr);
return NULL;
}
last_pos = m->offset;
mutt_copy_bytes (s->fpin, tmpfp, m->length);
-
- fflush (tmpfp);
- fclose (tmpfp);
+ m_fclose(&tmpfp);
if ((type & ENCRYPT) &&
(thepid = smime_invoke_decrypt (&smimein, NULL, NULL, -1,
fileno (smimeout), fileno (smimeerr),
tmpfname)) == -1) {
- fclose (smimeout);
- smimeout = NULL;
+ m_fclose(&smimeout);
mutt_unlink (tmpfname);
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: unable to create OpenSSL subprocess! --]\n"), s);
fileno (smimeout),
fileno (smimeerr), NULL, tmpfname,
SIGNOPAQUE)) == -1) {
- fclose (smimeout);
- smimeout = NULL;
+ m_fclose(&smimeout);
mutt_unlink (tmpfname);
if (s->flags & M_DISPLAY)
state_attach_puts (_("[-- Error: unable to create OpenSSL subprocess! --]\n"), s);
fputc ('\n', smimein);
}
- fclose (smimein);
+ m_fclose(&smimein);
mutt_wait_filter (thepid);
mutt_unlink (tmpfname);
fpout = m_tempfile (tmptmpfname, sizeof(tmptmpfname), NONULL(Tempdir), NULL);
if (!fpout) {
mutt_perror (tmptmpfname);
- fclose (smimeout);
+ m_fclose(&smimeout);
return NULL;
}
}
}
}
- fclose (smimeout);
- smimeout = NULL;
+ m_fclose(&smimeout);
mutt_unlink (outfile);
if (!outFile) {
- fclose (fpout);
+ m_fclose(&fpout);
mutt_unlink (tmptmpfname);
}
fpout = NULL;
m->goodsig = p->goodsig;
m->badsig = p->badsig;
}
- fclose (smimeerr);
+ m_fclose(&smimeerr);
return (p);
}