diff --git a/TODO b/TODO index 469c4d901..c29e13b9b 100644 --- a/TODO +++ b/TODO @@ -40,6 +40,8 @@ * New option --file-remove path-to-wipe-program ? + * Add an is_valid flag to each user ID. + Scheduled for 1.1 ----------------- * David C Niemi pointed out that the code for --no-default-keyring does not diff --git a/doc/ChangeLog b/doc/ChangeLog index 9e08e41cf..b121f95d3 100644 --- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,7 @@ +2001-03-13 Werner Koch + + * gpg.sgml: Described --fixed-list-mode. + 2001-03-06 Werner Koch * gpgv.sgml: Changed some gpg to gpgv. Thanks to John A. Murdie. diff --git a/doc/DETAILS b/doc/DETAILS index 731d7c091..98a37029d 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -18,6 +18,7 @@ ssb::1536:20:5CE086B5B5A18FF4:1998-07-07:0::: letter, but be prepared that additional information may follow in some future versions. (not used for secret keys) o = Unknown (this key is new to the system) + i = The key is invalid (e.g. due to a missing self-signature) d = The key has been disabled r = The key has been revoked e = The key has expired diff --git a/doc/gpg.sgml b/doc/gpg.sgml index 67af72bc7..1a8ecf41c 100644 --- a/doc/gpg.sgml +++ b/doc/gpg.sgml @@ -1352,6 +1352,12 @@ can get a faster listing. The excact behaviour of this option may change in future versions. + +--fixed-list-mode + +Do not merge user ID and primary key in --with-colon listing mode. + + --list-only diff --git a/g10/ChangeLog b/g10/ChangeLog index a60d63c23..f8728d49a 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,5 +1,8 @@ 2001-03-13 Werner Koch + * main.c, options.h: New option fixed_list_mode. + * keylist.c (list_keyblock_colon): use it here. + * getkey.c (merge_keys_and_selfsig): Divert merging of public keys to the function used in key selection.. * keylist.c (is_uid_valid): Removed. diff --git a/g10/g10.c b/g10/g10.c index f0f9e8caa..e960384ff 100644 --- a/g10/g10.c +++ b/g10/g10.c @@ -203,6 +203,7 @@ enum cmd_and_opt_values { aNull = 0, oTryAllSecrets, oTrustedKey, oNoExpensiveTrustChecks, + oFixedListMode, oEmu3DESS2KBug, /* will be removed in 1.1 */ oEmuMDEncodeBug, aTest }; @@ -385,6 +386,7 @@ static ARGPARSE_OPTS opts[] = { { oSetFilesize, "set-filesize", 20, "@" }, { oHonorHttpProxy,"honor-http-proxy", 0, "@" }, { oFastListMode,"fast-list-mode", 0, "@" }, + { oFixedListMode,"fixed-list-mode", 0, "@" }, { oListOnly, "list-only", 0, "@"}, { oIgnoreTimeConflict, "ignore-time-conflict", 0, "@" }, { oIgnoreCrcError, "ignore-crc-error", 0,"@" }, @@ -965,6 +967,7 @@ main( int argc, char **argv ) 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; + case oFixedListMode: opt.fixed_list_mode = 1; break; case oListOnly: opt.list_only=1; break; case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break; case oIgnoreCrcError: opt.ignore_crc_error = 1; break; diff --git a/g10/keylist.c b/g10/keylist.c index df5050f1c..308bb83e3 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -322,7 +322,6 @@ list_keyblock_print ( KBNODE keyblock, int secret ) } -/* FIXME: print info about revoked keys. */ static void list_keyblock_colon( KBNODE keyblock, int secret ) { @@ -360,17 +359,23 @@ list_keyblock_colon( KBNODE keyblock, int secret ) pk = node->pkt->pkt.public_key; sk = NULL; keyid_from_pk( pk, keyid ); - if ( opt.fast_list_mode || opt.no_expensive_trust_checks ) { - fputs( "pub::", stdout ); - trustletter = 0; - } + fputs( "pub:", stdout ); + trustletter = 0; + if ( !pk->is_valid ) + putchar ('i'); + else if ( pk->is_revoked ) + putchar ('r'); + else if ( pk->has_expired ) + putchar ('e'); + else if ( opt.fast_list_mode || opt.no_expensive_trust_checks ) + ; else { trustletter = query_trust_info( pk, NULL ); if( trustletter == 'u' ) ulti_hack = 1; - printf("pub:%c:", trustletter ); + putchar(trustletter); } - printf("%u:%d:%08lX%08lX:%s:%s:", + printf(":%u:%d:%08lX%08lX:%s:%s:", nbits_from_pk( pk ), pk->pubkey_algo, (ulong)keyid[0],(ulong)keyid[1], @@ -384,11 +389,27 @@ list_keyblock_colon( KBNODE keyblock, int secret ) putchar( get_ownertrust_info( pk->local_id ) ); putchar(':'); } + + if (opt.fixed_list_mode) { + /* do not merge the first uid with the primary key */ + putchar(':'); + putchar('\n'); + if( opt.fingerprint ) + fingerprint( pk, sk ); + if( opt.with_key_data ) + print_key_data( pk, keyid ); + any = 1; + } for( kbctx=NULL; (node=walk_kbnode( keyblock, &kbctx, 0)) ; ) { if( node->pkt->pkttype == PKT_USER_ID && !opt.fast_list_mode ) { + /* + * Fixme: We need a is_valid flag here too + */ if( any ) { - if ( opt.no_expensive_trust_checks ) { + if ( node->pkt->pkt.user_id->is_revoked ) + printf("uid:r::::::::"); + else if ( opt.no_expensive_trust_checks ) { printf("uid:::::::::"); } else { @@ -397,8 +418,8 @@ list_keyblock_colon( KBNODE keyblock, int secret ) if( pk && !ulti_hack ) { if( node->pkt->pkt.user_id->photo ) rmd160_hash_buffer( namehash, - node->pkt->pkt.user_id->name, - node->pkt->pkt.user_id->len ); + node->pkt->pkt.user_id->photo, + node->pkt->pkt.user_id->photolen); else rmd160_hash_buffer( namehash, node->pkt->pkt.user_id->name, @@ -410,7 +431,6 @@ list_keyblock_colon( KBNODE keyblock, int secret ) printf("uid:%c::::::::", trustletter); } } - /* FIXME: check that uID is valid here too */ print_string( stdout, node->pkt->pkt.user_id->name, node->pkt->pkt.user_id->len, ':' ); putchar(':'); @@ -434,16 +454,20 @@ list_keyblock_colon( KBNODE keyblock, int secret ) any = 1; } - - keyid_from_pk( pk2, keyid2 ); - if ( opt.fast_list_mode || opt.no_expensive_trust_checks ) { - fputs( "sub::", stdout ); - } + fputs ("sub:", stdout ); + if ( !pk2->is_valid ) + putchar ('i'); + else if ( pk2->is_revoked ) + putchar ('r'); + else if ( pk2->has_expired ) + putchar ('e'); + else if ( opt.fast_list_mode || opt.no_expensive_trust_checks ) + ; else { - printf("sub:%c:", trustletter ); + printf("%c", trustletter ); } - printf("%u:%d:%08lX%08lX:%s:%s:", + printf(":%u:%d:%08lX%08lX:%s:%s:", nbits_from_pk( pk2 ), pk2->pubkey_algo, (ulong)keyid2[0],(ulong)keyid2[1], diff --git a/g10/options.h b/g10/options.h index 20e60e6b9..54fd0df32 100644 --- a/g10/options.h +++ b/g10/options.h @@ -89,6 +89,7 @@ struct { ulong set_filesize; int honor_http_proxy; int fast_list_mode; + int fixed_list_mode; int ignore_time_conflict; int ignore_crc_error; int command_fd;