diff options
author | David Shaw <[email protected]> | 2003-02-12 18:43:44 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2003-02-12 18:43:44 +0000 |
commit | d691cf8d107a3940fed78a799ccb50db114d0651 (patch) | |
tree | 0670b14ba2bf27a839ed28a90db3ed21feb24b1f /g10/keyring.c | |
parent | * exec.c (set_exec_path): Add debugging line. (diff) | |
download | gnupg-d691cf8d107a3940fed78a799ccb50db114d0651.tar.gz gnupg-d691cf8d107a3940fed78a799ccb50db114d0651.zip |
* 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.
Diffstat (limited to 'g10/keyring.c')
-rw-r--r-- | g10/keyring.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/g10/keyring.c b/g10/keyring.c index caa8df8b5..898136b05 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -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); |