diff options
author | Werner Koch <wk@gnupg.org> | 2015-05-08 15:51:11 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2015-05-08 15:51:11 +0200 |
commit | 3c439c0447f8a7468a61bbdc4c9a101ef2451dcb (patch) | |
tree | f7c1e9085cf66dc7a0db3e82dababdc22054a2e4 /g10/keyring.c | |
parent | gpg: Minor code merging in keyedit. (diff) | |
download | gnupg2-3c439c0447f8a7468a61bbdc4c9a101ef2451dcb.tar.xz gnupg2-3c439c0447f8a7468a61bbdc4c9a101ef2451dcb.zip |
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>
Diffstat (limited to 'g10/keyring.c')
-rw-r--r-- | g10/keyring.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/g10/keyring.c b/g10/keyring.c index ee76e8a33..a5178ace4 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -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) { |