diff options
author | Werner Koch <[email protected]> | 2019-03-15 18:50:37 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2019-03-15 19:41:38 +0000 |
commit | f799e9728bcadb3d4148a47848c78c5647860ea4 (patch) | |
tree | 3d1428e8d0ea4070d0bcac2defe05d45235dad76 /g10/keydb.h | |
parent | tests: Add sample secret key w/o binding signatures. (diff) | |
download | gnupg-f799e9728bcadb3d4148a47848c78c5647860ea4.tar.gz gnupg-f799e9728bcadb3d4148a47848c78c5647860ea4.zip |
gpg: Avoid importing secret keys if the keyblock is not valid.
* g10/keydb.h (struct kbnode_struct): Replace unused field RECNO by
new field TAG.
* g10/kbnode.c (alloc_node): Change accordingly.
* g10/import.c (import_one): Add arg r_valid.
(sec_to_pub_keyblock): Set tags.
(resync_sec_with_pub_keyblock): New.
(import_secret_one): Change return code to gpg_error_t. Return an
error code if sec_to_pub_keyblock failed. Resync secret keyblock.
--
When importing an invalid secret key ring for example without key
binding signatures or no UIDs, gpg used to let gpg-agent store the
secret keys anyway. This is clearly a bug because the diagnostics
before claimed that for example the subkeys have been skipped.
Importing the secret key parameters then anyway is surprising in
particular because a gpg -k does not show the key. After importing
the public key the secret keys suddenly showed up.
This changes the behaviour of
GnuPG-bug-id: 4392
to me more consistent but is not a solution to the actual bug.
Caution: The ecc.scm test now fails because two of the sample keys
don't have binding signatures.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/keydb.h')
-rw-r--r-- | g10/keydb.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/g10/keydb.h b/g10/keydb.h index c52856d7f..7cdfe9bbf 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -52,12 +52,13 @@ typedef struct getkey_ctx_s *getkey_ctx_t; * This structure is also used to bind arbitrary packets together. */ -struct kbnode_struct { - KBNODE next; - PACKET *pkt; - int flag; - int private_flag; - ulong recno; /* used while updating the trustdb */ +struct kbnode_struct +{ + kbnode_t next; + PACKET *pkt; + int flag; /* Local use during keyblock processing (not cloned).*/ + unsigned int tag; /* Ditto. */ + int private_flag; }; #define is_deleted_kbnode(a) ((a)->private_flag & 1) |