One more warning
[pgp-tools.git] / caff / gpgdiff
1 diff -ur gnupg-1.3.6.orig/g10/keyedit.c gnupg-1.3.6/g10/keyedit.c
2 --- gnupg-1.3.6.orig/g10/keyedit.c 2004-05-22 13:26:00.000000000 +0200
3 +++ gnupg-1.3.6/g10/keyedit.c 2004-06-12 15:32:51.219996456 +0200
4 @@ -136,48 +136,68 @@
5 break;
6 }
7 if( sigrc != '?' || print_without_key ) {
8 - tty_printf("%s%c%c %c%c%c%c%c%c %s %s",
9 - is_rev? "rev":"sig",sigrc,
10 - (sig->sig_class-0x10>0 &&
11 - sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
12 - sig->flags.exportable?' ':'L',
13 - sig->flags.revocable?' ':'R',
14 - sig->flags.policy_url?'P':' ',
15 - sig->flags.notation?'N':' ',
16 - sig->flags.expired?'X':' ',
17 - (sig->trust_depth>9)?'T':
18 - (sig->trust_depth>0)?'0'+sig->trust_depth:' ',
19 - keystr(sig->keyid),datestr_from_sig(sig));
20 - if(opt.list_options&LIST_SHOW_SIG_EXPIRE)
21 - tty_printf(" %s",expirestr_from_sig(sig));
22 - tty_printf(" ");
23 - if( sigrc == '%' )
24 - tty_printf("[%s] ", g10_errstr(rc) );
25 - else if( sigrc == '?' )
26 - ;
27 - else if( *is_selfsig ) {
28 - tty_printf( is_rev? _("[revocation]")
29 - : _("[self-signature]") );
30 - }
31 - else
32 - {
33 + if (opt.with_colons) {
34 size_t n;
35 - char *p = get_user_id( sig->keyid, &n );
36 - tty_print_utf8_string2( p, n, opt.screen_columns-keystrlen()-26 );
37 - m_free(p);
38 - }
39 - tty_printf("\n");
40
41 - if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY_URLS))
42 - show_policy_url(sig,3,0);
43 + printf("%s:%c::%d:%08lX%08lX:%s:%s:::",
44 + is_rev? "rev":"sig", sigrc,
45 + sig->pubkey_algo,
46 + (ulong)sig->keyid[0], (ulong)sig->keyid[1],
47 + colon_datestr_from_sig(sig),
48 + colon_expirestr_from_sig(sig));
49 + if( sigrc != '%' && sigrc != '?') {
50 + char *p;
51 + p = get_user_id( sig->keyid, &n);
52 + print_string( stdout, p, n, ':' );
53 + m_free(p);
54 + };
55 + printf(":%02x%c:\n",
56 + sig->sig_class,sig->flags.exportable?'x':'l'
57 + );
58 + } else {
59 + tty_printf("%s%c%c %c%c%c%c%c%c %s %s",
60 + is_rev? "rev":"sig",sigrc,
61 + (sig->sig_class-0x10>0 &&
62 + sig->sig_class-0x10<4)?'0'+sig->sig_class-0x10:' ',
63 + sig->flags.exportable?' ':'L',
64 + sig->flags.revocable?' ':'R',
65 + sig->flags.policy_url?'P':' ',
66 + sig->flags.notation?'N':' ',
67 + sig->flags.expired?'X':' ',
68 + (sig->trust_depth>9)?'T':
69 + (sig->trust_depth>0)?'0'+sig->trust_depth:' ',
70 + keystr(sig->keyid),datestr_from_sig(sig));
71 + if(opt.list_options&LIST_SHOW_SIG_EXPIRE)
72 + tty_printf(" %s",expirestr_from_sig(sig));
73 + tty_printf(" ");
74 + if( sigrc == '%' )
75 + tty_printf("[%s] ", g10_errstr(rc) );
76 + else if( sigrc == '?' )
77 + ;
78 + else if( *is_selfsig ) {
79 + tty_printf( is_rev? _("[revocation]")
80 + : _("[self-signature]") );
81 + }
82 + else
83 + {
84 + size_t n;
85 + char *p = get_user_id( sig->keyid, &n );
86 + tty_print_utf8_string2( p, n, opt.screen_columns-keystrlen()-26 );
87 + m_free(p);
88 + }
89 + tty_printf("\n");
90 +
91 + if(sig->flags.policy_url && (opt.list_options&LIST_SHOW_POLICY_URLS))
92 + show_policy_url(sig,3,0);
93
94 - if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
95 - show_notation(sig,3,0,
96 - ((opt.list_options&LIST_SHOW_STD_NOTATIONS)?1:0)+
97 - ((opt.list_options&LIST_SHOW_USER_NOTATIONS)?2:0));
98 + if(sig->flags.notation && (opt.list_options&LIST_SHOW_NOTATIONS))
99 + show_notation(sig,3,0,
100 + ((opt.list_options&LIST_SHOW_STD_NOTATIONS)?1:0)+
101 + ((opt.list_options&LIST_SHOW_USER_NOTATIONS)?2:0));
102
103 - if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
104 - show_keyserver_url(sig,3,0);
105 + if(sig->flags.pref_ks && (opt.list_options&LIST_SHOW_KEYSERVER_URLS))
106 + show_keyserver_url(sig,3,0);
107 + }
108 }
109
110 return (sigrc == '!');
111 @@ -1812,7 +1832,7 @@
112 else {
113 tty_printf(" ");
114 for(i=0; prefs[i].type; i++ ) {
115 - tty_printf( " %c%d", prefs[i].type == PREFTYPE_SYM ? 'S' :
116 + tty_printf( " %c%d", prefs[i].type == PREFTYPE_SYM ? 'S' :
117 prefs[i].type == PREFTYPE_HASH ? 'H' :
118 prefs[i].type == PREFTYPE_ZIP ? 'Z':'?',
119 prefs[i].value);
120 @@ -1826,6 +1846,82 @@
121 }
122
123
124 +/* This shows one uid, in an easy to parse format and does not translate utf8 */
125 +static void
126 +show_one_uid_colon (KBNODE node, int index, PKT_public_key *primary, int ulti_hack, int pk_version)
127 +{
128 + int j;
129 + assert ( node->pkt->pkttype == PKT_USER_ID );
130 + PKT_user_id *uid = node->pkt->pkt.user_id;
131 +
132 + if(uid->attrib_data)
133 + printf("uat:");
134 + else
135 + printf("uid:");
136 +
137 + if ( uid->is_revoked )
138 + printf("r::::::::");
139 + else if ( uid->is_expired )
140 + printf("e::::::::");
141 + else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
142 + printf("::::::::");
143 + else
144 + {
145 + int uid_validity;
146 +
147 + if( primary && !ulti_hack )
148 + uid_validity = get_validity_info( primary, uid );
149 + else
150 + uid_validity = 'u';
151 + printf("%c::::::::",uid_validity);
152 + }
153 +
154 + if(uid->attrib_data)
155 + printf ("%u %lu",uid->numattribs,uid->attrib_len);
156 + else
157 + print_string (stdout, uid->name, uid->len, ':');
158 +
159 + putchar (':');
160 + /* signature class */
161 + putchar (':');
162 + /* capabilities */
163 + putchar (':');
164 + /* preferences */
165 + if (pk_version>3 || uid->selfsigversion>3)
166 + {
167 + const prefitem_t *prefs = uid->prefs;
168 +
169 + for (j=0; prefs && prefs[j].type; j++)
170 + {
171 + if (j)
172 + putchar (' ');
173 + printf ("%c%d", prefs[j].type == PREFTYPE_SYM ? 'S' :
174 + prefs[j].type == PREFTYPE_HASH ? 'H' :
175 + prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
176 + prefs[j].value);
177 + }
178 + if (uid->mdc_feature)
179 + printf (",mdc");
180 + if (!uid->ks_modify)
181 + printf (",no-ks-modify");
182 + }
183 + putchar (':');
184 + /* flags */
185 + printf ("%d,", index);
186 + if (uid->is_primary)
187 + putchar ('p');
188 + if (uid->is_revoked)
189 + putchar ('r');
190 + if (uid->is_expired)
191 + putchar ('e');
192 + if ((node->flag & NODFLG_SELUID))
193 + putchar ('s');
194 + if ((node->flag & NODFLG_MARK_A))
195 + putchar ('m');
196 + putchar (':');
197 + putchar('\n');
198 +}
199 +
200 /* This is the version of show_key_with_all_names used when
201 opt.with_colons is used. It prints all available data in a easy to
202 parse format and does not translate utf8 */
203 @@ -1905,80 +2001,12 @@
204
205 /* the user ids */
206 i = 0;
207 - for (node = keyblock; node; node = node->next)
208 + for (node = keyblock; node; node = node->next)
209 {
210 if ( node->pkt->pkttype == PKT_USER_ID )
211 {
212 - PKT_user_id *uid = node->pkt->pkt.user_id;
213 -
214 ++i;
215 -
216 - if(uid->attrib_data)
217 - printf("uat:");
218 - else
219 - printf("uid:");
220 -
221 - if ( uid->is_revoked )
222 - printf("r::::::::");
223 - else if ( uid->is_expired )
224 - printf("e::::::::");
225 - else if ( opt.fast_list_mode || opt.no_expensive_trust_checks )
226 - printf("::::::::");
227 - else
228 - {
229 - int uid_validity;
230 -
231 - if( primary && !ulti_hack )
232 - uid_validity = get_validity_info( primary, uid );
233 - else
234 - uid_validity = 'u';
235 - printf("%c::::::::",uid_validity);
236 - }
237 -
238 - if(uid->attrib_data)
239 - printf ("%u %lu",uid->numattribs,uid->attrib_len);
240 - else
241 - print_string (stdout, uid->name, uid->len, ':');
242 -
243 - putchar (':');
244 - /* signature class */
245 - putchar (':');
246 - /* capabilities */
247 - putchar (':');
248 - /* preferences */
249 - if (pk_version>3 || uid->selfsigversion>3)
250 - {
251 - const prefitem_t *prefs = uid->prefs;
252 -
253 - for (j=0; prefs && prefs[j].type; j++)
254 - {
255 - if (j)
256 - putchar (' ');
257 - printf ("%c%d", prefs[j].type == PREFTYPE_SYM ? 'S' :
258 - prefs[j].type == PREFTYPE_HASH ? 'H' :
259 - prefs[j].type == PREFTYPE_ZIP ? 'Z':'?',
260 - prefs[j].value);
261 - }
262 - if (uid->mdc_feature)
263 - printf (",mdc");
264 - if (!uid->ks_modify)
265 - printf (",no-ks-modify");
266 - }
267 - putchar (':');
268 - /* flags */
269 - printf ("%d,", i);
270 - if (uid->is_primary)
271 - putchar ('p');
272 - if (uid->is_revoked)
273 - putchar ('r');
274 - if (uid->is_expired)
275 - putchar ('e');
276 - if ((node->flag & NODFLG_SELUID))
277 - putchar ('s');
278 - if ((node->flag & NODFLG_MARK_A))
279 - putchar ('m');
280 - putchar (':');
281 - putchar('\n');
282 + show_one_uid_colon(node, i, primary, ulti_hack, pk_version);
283 }
284 }
285 }
286 @@ -2506,17 +2534,23 @@
287 KBNODE node;
288 PKT_user_id *uid = NULL;
289 int changed=0;
290 + KBNODE uidnode = NULL;
291
292 for( node = pub_keyblock; node; node = node->next ) {
293 if( node->pkt->pkttype == PKT_USER_ID ) {
294 uid = (node->flag & NODFLG_SELUID)? node->pkt->pkt.user_id : NULL;
295 + uidnode = node;
296 }
297 else if( uid && node->pkt->pkttype == PKT_SIGNATURE ) {
298 int okay, valid, selfsig, inv_sig, no_key, other_err;
299
300 - tty_printf("uid ");
301 - tty_print_utf8_string( uid->name, uid->len );
302 - tty_printf("\n");
303 + if (opt.with_colons)
304 + show_one_uid_colon (uidnode, 0, NULL, 0, 0); /* FIXME: pk_version */
305 + else {
306 + tty_printf("uid ");
307 + tty_print_utf8_string( uid->name, uid->len );
308 + tty_printf("\n");
309 + }
310
311 okay = inv_sig = no_key = other_err = 0;
312 valid = print_and_check_one_sig( pub_keyblock, node,
313 diff -ur gnupg-1.3.6.orig/g10/status.c gnupg-1.3.6/g10/status.c
314 --- gnupg-1.3.6.orig/g10/status.c 2004-05-22 13:19:05.000000000 +0200
315 +++ gnupg-1.3.6/g10/status.c 2004-06-12 15:25:53.142553888 +0200
316 @@ -590,6 +590,9 @@
317 {
318 char *p;
319
320 + fflush(stdout);
321 + fflush(stderr);
322 +
323 if( opt.command_fd != -1 )
324 return do_get_from_fd ( keyword, 0, 0 );
325 #ifdef USE_SHM_COPROCESSING
326 @@ -607,6 +610,9 @@
327 {
328 char *p;
329
330 + fflush(stdout);
331 + fflush(stderr);
332 +
333 if( opt.command_fd != -1 )
334 return do_get_from_fd ( keyword, 0, 0 );
335 #ifdef USE_SHM_COPROCESSING
336 @@ -643,6 +649,9 @@
337 {
338 char *p;
339
340 + fflush(stdout);
341 + fflush(stderr);
342 +
343 if( opt.command_fd != -1 )
344 return do_get_from_fd ( keyword, 1, 0 );
345 #ifdef USE_SHM_COPROCESSING
346 @@ -679,6 +688,9 @@
347 int yes;
348 char *p;
349
350 + fflush(stdout);
351 + fflush(stderr);
352 +
353 if( opt.command_fd != -1 )
354 return !!do_get_from_fd ( keyword, 0, 1 );
355 #ifdef USE_SHM_COPROCESSING
356 @@ -707,6 +719,9 @@
357 int yes;
358 char *p;
359
360 + fflush(stdout);
361 + fflush(stderr);
362 +
363 if( opt.command_fd != -1 )
364 return !!do_get_from_fd ( keyword, 0, 1 );
365 #ifdef USE_SHM_COPROCESSING
366 @@ -739,6 +754,9 @@
367 char *answer = NULL;
368 char *p;
369
370 + fflush(stdout);
371 + fflush(stderr);
372 +
373 if( opt.command_fd != -1 )
374 answer = do_get_from_fd ( keyword, 0, 0 );
375 #ifdef USE_SHM_COPROCESSING