diff options
Diffstat (limited to 'g10')
-rw-r--r-- | g10/ChangeLog | 9 | ||||
-rw-r--r-- | g10/import.c | 52 |
2 files changed, 35 insertions, 26 deletions
diff --git a/g10/ChangeLog b/g10/ChangeLog index fe5c58312..10f889312 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,12 +1,17 @@ -Wed Sep 1 15:30:44 CEST 1999 Werner Koch <[email protected]> +Thu Sep 2 16:40:55 CEST 1999 Werner Koch <[email protected]> + + * import.c (merge_blocks): First add new subkeys, then merge subkey + certificates. + (merge_sigs): Don't merge subkey signatures here. + +Wed Sep 1 15:30:44 CEST 1999 Werner Koch <[email protected]> * keygen.c (ask_expire_interval): Fixed bug related to cpr_xx (tnx Francis J. Lacoste). Tue Aug 31 17:20:44 CEST 1999 Werner Koch <[email protected]> - * plaintext.c (do_hash): Hash CR,LF for a single CR. (ask_for_detached_datafile): Changed arguments to be closer to those of hash_datafiles and cleanup the code a bit. diff --git a/g10/import.c b/g10/import.c index 7cad61a6d..85a45582e 100644 --- a/g10/import.c +++ b/g10/import.c @@ -1052,30 +1052,6 @@ merge_blocks( const char *fname, KBNODE keyblock_orig, KBNODE keyblock, } } - /* merge subkey certificates */ - for(onode=keyblock_orig->next; onode; onode=onode->next ) { - if( !(onode->flag & 1) - && ( onode->pkt->pkttype == PKT_PUBLIC_SUBKEY - || onode->pkt->pkttype == PKT_SECRET_SUBKEY) ) { - /* find the subkey in the imported keyblock */ - for(node=keyblock->next; node; node=node->next ) { - if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY - && !cmp_public_keys( onode->pkt->pkt.public_key, - node->pkt->pkt.public_key ) ) - break; - else if( node->pkt->pkttype == PKT_SECRET_SUBKEY - && !cmp_secret_keys( onode->pkt->pkt.secret_key, - node->pkt->pkt.secret_key ) ) - break; - } - if( node ) { /* found: merge */ - rc = merge_keysigs( onode, node, n_sigs, fname, keyid ); - if( rc ) - return rc; - } - } - } - /* add new subkeys */ for(node=keyblock->next; node; node=node->next ) { onode = NULL; @@ -1109,6 +1085,31 @@ merge_blocks( const char *fname, KBNODE keyblock_orig, KBNODE keyblock, } } + /* merge subkey certificates */ + for(onode=keyblock_orig->next; onode; onode=onode->next ) { + if( !(onode->flag & 1) + && ( onode->pkt->pkttype == PKT_PUBLIC_SUBKEY + || onode->pkt->pkttype == PKT_SECRET_SUBKEY) ) { + /* find the subkey in the imported keyblock */ + for(node=keyblock->next; node; node=node->next ) { + if( node->pkt->pkttype == PKT_PUBLIC_SUBKEY + && !cmp_public_keys( onode->pkt->pkt.public_key, + node->pkt->pkt.public_key ) ) + break; + else if( node->pkt->pkttype == PKT_SECRET_SUBKEY + && !cmp_secret_keys( onode->pkt->pkt.secret_key, + node->pkt->pkt.secret_key ) ) + break; + } + if( node ) { /* found: merge */ + rc = merge_keysigs( onode, node, n_sigs, fname, keyid ); + if( rc ) + return rc; + } + } + } + + return 0; } @@ -1188,6 +1189,9 @@ merge_sigs( KBNODE dst, KBNODE src, int *n_sigs, for(n=src->next; n && n->pkt->pkttype != PKT_USER_ID; n = n->next ) { if( n->pkt->pkttype != PKT_SIGNATURE ) continue; + if( n->pkt->pkt.signature->sig_class == 0x18 + || n->pkt->pkt.signature->sig_class == 0x28 ) + continue; /* skip signatures which are only valid on subkeys */ found = 0; for(n2=dst->next; n2 && n2->pkt->pkttype != PKT_USER_ID; n2 = n2->next){ if( n2->pkt->pkttype == PKT_SIGNATURE |