mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
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 <wk@gnupg.org>
This commit is contained in:
parent
3cf9bb4d73
commit
29977e21d1
5 changed files with 127 additions and 62 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue