aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--g10/getkey.c10
-rw-r--r--g10/packet.h1
2 files changed, 7 insertions, 4 deletions
diff --git a/g10/getkey.c b/g10/getkey.c
index e66be0de0..37a5b565c 100644
--- a/g10/getkey.c
+++ b/g10/getkey.c
@@ -2510,6 +2510,7 @@ merge_selfsigs_subkey (KBNODE keyblock, KBNODE subnode)
keytimestamp = subpk->timestamp;
subpk->flags.valid = 0;
+ subpk->flags.exact = 0;
subpk->main_keyid[0] = mainpk->main_keyid[0];
subpk->main_keyid[1] = mainpk->main_keyid[1];
@@ -2836,6 +2837,8 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
u32 latest_date;
KBNODE latest_key;
+ PKT_public_key *pk;
+
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
@@ -2850,6 +2853,8 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
assert (k->pkt->pkttype == PKT_PUBLIC_KEY
|| k->pkt->pkttype == PKT_PUBLIC_SUBKEY);
foundk = k;
+ pk = k->pkt->pkt.public_key;
+ pk->flags.exact = 1;
break;
}
}
@@ -2893,8 +2898,6 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
/* Either start a loop or check just this one subkey. */
for (k = foundk ? foundk : keyblock; k; k = nextk)
{
- PKT_public_key *pk;
-
if (foundk)
/* If FOUNDK is not NULL, then only consider that exact
key, i.e., don't iterate. */
@@ -2968,7 +2971,6 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
- we're just considering the primary key. */
if ((!latest_key && !ctx->exact) || foundk == keyblock || req_prim)
{
- PKT_public_key *pk;
if (DBG_LOOKUP && !foundk && !req_prim)
log_debug ("\tno suitable subkeys found - trying primary\n");
pk = keyblock->pkt->pkt.public_key;
@@ -3015,7 +3017,7 @@ found:
if (latest_key)
{
- PKT_public_key *pk = latest_key->pkt->pkt.public_key;
+ pk = latest_key->pkt->pkt.public_key;
if (pk->user_id)
free_user_id (pk->user_id);
pk->user_id = scopy_user_id (foundu);
diff --git a/g10/packet.h b/g10/packet.h
index 9eb16cfd8..16524f801 100644
--- a/g10/packet.h
+++ b/g10/packet.h
@@ -298,6 +298,7 @@ typedef struct
unsigned int dont_cache:1; /* Do not cache this key. */
unsigned int backsig:2; /* 0=none, 1=bad, 2=good. */
unsigned int serialno_valid:1;/* SERIALNO below is valid. */
+ unsigned int exact:1; /* Found via exact (!) search. */
} flags;
PKT_user_id *user_id; /* If != NULL: found by that uid. */
struct revocation_key *revkey;