summaryrefslogtreecommitdiffstats
path: root/g10/import.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-07-09 11:07:35 +0200
committerWerner Koch <wk@gnupg.org>2019-07-09 11:12:20 +0200
commiteec150eca78a053193a0994a96482791b5da36be (patch)
tree248d6ec0ef642205ee0d9de9777741f0d6430904 /g10/import.c
parentsm: Fix card access. (diff)
downloadgnupg2-eec150eca78a053193a0994a96482791b5da36be.tar.xz
gnupg2-eec150eca78a053193a0994a96482791b5da36be.zip
gpg: Fix regression in option "self-sigs-only".
* g10/import.c (read_block): Make sure KEYID is availabale also on a pending packet. -- Reported-by: Phil Pennock Fixes-commit: 2e349bb6173789e0e9e42c32873d89c7bc36cea4 Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'g10/import.c')
-rw-r--r--g10/import.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/g10/import.c b/g10/import.c
index ce7602a9f..ceba15b68 100644
--- a/g10/import.c
+++ b/g10/import.c
@@ -866,6 +866,7 @@ read_block( IOBUF a, unsigned int options,
kbnode_t root = NULL;
int in_cert, in_v3key, skip_sigs;
u32 keyid[2];
+ int got_keyid = 0;
unsigned int dropped_nonselfsigs = 0;
*r_v3keys = 0;
@@ -874,7 +875,11 @@ read_block( IOBUF a, unsigned int options,
{
root = new_kbnode( *pending_pkt );
*pending_pkt = NULL;
+ log_assert (root->pkt->pkttype == PKT_PUBLIC_KEY
+ || root->pkt->pkttype == PKT_SECRET_KEY);
in_cert = 1;
+ keyid_from_pk (root->pkt->pkt.public_key, keyid);
+ got_keyid = 1;
}
else
in_cert = 0;
@@ -994,6 +999,7 @@ read_block( IOBUF a, unsigned int options,
goto x_default;
if (!(options & IMPORT_SELF_SIGS_ONLY))
goto x_default;
+ log_assert (got_keyid);
if (pkt->pkt.signature->keyid[0] == keyid[0]
&& pkt->pkt.signature->keyid[1] == keyid[1])
{ /* This is likely a self-signature. We import this one.
@@ -1016,6 +1022,11 @@ read_block( IOBUF a, unsigned int options,
case PKT_PUBLIC_KEY:
case PKT_SECRET_KEY:
+ if (!got_keyid)
+ {
+ keyid_from_pk (pkt->pkt.public_key, keyid);
+ got_keyid = 1;
+ }
if (in_cert) /* Store this packet. */
{
*pending_pkt = pkt;
@@ -1023,7 +1034,6 @@ read_block( IOBUF a, unsigned int options,
goto ready;
}
in_cert = 1;
- keyid_from_pk (pkt->pkt.public_key, keyid);
goto x_default;
default: