mutt stable branch with some hacks

Modified version of Byrial Jensen's signature verification patch.

+58 -19
+3 -2
commands.c
··· 143 143 pager_t info; 144 144 145 145 #ifdef HAVE_PGP 146 - if (cur->pgp & PGPGOODSIGN) 147 - mutt_message _("PGP signature successfully verified."); 146 + mutt_message ((cur->pgp & PGPGOODSIGN) ? 147 + _("PGP signature successfully verified.") : 148 + _("PGP signature could NOT be verified.")); 148 149 #endif 149 150 150 151 /* Invoke the builtin pager */
+2
contrib/pgp2.rc
··· 44 44 # read in the secret key ring 45 45 set pgp_list_secring_command="pgpring -s -2 %r" 46 46 47 + # pattern for good signature 48 + set pgp_good_sign="Good signature"
+3
contrib/pgp5.rc
··· 11 11 # verify a pgp/mime signature 12 12 set pgp_verify_command="pgpv +language=mutt +verbose=0 +batchmode --OutputInformationFD=1 %f %s" 13 13 14 + # string that the verify command outputs if the signature is good 15 + set pgp_good_sign = "Good signature" 16 + 14 17 # decrypt a pgp/mime attachment 15 18 set pgp_decrypt_command="PGPPASSFD=0; export PGPPASSFD; cat - %f | pgpv +language=mutt +verbose=0 +batchmode --OutputInformationFD=2 -f" 16 19
+13 -12
doc/manual.sgml.head
··· 199 199 Zero or more of the following ``flags'' may appear, which mean: 200 200 201 201 <p> 202 - <tscreen><verb> 203 - D message is deleted 204 - K contains a PGP public key 205 - M requires mailcap to view 206 - N message is new 207 - O message is old 208 - P message is PGP encrypted 209 - r message has been replied to 210 - S message is PGP signed 211 - ! message is flagged 212 - * message is tagged 213 - </verb></tscreen> 202 + <descrip> 203 + <tag/D/ message is deleted (is marked for deletion) 204 + <tag/d/ message have attachments marked for deletion 205 + <tag/K/ contains a PGP public key 206 + <tag/N/ message is new 207 + <tag/O/ message is old 208 + <tag/P/ message is PGP encrypted 209 + <tag/r/ message has been replied to 210 + <tag/S/ message is PGP signed, and the signature is succesfully verified 211 + <tag/s/ message is PGP signed 212 + <tag/!/ message is flagged 213 + <tag/*/ message is tagged 214 + </descrip> 214 215 215 216 Some of the status flags can be turned on or off using 216 217 <itemize>
+8
init.h
··· 1102 1102 ** .dt %[<s>] .dd date of the key where <s> is an strftime(3) expression 1103 1103 ** .de 1104 1104 */ 1105 + { "pgp_good_sign", DT_RX, R_NONE, UL &PgpGoodSign, UL "" }, 1106 + /* 1107 + ** .pp 1108 + ** If you assign a text to this variable, then a PGP signature is only 1109 + ** considered verified if the output from $$pgp_verify_command contains 1110 + ** the text. Use this variable if the exit code from the command is 0 1111 + ** even for bad signatures. 1112 + */ 1105 1113 { "pgp_long_ids", DT_BOOL, R_NONE, OPTPGPLONGIDS, 0 }, 1106 1114 /* 1107 1115 ** .pp
+27 -5
pgp.c
··· 550 550 char sigfile[_POSIX_PATH_MAX], pgperrfile[_POSIX_PATH_MAX]; 551 551 FILE *fp, *pgpout, *pgperr; 552 552 pid_t thepid; 553 - int rv = -1; 554 - 553 + int badsig = -1; 554 + 555 555 snprintf (sigfile, sizeof (sigfile), "%s.asc", tempfile); 556 556 557 557 if(!(fp = safe_fopen (sigfile, "w"))) ··· 578 578 -1, -1, fileno(pgperr), 579 579 tempfile, sigfile)) != -1) 580 580 { 581 - mutt_copy_stream(pgpout, s->fpout); 581 + if (PgpGoodSign.pattern) 582 + { 583 + char *line = NULL; 584 + int lineno = 0; 585 + size_t linelen; 586 + 587 + while ((line = mutt_read_line (line, &linelen, pgpout, &lineno)) != NULL) 588 + { 589 + if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) 590 + badsig = 0; 591 + 592 + fputs (line, s->fpout); 593 + fputc ('\n', s->fpout); 594 + } 595 + safe_free ((void **) &line); 596 + } 597 + else 598 + { 599 + mutt_copy_stream(pgpout, s->fpout); 600 + badsig = 0; 601 + } 602 + 582 603 fclose (pgpout); 583 604 fflush(pgperr); 584 605 rewind(pgperr); 585 606 mutt_copy_stream(pgperr, s->fpout); 586 607 fclose(pgperr); 587 608 588 - rv = mutt_wait_filter (thepid); 609 + if (mutt_wait_filter (thepid)) 610 + badsig = -1; 589 611 } 590 612 591 613 state_puts (_("[-- End of PGP output --]\n\n"), s); ··· 593 615 mutt_unlink (sigfile); 594 616 mutt_unlink (pgperrfile); 595 617 596 - return rv; 618 + return badsig; 597 619 } 598 620 599 621 /*
+2
pgp.h
··· 21 21 22 22 #include "pgplib.h" 23 23 24 + WHERE REGEXP PgpGoodSign; 25 + 24 26 WHERE char *PgpSignAs; 25 27 WHERE char *PgpSignMicalg; 26 28 WHERE short PgpTimeout;