mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
sm: New options to prepare the use of keyboxd.
* sm/Makefile.am (AM_CFLAGS): Add npth flags. (common_libs): Use npth version of the lib. (gpgsm_LDADD): Add npth libs. * sm/gpgsm.c (oUseKeyboxd, oKeyboxdProgram): New. (opts): New options --use-keyboxd and --keyboxd-program. (main): Set them. (gpgsm_deinit_default_ctrl): New. (main): Call it. * sm/server.c (gpgsm_server): Ditto. * sm/gpgsm.h (opt): Add fields use_keyboxd and keyboxd_program. (keydb_local_s): New type. (struct server_control_s): Add field keybd_local. * sm/keydb.c: Include assuan.h, asshelp.h, and kbx-client-util.h. (struct keydb_local_s): New. (struct keydb_handle): Add fields for keyboxd use. (gpgsm_keydb_deinit_session_data): New. (warn_version_mismatch): New. (create_new_context): New. (open_context): New. (keydb_new): Implement keyboxd mode. (keydb_release): Ditto. (keydb_get_resource_name): Ditto. * sm/keydb.c: Add stub support for all other functions. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
a7d006293e
commit
046f419f80
6 changed files with 427 additions and 85 deletions
25
sm/gpgsm.c
25
sm/gpgsm.c
|
@ -201,6 +201,8 @@ enum cmd_and_opt_values {
|
|||
oAuthenticode,
|
||||
oAttribute,
|
||||
oChUid,
|
||||
oUseKeyboxd,
|
||||
oKeyboxdProgram,
|
||||
oNoAutostart
|
||||
};
|
||||
|
||||
|
@ -296,6 +298,7 @@ static gpgrt_opt_t opts[] = {
|
|||
ARGPARSE_s_s (oIgnoreCertExtension, "ignore-cert-extension", "@"),
|
||||
ARGPARSE_s_n (oNoAutostart, "no-autostart", "@"),
|
||||
ARGPARSE_s_s (oAgentProgram, "agent-program", "@"),
|
||||
ARGPARSE_s_s (oKeyboxdProgram, "keyboxd-program", "@"),
|
||||
ARGPARSE_s_s (oDirmngrProgram, "dirmngr-program", "@"),
|
||||
ARGPARSE_s_s (oProtectToolProgram, "protect-tool-program", "@"),
|
||||
|
||||
|
@ -343,6 +346,7 @@ static gpgrt_opt_t opts[] = {
|
|||
ARGPARSE_s_n (oNoDefKeyring, "no-default-keyring", "@"),
|
||||
ARGPARSE_s_s (oKeyServer, "keyserver",
|
||||
N_("|SPEC|use this keyserver to lookup keys")),
|
||||
ARGPARSE_s_n (oUseKeyboxd, "use-keyboxd", "@"),
|
||||
|
||||
|
||||
ARGPARSE_header ("ImportExport",
|
||||
|
@ -1356,6 +1360,7 @@ main ( int argc, char **argv)
|
|||
case oAnswerNo: opt.answer_no = 1; break;
|
||||
|
||||
case oKeyring: append_to_strlist (&nrings, pargs.r.ret_str); break;
|
||||
case oUseKeyboxd: opt.use_keyboxd = 1; break;
|
||||
|
||||
case oDebug:
|
||||
if (parse_debug_flag (pargs.r.ret_str, &debug_value, debug_flags))
|
||||
|
@ -1400,6 +1405,7 @@ main ( int argc, char **argv)
|
|||
case oHomedir: gnupg_set_homedir (pargs.r.ret_str); break;
|
||||
case oChUid: break; /* Command line only (see above). */
|
||||
case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
|
||||
case oKeyboxdProgram: opt.keyboxd_program = pargs.r.ret_str; break;
|
||||
|
||||
case oDisplay:
|
||||
set_opt_session_env ("DISPLAY", pargs.r.ret_str);
|
||||
|
@ -1789,7 +1795,7 @@ main ( int argc, char **argv)
|
|||
}
|
||||
|
||||
/* Add default keybox. */
|
||||
if (!nrings && default_keyring)
|
||||
if (!nrings && default_keyring && !opt.use_keyboxd)
|
||||
{
|
||||
int created;
|
||||
|
||||
|
@ -1810,8 +1816,11 @@ main ( int argc, char **argv)
|
|||
xfree (filelist[0]);
|
||||
}
|
||||
}
|
||||
for (sl = nrings; sl; sl = sl->next)
|
||||
keydb_add_resource (&ctrl, sl->d, 0, NULL);
|
||||
if (!opt.use_keyboxd)
|
||||
{
|
||||
for (sl = nrings; sl; sl = sl->next)
|
||||
keydb_add_resource (&ctrl, sl->d, 0, NULL);
|
||||
}
|
||||
FREE_STRLIST(nrings);
|
||||
|
||||
|
||||
|
@ -2229,6 +2238,7 @@ main ( int argc, char **argv)
|
|||
}
|
||||
|
||||
/* cleanup */
|
||||
gpgsm_deinit_default_ctrl (&ctrl);
|
||||
keyserver_list_free (opt.keyserver);
|
||||
opt.keyserver = NULL;
|
||||
gpgsm_release_certlist (recplist);
|
||||
|
@ -2274,6 +2284,15 @@ gpgsm_init_default_ctrl (struct server_control_s *ctrl)
|
|||
}
|
||||
|
||||
|
||||
/* This function is called to deinitialize a control object. The
|
||||
* control object is is not released, though. */
|
||||
void
|
||||
gpgsm_deinit_default_ctrl (ctrl_t ctrl)
|
||||
{
|
||||
gpgsm_keydb_deinit_session_data (ctrl);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
gpgsm_parse_validation_model (const char *model)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue