changeset: 6425:09be71b645a7
user: Kevin McCarthy <[email protected]>
date: Wed Mar 04 19:24:31 2015 -0800
link: http://dev.mutt.org/hg/mutt/rev/09be71b645a7
Fix pgp_application_pgp_handler to remove all tempfiles.
If multiple PGP blocks are present in an email, Mutt only cleans up the
tempfiles for the last block. Thanks to Dennis Preiser for the patch
and sample mbox file demonstrating the problem.
This patch also fixes the argument to mutt_perror for the pgpout
tempfile.
diffs (31 lines):
diff -r 71f12fef8c6f -r 09be71b645a7 pgp.c
--- a/pgp.c Thu Feb 19 11:00:32 2015 -0800
+++ b/pgp.c Wed Mar 04 19:24:31 2015 -0800
@@ -373,7 +373,7 @@
mutt_mktemp (outfile, sizeof (outfile));
if ((pgpout = safe_fopen (outfile, "w+")) == NULL)
{
- mutt_perror (tmpfname);
+ mutt_perror (outfile);
return -1;
}
@@ -485,6 +485,18 @@
fgetconv_close (&fc);
}
+ /*
+ * Multiple PGP blocks can exist, so these need to be closed and
+ * unlinked inside the loop.
+ */
+ safe_fclose (&tmpfp);
+ mutt_unlink (tmpfname);
+ if (pgpout)
+ {
+ safe_fclose (&pgpout);
+ mutt_unlink (outfile);
+ }
+
if (s->flags & M_DISPLAY)
{
state_putc ('\n', s);