From be441babaafb4c0c1ae5f72cb5d1b26619b75475 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Tue, 9 Mar 2004 20:49:31 +0000 Subject: [PATCH] * import.c (import_one): Try and collapse user IDs when importing a key for the first time. * build-packet.c (do_comment, do_user_id): Try for a headerlen of 2 since that's the smallest and most likely encoding for these packets * keyedit.c (menu_addrevoker): Allow appointing a subkey as a designated revoker if the user forces it via keyid!, so long as the subkey can certify. Also use the proper date string when prompting for confirmation. --- g10/ChangeLog | 14 ++++++++++++++ g10/build-packet.c | 4 ++-- g10/import.c | 3 +++ g10/keyedit.c | 13 ++++--------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 909d43a44..fbd3da6c8 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,17 @@ +2004-03-09 David Shaw + + * import.c (import_one): Try and collapse user IDs when importing + a key for the first time. + + * build-packet.c (do_comment, do_user_id): Try for a headerlen of + 2 since that's the smallest and most likely encoding for these + packets + + * keyedit.c (menu_addrevoker): Allow appointing a subkey as a + designated revoker if the user forces it via keyid!, so long as + the subkey can certify. Also use the proper date string when + prompting for confirmation. + 2004-03-01 Werner Koch * options.h (ctrl): New for member IN_AUTO_KEY_RETRIEVE. diff --git a/g10/build-packet.c b/g10/build-packet.c index ad0619052..f583828a8 100644 --- a/g10/build-packet.c +++ b/g10/build-packet.c @@ -196,7 +196,7 @@ do_comment( IOBUF out, int ctb, PKT_comment *rem ) { if( opt.sk_comments ) { - write_header2(out, ctb, rem->len, 1, 1); + write_header2(out, ctb, rem->len, 2, 1); if( iobuf_write( out, rem->data, rem->len ) ) return G10ERR_WRITE_FILE; } @@ -214,7 +214,7 @@ do_user_id( IOBUF out, int ctb, PKT_user_id *uid ) } else { - write_header2( out, ctb, uid->len, 1, 1 ); + write_header2( out, ctb, uid->len, 2, 1 ); if( iobuf_write( out, uid->name, uid->len ) ) return G10ERR_WRITE_FILE; } diff --git a/g10/import.c b/g10/import.c index ecfb0afcb..ac1749bb1 100644 --- a/g10/import.c +++ b/g10/import.c @@ -637,6 +637,9 @@ import_one( const char *fname, KBNODE keyblock, int fast, } if( opt.verbose > 1 ) log_info (_("writing to `%s'\n"), keydb_get_resource_name (hd) ); + + collapse_uids(&keyblock); + rc = keydb_insert_keyblock (hd, keyblock ); if (rc) log_error (_("error writing keyring `%s': %s\n"), diff --git a/g10/keyedit.c b/g10/keyedit.c index 0ef891a8e..af0c241ef 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2476,8 +2476,10 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive ) goto fail; } + /* Note that I'm requesting SIG here and not CERT. We're making + a certification, but it is okay to be a subkey. */ + revoker_pk->req_usage=PUBKEY_USAGE_SIG; rc=get_pubkey_byname(revoker_pk,answer,NULL,NULL,1); - if(rc) { log_error (_("key `%s' not found: %s\n"),answer,g10_errstr(rc)); @@ -2485,13 +2487,6 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive ) continue; } - if(!revoker_pk->is_primary) - { - log_error(_("cannot appoint a subkey as a designated revoker\n")); - m_free(answer); - continue; - } - m_free(answer); fingerprint_from_pk(revoker_pk,revkey.fpr,&fprlen); @@ -2517,7 +2512,7 @@ menu_addrevoker( KBNODE pub_keyblock, KBNODE sec_keyblock, int sensitive ) tty_printf("\npub %4u%c/%08lX %s ", nbits_from_pk( revoker_pk ), pubkey_letter( revoker_pk->pubkey_algo ), - (ulong)keyid[1], datestr_from_pk(pk) ); + (ulong)keyid[1], datestr_from_pk(revoker_pk) ); p = get_user_id( keyid, &n ); tty_print_utf8_string( p, n );