mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
* keydb.h, getkey.c (classify_user_id, classify_user_id2): Make 'exact' a
per-desc item. Merge into one function since 'force_exact' is no longer needed. (key_byname): Use new classify_user_id function, and new exact flag in KEYDB_SEARCH_DESC. * keyring.h, keyring.c (keyring_search): Return an optional index to show which KEYDB_SEARCH_DESC was the matching one. * keydb.h, keydb.c (keydb_search): Rename to keydb_search2, and pass the optional index to keyring_search. Add a macro version of keydb_search that calls this new function. * export.c (do_export_stream): If the keyid! syntax is used, export only that specified key. If the key in question is a subkey, export the primary plus that subkey only.
This commit is contained in:
parent
48ac1127ae
commit
d691cf8d10
7 changed files with 127 additions and 34 deletions
|
@ -852,7 +852,8 @@ compare_name (int mode, const char *name, const char *uid, size_t uidlen)
|
|||
* for a keyblock which contains one of the keys described in the DESC array.
|
||||
*/
|
||||
int
|
||||
keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc)
|
||||
keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc,
|
||||
size_t ndesc, size_t *descindex)
|
||||
{
|
||||
int rc;
|
||||
PACKET pkt;
|
||||
|
@ -1074,7 +1075,11 @@ keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc)
|
|||
}
|
||||
free_packet (&pkt);
|
||||
continue;
|
||||
found:
|
||||
found:
|
||||
/* Record which desc we matched on. Note this value is only
|
||||
meaningful if this function returns with no errors. */
|
||||
if(descindex)
|
||||
*descindex=n;
|
||||
for (n=any_skip?0:ndesc; n < ndesc; n++)
|
||||
{
|
||||
if (desc[n].skipfnc
|
||||
|
@ -1321,7 +1326,7 @@ keyring_rebuild_cache (void *token)
|
|||
memset (&desc, 0, sizeof desc);
|
||||
desc.mode = KEYDB_SEARCH_MODE_FIRST;
|
||||
|
||||
while ( !(rc = keyring_search (hd, &desc, 1)) )
|
||||
while ( !(rc = keyring_search (hd, &desc, 1, NULL)) )
|
||||
{
|
||||
desc.mode = KEYDB_SEARCH_MODE_NEXT;
|
||||
resname = keyring_get_resource_name (hd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue