1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-10 13:04:23 +01:00

* getkey.c (merge_selfsigs_main), main.h, sig-check.c

(check_key_signature2): Pass the ultimately trusted pk directly to
check_key_signature2 to avoid going through the key selection mechanism.
This prevents a deadly embrace when two keys without selfsigs each sign
the other.
This commit is contained in:
David Shaw 2002-12-28 04:08:53 +00:00
parent 1fb55cd173
commit 63246fe693
4 changed files with 21 additions and 9 deletions

View File

@ -1,5 +1,11 @@
2002-12-27 David Shaw <dshaw@jabberwocky.com> 2002-12-27 David Shaw <dshaw@jabberwocky.com>
* getkey.c (merge_selfsigs_main), main.h, sig-check.c
(check_key_signature2): Pass the ultimately trusted pk directly to
check_key_signature2 to avoid going through the key selection
mechanism. This prevents a deadly embrace when two keys without
selfsigs each sign the other.
* keyserver.c (keyserver_refresh): Don't print the "refreshing..." * keyserver.c (keyserver_refresh): Don't print the "refreshing..."
line if there are no keys to refresh or if there is no keyserver line if there are no keys to refresh or if there is no keyserver
set. set.

View File

@ -1576,6 +1576,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
else if ( k->pkt->pkttype == PKT_SIGNATURE && uidnode ) else if ( k->pkt->pkttype == PKT_SIGNATURE && uidnode )
{ {
PKT_signature *sig = k->pkt->pkt.signature; PKT_signature *sig = k->pkt->pkt.signature;
u32 dummy;
int dum2;
if(sig->keyid[0] != kid[0] || sig->keyid[1]!=kid[1]) if(sig->keyid[0] != kid[0] || sig->keyid[1]!=kid[1])
{ {
@ -1583,9 +1585,10 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
ultimate_pk=m_alloc_clear(sizeof(*ultimate_pk)); ultimate_pk=m_alloc_clear(sizeof(*ultimate_pk));
if(get_pubkey_fast(ultimate_pk,sig->keyid)==0 && if(get_pubkey_fast(ultimate_pk,sig->keyid)==0
check_key_signature(keyblock,k,NULL)==0 && && check_key_signature2(keyblock,k,ultimate_pk,
get_ownertrust(ultimate_pk)==TRUST_ULTIMATE) NULL,&dummy,&dum2)==0
&& get_ownertrust(ultimate_pk)==TRUST_ULTIMATE)
{ {
free_public_key(ultimate_pk); free_public_key(ultimate_pk);
pk->is_valid=1; pk->is_valid=1;

View File

@ -110,7 +110,7 @@ int sign_symencrypt_file (const char *fname, STRLIST locusr);
/*-- sig-check.c --*/ /*-- sig-check.c --*/
int check_revocation_keys (PKT_public_key *pk, PKT_signature *sig); int check_revocation_keys (PKT_public_key *pk, PKT_signature *sig);
int check_key_signature( KBNODE root, KBNODE node, int *is_selfsig ); int check_key_signature( KBNODE root, KBNODE node, int *is_selfsig );
int check_key_signature2( KBNODE root, KBNODE node, int check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *pk,
int *is_selfsig, u32 *r_expiredate, int *r_expired ); int *is_selfsig, u32 *r_expiredate, int *r_expired );
/*-- delkey.c --*/ /*-- delkey.c --*/

View File

@ -475,15 +475,16 @@ check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
{ {
u32 dummy; u32 dummy;
int dum2; int dum2;
return check_key_signature2(root, node, is_selfsig, &dummy, &dum2 ); return check_key_signature2(root, node, NULL, is_selfsig, &dummy, &dum2 );
} }
/* If pk is NULL, then it is set from ROOT. Note that is_selfsig is
set from the pk. */
int int
check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig, check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *pk,
u32 *r_expiredate, int *r_expired ) int *is_selfsig, u32 *r_expiredate, int *r_expired )
{ {
MD_HANDLE md; MD_HANDLE md;
PKT_public_key *pk;
PKT_signature *sig; PKT_signature *sig;
int algo; int algo;
int rc; int rc;
@ -495,7 +496,9 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
assert( node->pkt->pkttype == PKT_SIGNATURE ); assert( node->pkt->pkttype == PKT_SIGNATURE );
assert( root->pkt->pkttype == PKT_PUBLIC_KEY ); assert( root->pkt->pkttype == PKT_PUBLIC_KEY );
if(pk==NULL)
pk = root->pkt->pkt.public_key; pk = root->pkt->pkt.public_key;
sig = node->pkt->pkt.signature; sig = node->pkt->pkt.signature;
algo = sig->digest_algo; algo = sig->digest_algo;