summaryrefslogtreecommitdiffstats
path: root/kbx
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2019-09-09 14:25:02 +0200
committerWerner Koch <wk@gnupg.org>2019-09-09 14:25:02 +0200
commit5e00c1773d8fd44ba95b39a48e12b0ec94ac8cbe (patch)
treefa065eec73cff6cc94aeb26a2ac2cc4b19d4ac42 /kbx
parentkbx: Allow searching from start. (diff)
downloadgnupg2-5e00c1773d8fd44ba95b39a48e12b0ec94ac8cbe.tar.xz
gnupg2-5e00c1773d8fd44ba95b39a48e12b0ec94ac8cbe.zip
kbx: Fix keyboxd search first.
* kbx/kbxserver.c (cmd_next): Switch to mode next if needed. -- Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'kbx')
-rw-r--r--kbx/kbxserver.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/kbx/kbxserver.c b/kbx/kbxserver.c
index a54444178..df110b301 100644
--- a/kbx/kbxserver.c
+++ b/kbx/kbxserver.c
@@ -352,10 +352,24 @@ cmd_next (assuan_context_t ctx, char *line)
ctrl->no_data_return = opt_no_data;
if (ctrl->server_local->multi_search_desc_len)
- err = kbxd_search (ctrl, ctrl->server_local->multi_search_desc,
- ctrl->server_local->multi_search_desc_len, 0);
+ {
+ /* The next condition should never be tru but we better handle
+ * the first/next transition anyway. */
+ if (ctrl->server_local->multi_search_desc[0].mode
+ == KEYDB_SEARCH_MODE_FIRST)
+ ctrl->server_local->multi_search_desc[0].mode = KEYDB_SEARCH_MODE_NEXT;
+
+ err = kbxd_search (ctrl, ctrl->server_local->multi_search_desc,
+ ctrl->server_local->multi_search_desc_len, 0);
+ }
else
- err = kbxd_search (ctrl, &ctrl->server_local->search_desc, 1, 0);
+ {
+ /* We need to do the transition from first to next here. */
+ if (ctrl->server_local->search_desc.mode == KEYDB_SEARCH_MODE_FIRST)
+ ctrl->server_local->search_desc.mode = KEYDB_SEARCH_MODE_NEXT;
+
+ err = kbxd_search (ctrl, &ctrl->server_local->search_desc, 1, 0);
+ }
if (err)
goto leave;