mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
96237b9a63
commit
9dc355ad3a
5 changed files with 68 additions and 54 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue