aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/keybox.h
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2016-01-13 08:29:39 +0000
committerWerner Koch <[email protected]>2016-01-13 09:43:33 +0000
commit9dc355ad3ae0026ab04c424dc984d748b8fad393 (patch)
tree31a6eb986c5a6f89cbbf8f33ed34352696b91cf2 /kbx/keybox.h
parentFix to support git worktree. (diff)
downloadgnupg-9dc355ad3ae0026ab04c424dc984d748b8fad393.tar.gz
gnupg-9dc355ad3ae0026ab04c424dc984d748b8fad393.zip
gpg: Make sure to mark a duplicate registered keybox as primary.
* kbx/keybox-init.c (keybox_register_file): Change interface to return the token even if the file has already been registered. * g10/keydb.c (primary_keyring): Rename to primary_keydb. (maybe_create_keyring_or_box): Change return type to gpg_error_t. (keydb_add_resource): Ditto. s/rc/err/. (keydb_add_resource): Mark an already registered as primary. * sm/keydb.c (maybe_create_keybox): Change return type to gpg_error_t. (keydb_add_resource): Ditto. s/rc/err/. (keydb_add_resource): Adjust for changed keybox_register_file. -- This change aligns the registering of keyboxes with those of keyrings. This fixes a potential bug: gpg --keyring foo.kbx --keyring bar.gpg --keyring foo.kbx would have marked bar.gpg as primary resource and thus inserting new keys there. The correct and now fixed behavior is to insert to foo.kbx. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'kbx/keybox.h')
-rw-r--r--kbx/keybox.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/kbx/keybox.h b/kbx/keybox.h
index 8b75db45c..acd7a4f89 100644
--- a/kbx/keybox.h
+++ b/kbx/keybox.h
@@ -64,7 +64,8 @@ typedef enum
/*-- keybox-init.c --*/
-void *keybox_register_file (const char *fname, int secret);
+gpg_error_t keybox_register_file (const char *fname, int secret,
+ void **r_token);
int keybox_is_writable (void *token);
KEYBOX_HANDLE keybox_new_openpgp (void *token, int secret);