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>
* 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..."
line if there are no keys to refresh or if there is no keyserver
set.

View File

@ -1576,6 +1576,8 @@ merge_selfsigs_main( KBNODE keyblock, int *r_revoked )
else if ( k->pkt->pkttype == PKT_SIGNATURE && uidnode )
{
PKT_signature *sig = k->pkt->pkt.signature;
u32 dummy;
int dum2;
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));
if(get_pubkey_fast(ultimate_pk,sig->keyid)==0 &&
check_key_signature(keyblock,k,NULL)==0 &&
get_ownertrust(ultimate_pk)==TRUST_ULTIMATE)
if(get_pubkey_fast(ultimate_pk,sig->keyid)==0
&& check_key_signature2(keyblock,k,ultimate_pk,
NULL,&dummy,&dum2)==0
&& get_ownertrust(ultimate_pk)==TRUST_ULTIMATE)
{
free_public_key(ultimate_pk);
pk->is_valid=1;

View File

@ -110,7 +110,7 @@ int sign_symencrypt_file (const char *fname, STRLIST locusr);
/*-- sig-check.c --*/
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_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 );
/*-- delkey.c --*/

View File

@ -475,15 +475,16 @@ check_key_signature( KBNODE root, KBNODE node, int *is_selfsig )
{
u32 dummy;
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
check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
u32 *r_expiredate, int *r_expired )
check_key_signature2( KBNODE root, KBNODE node, PKT_public_key *pk,
int *is_selfsig, u32 *r_expiredate, int *r_expired )
{
MD_HANDLE md;
PKT_public_key *pk;
PKT_signature *sig;
int algo;
int rc;
@ -495,7 +496,9 @@ check_key_signature2( KBNODE root, KBNODE node, int *is_selfsig,
assert( node->pkt->pkttype == PKT_SIGNATURE );
assert( root->pkt->pkttype == PKT_PUBLIC_KEY );
if(pk==NULL)
pk = root->pkt->pkt.public_key;
sig = node->pkt->pkt.signature;
algo = sig->digest_algo;