]> git.pld-linux.org Git - packages/mutt.git/blame - patch-0.95.sec.condense_pgp.1
1.3.17i
[packages/mutt.git] / patch-0.95.sec.condense_pgp.1
CommitLineData
7e5fb030 1--- mutt-1.1.11.orig/init.h Sun Apr 2 23:40:02 2000
2+++ mutt-1.1.11/init.h Sun Apr 2 23:41:08 2000
3@@ -1169,6 +1169,7 @@
4 ** lead to problems with non-verifyable PGP signatures, so only change
5 ** this if you know what you are doing.
6 */
7+ { "pgp_paranoid", DT_BOOL, R_NONE, OPTPGPPARANOID, 0 },
8 { "pgp_timeout", DT_NUM, R_NONE, UL &PgpTimeout, 300 },
9 /*
10 ** .pp
11--- mutt-0.95/mutt.h.orig Sat Dec 12 09:06:47 1998
12+++ mutt-0.95/mutt.h Sun Jan 3 03:39:19 1999
13@@ -309,6 +309,7 @@
14 OPTMHPURGE,
15 OPTMIMEFORWDECODE,
16 OPTPAGERSTOP,
17+ OPTPGPPARANOID,
18 OPTPIPEDECODE,
19 OPTPIPESPLIT,
20 OPTPOPDELETE,
21--- mutt-0.95/patchlist.c.orig Sun Jan 3 03:11:41 1999
22+++ mutt-0.95/patchlist.c Sun Jan 3 03:39:19 1999
23@@ -16,6 +16,8 @@
24
25
26
27+ printf("Feature patch: condense_pgp 0.95 by Stefan `Sec` Zehl\n");
28+
29
30
31 /* DO NOT MODIFY AFTER THIS LINE */
32--- mutt-0.95/pgp.c.orig Sat Dec 12 09:07:00 1998
33+++ mutt-0.95/pgp.c Sun Jan 3 03:41:29 1999
34@@ -216,6 +216,102 @@
35 }
36
37
38+/*
39+ * Scan PGP output; return information about state of signature.
40+ * Flush the message (on stdout).
41+ *
42+ * If strat==0, the message is piped to PGP on stdin, the verified
43+ * message is output on stdout, and runtime messages are on stderr.
44+ * If strat==1, the message comes from a file, and the runtime
45+ * messages are on stdout.
46+ */
47+
48+int
49+mutt_scan_pgp_output (FILE *infile, FILE *outfile, STATE *outstate)
50+{
51+ int sigstate=0, pgpwarning=0;
52+ int nl=0;
53+ char buffer[LONG_STRING];
54+
55+ while (fgets (buffer, sizeof(buffer), infile) != NULL) {
56+ if (strncmp (buffer, "Good signature", 14) == 0)
57+ if (sigstate!=3)
58+ sigstate=1;
59+ if (strncmp (buffer, "WARNING", 7) == 0 &&
60+ strstr (buffer, "not certified") != NULL)
61+ if (sigstate!=3)
62+ sigstate=2;
63+ if (strncmp (buffer, "Bad signature", 13) == 0)
64+ sigstate=3;
65+ if (strncmp (buffer, "\007Key matching", 13) == 0 &&
66+ strstr (buffer, "not found") != NULL)
67+ if (sigstate!=3)
68+ sigstate=4;
69+ if (strncmp (buffer, "WARNING", 7) == 0)
70+ pgpwarning|=1;
71+ if (strncmp (buffer, "\007WARNING", 7) == 0)
72+ pgpwarning|=1;
73+ if (strncmp (buffer, "Error", 5) == 0)
74+ pgpwarning|=2;
75+ if (strncmp (buffer, "\007Error", 5) == 0)
76+ pgpwarning|=2;
77+
78+ /* pgp2 */
79+ if (strncmp(buffer, "\007Key matching", 13) == 0 &&
80+ strstr (buffer, "not found") != NULL)
81+ continue;
82+ if (strncmp(buffer, "File '", 6) == 0 &&
83+ strstr (buffer, "has signature, but with no text") != NULL)
84+ continue;
85+ if (strncmp(buffer, "Text is assumed to be in file '", 31) == 0)
86+ continue;
87+ /* pgp5 */
88+ if (strncmp(buffer, "No files specified. Using stdin.", 33) == 0)
89+ continue;
90+ if (strncmp(buffer, "Opening file \"stdout\" type text.", 32) == 0)
91+ continue;
92+ if (strncmp(buffer, "Message is encrypted.", 21) == 0)
93+ continue;
94+ /* pgp5 bogon makes pgp2 warn */
95+ if (strncmp(buffer, "Warning",7) == 0 &&
96+ strstr (buffer, "header label \"MessageID:\" ignored") != NULL)
97+ continue;
98+
99+ if(buffer[0]=='\n'){
100+ if(nl)continue;
101+ nl=1;
102+ }else{
103+ nl=0;
104+ }
105+ if (outstate) {
106+ if (strlen(buffer)>2 && buffer[strlen(buffer)-2]=='\007')
107+ buffer[strlen(buffer)-2]=' ';
108+ else if (strlen(buffer)>3 && buffer[strlen(buffer)-3]=='\007')
109+ buffer[strlen(buffer)-3]=' ';
110+
111+ if (buffer[0] == '\007') {
112+ state_puts(buffer+1, outstate);
113+ }
114+ else {
115+ state_puts(buffer, outstate);
116+ }
117+ }
118+ if (outfile) {
119+ if (buffer[0] == '\007') {
120+ fputs(buffer+1, outfile);
121+ }
122+ else {
123+ fputs(buffer, outfile);
124+ }
125+ }
126+ }
127+
128+ sigstate |= (pgpwarning<<4);
129+
130+ return sigstate;
131+}
132+
133+
134 /* Support for the Application/PGP Content Type. */
135
136 void application_pgp_handler (BODY *m, STATE *s)
137@@ -334,7 +430,10 @@
138 fclose (pgpin);
139
140 if (s->flags & M_DISPLAY)
141+ if(option(OPTPGPPARANOID))
142 pgp_current_time (s);
143+ else
144+ mutt_scan_pgp_output(pgperr,NULL,s);
145
146 mutt_wait_filter (thepid);
147
148@@ -345,17 +444,17 @@
149 fclose (pgperr);
150
151 if (s->flags & M_DISPLAY)
152- state_puts (_("\n[-- End of PGP output --]\n\n"), s);
153+ state_puts (_("\n[-- End of PGP output --"), s);
154 }
155
156 if(s->flags & M_DISPLAY)
157 {
158 if (needpass)
159- state_puts (_("[-- BEGIN PGP MESSAGE --]\n\n"), s);
160+ state_puts ("BEGIN PGP MESSAGE --]\n\n", s);
161 else if (pgp_keyblock)
162- state_puts (_("[-- BEGIN PGP PUBLIC KEY BLOCK --]\n"), s);
163+ state_puts ("BEGIN PGP PUBLIC KEY BLOCK --]\n", s);
164 else
165- state_puts (_("[-- BEGIN PGP SIGNED MESSAGE --]\n\n"), s);
166+ state_puts ("BEGIN PGP SIGNED MESSAGE --]\n\n", s);
167 }
168
169 /* Use PGP's output if there was no clearsig signature. */
170diff -Nru mutt-1.1.11.orig/pgp.c mutt-1.1.11/pgp.c
171--- mutt-1.1.11.orig/pgp.c Sun Apr 2 23:49:51 2000
172+++ mutt-1.1.11/pgp.c Sun Apr 2 23:51:58 2000
173@@ -678,7 +678,10 @@
174 -1, -1, fileno(pgperr),
175 tempfile, sigfile)) != -1)
176 {
177+ if(option(OPTPGPPARANOID))
178 mutt_copy_stream(pgpout, s->fpout);
179+ else
180+ mutt_scan_pgp_output(pgpout,NULL,s);
181 fclose (pgpout);
182 fflush(pgperr);
183 rewind(pgperr);
This page took 0.04753 seconds and 4 git commands to generate.