1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-02-23 20:08:04 +01:00

* getkey.c (lookup): Advance the searchmode after a search FIRST.

This commit is contained in:
Werner Koch 2002-04-18 10:50:05 +00:00
parent ad2bfad4cc
commit bf7cef8ebf
2 changed files with 7 additions and 0 deletions

View File

@ -2,6 +2,7 @@
* getkey.c (premerge_public_with_secret): Fixed 0x12345678! syntax * getkey.c (premerge_public_with_secret): Fixed 0x12345678! syntax
for use with secret keys. for use with secret keys.
(lookup): Advance the searchmode after a search FIRST.
* seckey-cert.c (do_check): Always calculate the old checksum for * seckey-cert.c (do_check): Always calculate the old checksum for
use after unprotection. use after unprotection.

View File

@ -2003,6 +2003,12 @@ lookup( GETKEY_CTX ctx, KBNODE *ret_keyblock, int secmode )
rc = 0; rc = 0;
while (!(rc = keydb_search (ctx->kr_handle, ctx->items, ctx->nitems))) { while (!(rc = keydb_search (ctx->kr_handle, ctx->items, ctx->nitems))) {
/* If we are searching for the first key we have to make sure
that the next interation does not no an implicit reset.
This can be triggered by an empty key ring. */
if (ctx->nitems && ctx->items->mode == KEYDB_SEARCH_MODE_FIRST)
ctx->items->mode = KEYDB_SEARCH_MODE_NEXT;
rc = keydb_get_keyblock (ctx->kr_handle, &ctx->keyblock); rc = keydb_get_keyblock (ctx->kr_handle, &ctx->keyblock);
if (rc) { if (rc) {
log_error ("keydb_get_keyblock failed: %s\n", g10_errstr(rc)); log_error ("keydb_get_keyblock failed: %s\n", g10_errstr(rc));