From deb9c3866f7ad5342799eca9dab234ec27b77867 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Mon, 29 Nov 1999 20:44:31 +0000 Subject: [PATCH] See ChangeLog: Mon Nov 29 21:52:11 CET 1999 Werner Koch --- NEWS | 4 +++- VERSION | 2 +- doc/gpg.sgml | 10 ++++++++++ g10/ChangeLog | 9 +++++++++ g10/g10.c | 3 +++ g10/import.c | 3 ++- g10/keylist.c | 36 +++++++++++++++++++++++------------- g10/mainproc.c | 14 ++++++++------ g10/options.h | 1 + 9 files changed, 60 insertions(+), 22 deletions(-) diff --git a/NEWS b/NEWS index eb3c955fe..f3be8cd2a 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ +Noteworthy changes in version 1.0.x (1999-??-??) +----------------------------------- - * New command --verify-files. + * New command --verify-files. New option --fast-list-mode. * $http_proxy is now used when --honor-http-proxy is set. diff --git a/VERSION b/VERSION index f46fdfcf0..b60339ba5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.0g +1.0.0h diff --git a/doc/gpg.sgml b/doc/gpg.sgml index 17db87bd2..52d9773ac 100644 --- a/doc/gpg.sgml +++ b/doc/gpg.sgml @@ -1222,6 +1222,16 @@ Same as the command --fingerprint but changes only the format of the output and may be used together with another command. + +--fast-list-mode + +Changes the output of the list commands to work faster; this is achieved +by leaving some parts empty. Some applications don't need the user ID and +the trust information given in the listings. By using this options they +can get a faster listing. The excact behaviour of this option may change +in future versions. + + --no-literal diff --git a/g10/ChangeLog b/g10/ChangeLog index 4de854aba..55633c155 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,12 @@ +Mon Nov 29 21:52:11 CET 1999 Werner Koch + + * g10.c: New option --fast-list-mode .. + * keylist.c (list_keyblock): .. and implemented. + * mainproc.c (list_node): Ditto. + + * import.c (mark_non_selfsigned_uids_valid): Fixed the case that there + is a uid without any packet following. + Mon Nov 22 11:14:53 CET 1999 Werner Koch * mainproc.c (proc_plaintext): Never enable the hash processing diff --git a/g10/g10.c b/g10/g10.c index 4fdb78559..ab84e0ddc 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -179,6 +179,7 @@ enum cmd_and_opt_values { aNull = 0, oNoLiteral, oSetFilesize, oHonorHttpProxy, + oFastListMode, oEmu3DESS2KBug, /* will be removed in 1.1 */ aTest }; @@ -347,6 +348,7 @@ static ARGPARSE_OPTS opts[] = { { oNoLiteral, "no-literal", 0, "@" }, { oSetFilesize, "set-filesize", 20, "@" }, { oHonorHttpProxy,"honor-http-proxy", 0, "@" }, + { oFastListMode,"fast-list-mode", 0, "@" }, { oEmu3DESS2KBug, "emulate-3des-s2k-bug", 0, "@"}, {0} }; @@ -873,6 +875,7 @@ main( int argc, char **argv ) case oNoLiteral: opt.no_literal = 1; break; case oSetFilesize: opt.set_filesize = pargs.r.ret_ulong; break; case oHonorHttpProxy: opt.honor_http_proxy = 1; break; + case oFastListMode: opt.fast_list_mode = 1; break; default : pargs.err = configfp? 1:2; break; } diff --git a/g10/import.c b/g10/import.c index 5a6f83f97..88177a533 100644 --- a/g10/import.c +++ b/g10/import.c @@ -794,7 +794,8 @@ mark_non_selfsigned_uids_valid( KBNODE keyblock, u32 *kid ) KBNODE node; for(node=keyblock->next; node; node = node->next ) { if( node->pkt->pkttype == PKT_USER_ID && !(node->flag & 1) ) { - if( node->next && node->next->pkt->pkttype == PKT_SIGNATURE ) { + if( (node->next && node->next->pkt->pkttype == PKT_SIGNATURE) + || !node->next ) { node->flag |= 1; log_info( _("key %08lX: accepted non self-signed user ID '"), (ulong)kid[1]); diff --git a/g10/keylist.c b/g10/keylist.c index 4b973786a..3401fe2f3 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -201,21 +201,26 @@ list_keyblock( KBNODE keyblock, int secret ) sk = NULL; keyid_from_pk( pk, keyid ); if( opt.with_colons ) { - trustletter = query_trust_info( pk, NULL ); - if( trustletter == 'u' ) - ulti_hack = 1; - printf("pub:%c:%u:%d:%08lX%08lX:%s:%s:", - trustletter, + if ( opt.fast_list_mode ) { + fputs( "pub::", stdout ); + trustletter = 0; + } + else { + trustletter = query_trust_info( pk, NULL ); + if( trustletter == 'u' ) + ulti_hack = 1; + printf("pub:%c:", trustletter ); + } + printf("%u:%d:%08lX%08lX:%s:%s:", nbits_from_pk( pk ), pk->pubkey_algo, (ulong)keyid[0],(ulong)keyid[1], datestr_from_pk( pk ), - pk->expiredate? strtimestamp(pk->expiredate):"" - ); + pk->expiredate? strtimestamp(pk->expiredate):"" ); if( pk->local_id ) printf("%lu", pk->local_id ); putchar(':'); - if( pk->local_id ) + if( pk->local_id && !opt.fast_list_mode ) putchar( get_ownertrust_info( pk->local_id ) ); putchar(':'); } @@ -227,9 +232,9 @@ list_keyblock( KBNODE keyblock, int secret ) } for( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; ) { - if( node->pkt->pkttype == PKT_USER_ID ) { + if( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode ) { if( any ) { - if( opt.with_colons ) { + if ( opt.with_colons ) { byte namehash[20]; if( pk && !ulti_hack ) { @@ -283,8 +288,13 @@ list_keyblock( KBNODE keyblock, int secret ) keyid_from_pk( pk2, keyid2 ); if( opt.with_colons ) { - printf("sub:%c:%u:%d:%08lX%08lX:%s:%s:", - trustletter, + if ( opt.fast_list_mode ) { + fputs( "sub::", stdout ); + } + else { + printf("sub:%c:", trustletter ); + } + printf("%u:%d:%08lX%08lX:%s:%s:", nbits_from_pk( pk2 ), pk2->pubkey_algo, (ulong)keyid2[0],(ulong)keyid2[1], @@ -400,7 +410,7 @@ list_keyblock( KBNODE keyblock, int secret ) printf("[%s] ", g10_errstr(rc) ); else if( sigrc == '?' ) ; - else { + else if ( !opt.fast_list_mode ) { size_t n; char *p = get_user_id( sig->keyid, &n ); if( opt.with_colons ) diff --git a/g10/mainproc.c b/g10/mainproc.c index 990c8401b..23b483f8a 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -645,11 +645,13 @@ list_node( CTX c, KBNODE node ) keyid_from_pk( pk, keyid ); if( mainkey ) { c->local_id = pk->local_id; - c->trustletter = query_trust_info( pk, NULL ); + c->trustletter = opt.fast_list_mode? + 0 : query_trust_info( pk, NULL ); } - printf("%s:%c:%u:%d:%08lX%08lX:%s:%s:", - mainkey? "pub":"sub", - c->trustletter, + printf("%s:", mainkey? "pub":"sub" ); + if( c->trustletter ) + putchar( c->trustletter ); + printf(":%u:%d:%08lX%08lX:%s:%s:", nbits_from_pk( pk ), pk->pubkey_algo, (ulong)keyid[0],(ulong)keyid[1], @@ -658,7 +660,7 @@ list_node( CTX c, KBNODE node ) if( c->local_id ) printf("%lu", c->local_id ); putchar(':'); - if( c->local_id ) + if( c->local_id && !opt.fast_list_mode ) putchar( get_ownertrust_info( c->local_id ) ); putchar(':'); if( node->next && node->next->pkt->pkttype == PKT_RING_TRUST) { @@ -848,7 +850,7 @@ list_node( CTX c, KBNODE node ) if( opt.with_colons ) putchar(':'); } - else { + else if( !opt.fast_list_mode ) { p = get_user_id( sig->keyid, &n ); print_string( stdout, p, n, opt.with_colons ); m_free(p); diff --git a/g10/options.h b/g10/options.h index f6f044f80..0fcf3c45d 100644 --- a/g10/options.h +++ b/g10/options.h @@ -84,6 +84,7 @@ struct { int no_literal; ulong set_filesize; int honor_http_proxy; + int fast_list_mode; } opt;