diff options
author | David Shaw <[email protected]> | 2004-03-22 20:56:30 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2004-03-22 20:56:30 +0000 |
commit | 2980b7129f70364ac31ccc17eb6b62eaa5330c03 (patch) | |
tree | 2766a6ebb24a04d4337a850a018657a951c08447 | |
parent | * keygen.c (write_keybinding, do_generate_keypair, generate_subkeypair): (diff) | |
download | gnupg-2980b7129f70364ac31ccc17eb6b62eaa5330c03.tar.gz gnupg-2980b7129f70364ac31ccc17eb6b62eaa5330c03.zip |
* packet.h, getkey.c (fixup_uidnode, merge_selfsigs_subkey): Keep track of
which self-sig we actually chose.
* keyedit.c (menu_expire, menu_set_primary_uid, menu_set_preferences): Use
it here to avoid updating non-used self-sigs and possibly promoting an old
self-sig into consideration again.
-rw-r--r-- | g10/ChangeLog | 10 | ||||
-rw-r--r-- | g10/getkey.c | 2 | ||||
-rw-r--r-- | g10/keyedit.c | 13 | ||||
-rw-r--r-- | g10/packet.h | 1 |
4 files changed, 22 insertions, 4 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index 6f512c0cf..58cd2cddd 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,13 @@ +2004-03-22 David Shaw <[email protected]> + + * packet.h, getkey.c (fixup_uidnode, merge_selfsigs_subkey): Keep + track of which self-sig we actually chose. + + * keyedit.c (menu_expire, menu_set_primary_uid, + menu_set_preferences): Use it here to avoid updating non-used + self-sigs and possibly promoting an old self-sig into + consideration again. + 2004-03-18 David Shaw <[email protected]> * keygen.c (write_keybinding, do_generate_keypair, diff --git a/g10/getkey.c b/g10/getkey.c index 590068b77..171d8216c 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1266,6 +1266,7 @@ fixup_uidnode ( KBNODE uidnode, KBNODE signode, u32 keycreated ) const byte *p, *sym, *hash, *zip; size_t n, nsym, nhash, nzip; + sig->flags.chosen_selfsig = 1; /* we chose this one */ uid->created = 0; /* not created == invalid */ if ( IS_UID_REV ( sig ) ) { uid->is_revoked = 1; @@ -1887,6 +1888,7 @@ merge_selfsigs_subkey( KBNODE keyblock, KBNODE subnode ) subpk->is_valid = 1; sig = signode->pkt->pkt.signature; + sig->flags.chosen_selfsig=1; /* so we know which selfsig we chose later */ p = parse_sig_subpkt (sig->hashed, SIGSUBPKT_KEY_FLAGS, &n ); if ( p && n ) { diff --git a/g10/keyedit.c b/g10/keyedit.c index af0c241ef..1bac865b3 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2637,7 +2637,9 @@ menu_expire( KBNODE pub_keyblock, KBNODE sec_keyblock ) if( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] && ( (mainkey && uid && uid->created && (sig->sig_class&~3) == 0x10) - || (!mainkey && sig->sig_class == 0x18) ) ) { + || (!mainkey && sig->sig_class == 0x18) ) + && sig->flags.chosen_selfsig ) + { /* this is a selfsignature which is to be replaced */ PKT_signature *newsig; PACKET *newpkt; @@ -2777,8 +2779,10 @@ menu_set_primary_uid ( KBNODE pub_keyblock, KBNODE sec_keyblock ) else if ( main_pk && uid && node->pkt->pkttype == PKT_SIGNATURE ) { PKT_signature *sig = node->pkt->pkt.signature; if ( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] - && (uid && (sig->sig_class&~3) == 0x10) - && attribute == (uid->attrib_data!=NULL)) { + && (uid && (sig->sig_class&~3) == 0x10) + && attribute == (uid->attrib_data!=NULL) + && sig->flags.chosen_selfsig ) + { if(sig->version < 4) { char *user=utf8_to_native(uid->name,strlen(uid->name),0); @@ -2887,7 +2891,8 @@ menu_set_preferences (KBNODE pub_keyblock, KBNODE sec_keyblock ) && node->pkt->pkttype == PKT_SIGNATURE ) { PKT_signature *sig = node->pkt->pkt.signature; if ( keyid[0] == sig->keyid[0] && keyid[1] == sig->keyid[1] - && (uid && (sig->sig_class&~3) == 0x10) ) { + && (uid && (sig->sig_class&~3) == 0x10) + && sig->flags.chosen_selfsig ) { if( sig->version < 4 ) { char *user=utf8_to_native(uid->name,strlen(uid->name),0); diff --git a/g10/packet.h b/g10/packet.h index 8eb29a8ac..a9b3de5f8 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -125,6 +125,7 @@ typedef struct { struct { unsigned checked:1; /* signature has been checked */ unsigned valid:1; /* signature is good (if checked is set) */ + unsigned chosen_selfsig:1; /* a selfsig that is the chosen one */ unsigned unknown_critical:1; unsigned exportable:1; unsigned revocable:1; |