aboutsummaryrefslogtreecommitdiffstats
path: root/kbx/kbxserver.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-09-10 10:05:21 +0000
committerWerner Koch <[email protected]>2020-09-10 10:08:48 +0000
commit29977e21d18188e16e50fee95a95e05fdbd97caf (patch)
tree153025c422ab7eec318ff4c8ecfeee4914388087 /kbx/kbxserver.c
parentgpg-connect-agent: Catch signals so that SIGPIPE is ignored. (diff)
downloadgnupg-29977e21d18188e16e50fee95a95e05fdbd97caf.tar.gz
gnupg-29977e21d18188e16e50fee95a95e05fdbd97caf.zip
keyboxd: Add options --openpgp and --x509 to SEARCH.
* kbx/keyboxd.h (struct server_control_s): Replace the two request objects by just one. Add filter flags. * kbx/kbxserver.c (cmd_search): Add options --openpgp and --x509. (cmd_killkeyboxd): Do not return GPG_ERR_EOF. * kbx/frontend.c (kbxd_release_session_info): Adjust for the new request object. (kbxd_search, kbxd_store, kbxd_delete): Ditto. * kbx/backend-sqlite.c (struct be_sqlite_local_s): Add filter flags. (run_sql_prepare): Add optional arg 'extra'. Change callers. (run_sql_bind_ntext): New. (run_sql_bind_text): Just call run_sql_bind_ntext. (run_select_statement): Add ctrl arg. Implement the filter flags. * g10/call-keyboxd.c (keydb_search): Use the --openpgp option. -- As soon as we implement X.509 we need to have a way to return only openpgp or x.509 certificates. Gpg/gpgsm will then use the respective flag. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'kbx/kbxserver.c')
-rw-r--r--kbx/kbxserver.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/kbx/kbxserver.c b/kbx/kbxserver.c
index 4a5e1f48a..264c3be4e 100644
--- a/kbx/kbxserver.c
+++ b/kbx/kbxserver.c
@@ -277,22 +277,25 @@ option_handler (assuan_context_t ctx, const char *key, const char *value)
static const char hlp_search[] =
- "SEARCH [--no-data] [[--more] PATTERN]\n"
+ "SEARCH [--no-data] [--openpgp|--x509] [[--more] PATTERN]\n"
"\n"
"Search for the keys identified by PATTERN. With --more more\n"
"patterns to be used for the search are expected with the next\n"
"command. With --no-data only the search status is returned but\n"
- "not the actual data. See also \"NEXT\".";
+ "not the actual data. With --openpgp or --x509 only the respective\n"
+ "keys are returned. See also \"NEXT\".";
static gpg_error_t
cmd_search (assuan_context_t ctx, char *line)
{
ctrl_t ctrl = assuan_get_pointer (ctx);
- int opt_more, opt_no_data;
+ int opt_more, opt_no_data, opt_openpgp, opt_x509;
gpg_error_t err;
unsigned int n, k;
opt_no_data = has_option (line, "--no-data");
opt_more = has_option (line, "--more");
+ opt_openpgp = has_option (line, "--openpgp");
+ opt_x509 = has_option (line, "--x509");
line = skip_options (line);
ctrl->server_local->search_any_found = 0;
@@ -380,6 +383,8 @@ cmd_search (assuan_context_t ctx, char *line)
ctrl->server_local->inhibit_data_logging_now = 0;
ctrl->server_local->inhibit_data_logging_count = 0;
ctrl->no_data_return = opt_no_data;
+ ctrl->filter_opgp = opt_openpgp;
+ ctrl->filter_x509 = opt_x509;
err = prepare_outstream (ctrl);
if (err)
;
@@ -643,7 +648,7 @@ cmd_killkeyboxd (assuan_context_t ctx, char *line)
ctrl->server_local->stopme = 1;
assuan_set_flag (ctx, ASSUAN_FORCE_CLOSE, 1);
- return gpg_error (GPG_ERR_EOF);
+ return 0;
}