From e247a0b3e0d0895eda987b0d237794265ae27b68 Mon Sep 17 00:00:00 2001 From: David Shaw Date: Fri, 3 Jan 2003 21:41:53 +0000 Subject: [PATCH] * import.c (import_one): Only do the work to create the status display for interactive import if status is enabled. * keyring.c (keyring_search): skipfnc didn't work properly with non-keyid searches. Noted by Stefan Bellon. * getkey.c (merge_selfsigs_main): Remove some unused code and make sure that the pk selfsigversion member accounts for 1F direct sigs. --- g10/ChangeLog | 12 ++++++++++++ g10/getkey.c | 20 ++++++++++++-------- g10/import.c | 3 ++- g10/keyring.c | 2 +- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 0dc91c63d..e2c1be152 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,15 @@ +2003-01-03 David Shaw + + * import.c (import_one): Only do the work to create the status + display for interactive import if status is enabled. + + * keyring.c (keyring_search): skipfnc didn't work properly with + non-keyid searches. Noted by Stefan Bellon. + + * getkey.c (merge_selfsigs_main): Remove some unused code and make + sure that the pk selfsigversion member accounts for 1F direct + sigs. + 2003-01-02 Werner Koch * keydb.c (keydb_add_resource): Don't assume that try_make_homedir diff --git a/g10/getkey.c b/g10/getkey.c index 0e41f2d7c..e729b97c2 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1314,7 +1314,7 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) PKT_public_key *pk = NULL; KBNODE k; u32 kid[2]; - u32 sigdate = 0, uiddate=0, uiddate2; + u32 sigdate, uiddate, uiddate2; KBNODE signode, uidnode, uidnode2; u32 curtime = make_timestamp (); unsigned int key_usage = 0; @@ -1397,7 +1397,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) else { sigdate = sig->timestamp; signode = k; - sigversion = sig->version; + if( sig->version > sigversion ) + sigversion = sig->version; } } @@ -1495,7 +1496,6 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) /* second pass: look at the self-signature of all user IDs */ signode = uidnode = NULL; sigdate = 0; /* helper to find the latest signature in one user ID */ - uiddate = 0; /* and over of all user IDs */ for(k=keyblock; k && k->pkt->pkttype != PKT_PUBLIC_SUBKEY; k = k->next ) { if ( k->pkt->pkttype == PKT_USER_ID ) { if ( uidnode && signode ) @@ -1505,8 +1505,6 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) } uidnode = k; signode = NULL; - if ( sigdate > uiddate ) - uiddate = sigdate; sigdate = 0; } else if ( k->pkt->pkttype == PKT_SIGNATURE && uidnode ) { @@ -1602,9 +1600,15 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked ) } } - /* Record the highest selfsigversion so we know if this is a v3 - key through and through, or a v3 key with a v4 selfsig, which - means we can trust the preferences (if any). */ + /* Record the highest selfsig version so we know if this is a v3 + key through and through, or a v3 key with a v4 selfsig + somewhere. This is useful in a few places to know if the key + must be treated as PGP2-style or OpenPGP-style. Note that a + selfsig revocation with a higher version number will also raise + this value. This is okay since such a revocation must be + issued by the user (i.e. it cannot be issued by someone else to + modify the key behavior.) */ + pk->selfsigversion=sigversion; /* Now that we had a look at all user IDs we can now get some information diff --git a/g10/import.c b/g10/import.c index 8196d6c84..200b53360 100644 --- a/g10/import.c +++ b/g10/import.c @@ -630,7 +630,8 @@ import_one( const char *fname, KBNODE keyblock, } if (opt.interactive) { - print_import_check (pk, uidnode->pkt->pkt.user_id); + if(is_status_enabled()) + print_import_check (pk, uidnode->pkt->pkt.user_id); merge_keys_and_selfsig (keyblock); tty_printf ("\n"); show_basic_key_info (keyblock); diff --git a/g10/keyring.c b/g10/keyring.c index 405167122..caa8df8b5 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -866,6 +866,7 @@ keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc) PKT_user_id *uid = NULL; PKT_public_key *pk = NULL; PKT_secret_key *sk = NULL; + u32 aki[2]; /* figure out what information we need */ need_uid = need_words = need_keyid = need_fpr = any_skip = 0; @@ -968,7 +969,6 @@ keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc) { byte afp[MAX_FINGERPRINT_LEN]; size_t an; - u32 aki[2]; if (pkt.pkttype == PKT_PUBLIC_KEY || pkt.pkttype == PKT_SECRET_KEY) {