1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

gpg: Add push/pop found state feature to keydb.

* g10/keydb.c (keydb_handle): Add field saved_found.
(keydb_new): Init new field.
(keydb_push_found_state, keydb_pop_found_state): New.
* g10/keyring.c (kyring_handle): Add field saved_found.
(keyring_push_found_state, keyring_pop_found_state): New.
--

We have the same feature in gpgsm.  It is very useful to check for an
unambiguous user id with a follow up update of the keyblock.

Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
Werner Koch 2015-05-08 15:51:11 +02:00
parent b772e459fa
commit 3c439c0447
No known key found for this signature in database
GPG key ID: E3FDFF218E45B72B
4 changed files with 88 additions and 5 deletions

View file

@ -1,5 +1,6 @@
/* keyring.c - keyring file handling
* Copyright (C) 2001, 2004, 2009, 2010 Free Software Foundation, Inc.
* Copyright (C) 1998-2010 Free Software Foundation, Inc.
* Copyright (C) 1997-2015 Werner Koch
*
* This file is part of GnuPG.
*
@ -83,7 +84,7 @@ struct keyring_handle
size_t pk_no;
size_t uid_no;
unsigned int n_packets; /*used for delete and update*/
} found;
} found, saved_found;
struct {
char *name;
char *pattern;
@ -279,6 +280,25 @@ keyring_release (KEYRING_HANDLE hd)
}
/* Save the current found state in HD for later retrieval by
keybox_pop_found_state. Only one state may be saved. */
void
keyring_push_found_state (KEYRING_HANDLE hd)
{
hd->saved_found = hd->found;
hd->found.kr = NULL;
}
/* Restore the saved found state in HD. */
void
keyring_pop_found_state (KEYRING_HANDLE hd)
{
hd->found = hd->saved_found;
hd->saved_found.kr = NULL;
}
const char *
keyring_get_resource_name (KEYRING_HANDLE hd)
{