pager_t info;
#ifdef HAVE_PGP
- if (cur->pgp & PGPGOODSIGN)
- mutt_message _("PGP signature successfully verified.");
+ mutt_message ((cur->pgp & PGPGOODSIGN) ?
+ _("PGP signature successfully verified.") :
+ _("PGP signature could NOT be verified."));
#endif
/* Invoke the builtin pager */
# read in the secret key ring
set pgp_list_secring_command="pgpring -s -2 %r"
+# pattern for good signature
+set pgp_good_sign="Good signature"
# verify a pgp/mime signature
set pgp_verify_command="pgpv +language=mutt +verbose=0 +batchmode --OutputInformationFD=1 %f %s"
+# string that the verify command outputs if the signature is good
+set pgp_good_sign = "Good signature"
+
# decrypt a pgp/mime attachment
set pgp_decrypt_command="PGPPASSFD=0; export PGPPASSFD; cat - %f | pgpv +language=mutt +verbose=0 +batchmode --OutputInformationFD=2 -f"
Zero or more of the following ``flags'' may appear, which mean:
<p>
-<tscreen><verb>
-D message is deleted
-K contains a PGP public key
-M requires mailcap to view
-N message is new
-O message is old
-P message is PGP encrypted
-r message has been replied to
-S message is PGP signed
-! message is flagged
-* message is tagged
-</verb></tscreen>
+<descrip>
+<tag/D/ message is deleted (is marked for deletion)
+<tag/d/ message have attachments marked for deletion
+<tag/K/ contains a PGP public key
+<tag/N/ message is new
+<tag/O/ message is old
+<tag/P/ message is PGP encrypted
+<tag/r/ message has been replied to
+<tag/S/ message is PGP signed, and the signature is succesfully verified
+<tag/s/ message is PGP signed
+<tag/!/ message is flagged
+<tag/*/ message is tagged
+</descrip>
Some of the status flags can be turned on or off using
<itemize>
** .dt %[<s>] .dd date of the key where <s> is an strftime(3) expression
** .de
*/
+ { "pgp_good_sign", DT_RX, R_NONE, UL &PgpGoodSign, UL "" },
+ /*
+ ** .pp
+ ** If you assign a text to this variable, then a PGP signature is only
+ ** considered verified if the output from $$pgp_verify_command contains
+ ** the text. Use this variable if the exit code from the command is 0
+ ** even for bad signatures.
+ */
{ "pgp_long_ids", DT_BOOL, R_NONE, OPTPGPLONGIDS, 0 },
/*
** .pp
char sigfile[_POSIX_PATH_MAX], pgperrfile[_POSIX_PATH_MAX];
FILE *fp, *pgpout, *pgperr;
pid_t thepid;
- int rv = -1;
-
+ int badsig = -1;
+
snprintf (sigfile, sizeof (sigfile), "%s.asc", tempfile);
if(!(fp = safe_fopen (sigfile, "w")))
-1, -1, fileno(pgperr),
tempfile, sigfile)) != -1)
{
- mutt_copy_stream(pgpout, s->fpout);
+ if (PgpGoodSign.pattern)
+ {
+ char *line = NULL;
+ int lineno = 0;
+ size_t linelen;
+
+ while ((line = mutt_read_line (line, &linelen, pgpout, &lineno)) != NULL)
+ {
+ if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0)
+ badsig = 0;
+
+ fputs (line, s->fpout);
+ fputc ('\n', s->fpout);
+ }
+ safe_free ((void **) &line);
+ }
+ else
+ {
+ mutt_copy_stream(pgpout, s->fpout);
+ badsig = 0;
+ }
+
fclose (pgpout);
fflush(pgperr);
rewind(pgperr);
mutt_copy_stream(pgperr, s->fpout);
fclose(pgperr);
- rv = mutt_wait_filter (thepid);
+ if (mutt_wait_filter (thepid))
+ badsig = -1;
}
state_puts (_("[-- End of PGP output --]\n\n"), s);
mutt_unlink (sigfile);
mutt_unlink (pgperrfile);
- return rv;
+ return badsig;
}
/*
#include "pgplib.h"
+WHERE REGEXP PgpGoodSign;
+
WHERE char *PgpSignAs;
WHERE char *PgpSignMicalg;
WHERE short PgpTimeout;