aboutsummaryrefslogtreecommitdiffstats
path: root/g10/gpg.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2019-09-09 12:34:09 +0000
committerWerner Koch <[email protected]>2019-09-09 13:01:47 +0000
commitaba82684fe14289cf62b4694bc398f3a274b4762 (patch)
treeb66c13bcb29f62f64c4aaa603d510b0fd65cb7cc /g10/gpg.c
parentkbx: Fix keyboxd search first. (diff)
downloadgnupg-aba82684fe14289cf62b4694bc398f3a274b4762.tar.gz
gnupg-aba82684fe14289cf62b4694bc398f3a274b4762.zip
gpg: New option --use-keyboxd.
* g10/gpg.c (oUseKeyboxd,oKeyboxdProgram): New consts. (opts): New options --use-keyboxd and --keyboxd-program. (main): Implement them. * g10/keydb.c: Move some defs out to ... * g10/keydb-private.h: new file. * g10/keydb.c: prefix function names with "internal" and move original functions to ... * g10/call-keyboxd.c: new file. Divert to the internal fucntion if --use-keyboxd is used. Add a CTRL arg to most fucntions and change all callers. * g10/Makefile.am (common_source): Add new files. (noinst_PROGRAMS): Do bot build gpgcompose. -- Note that this is just the framework with only a basic implementation of searching via keyboxd. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'g10/gpg.c')
-rw-r--r--g10/gpg.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/g10/gpg.c b/g10/gpg.c
index 0bbe72394..145796cbc 100644
--- a/g10/gpg.c
+++ b/g10/gpg.c
@@ -361,6 +361,7 @@ enum cmd_and_opt_values
oUseAgent,
oNoUseAgent,
oGpgAgentInfo,
+ oUseKeyboxd,
oMergeOnly,
oTryAllSecrets,
oTrustedKey,
@@ -378,6 +379,7 @@ enum cmd_and_opt_values
oPersonalDigestPreferences,
oPersonalCompressPreferences,
oAgentProgram,
+ oKeyboxdProgram,
oDirmngrProgram,
oDisableDirmngr,
oDisplay,
@@ -849,6 +851,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_s (oPersonalCompressPreferences, "personal-compress-prefs", "@"),
ARGPARSE_s_s (oAgentProgram, "agent-program", "@"),
+ ARGPARSE_s_s (oKeyboxdProgram, "keyboxd-program", "@"),
ARGPARSE_s_s (oDirmngrProgram, "dirmngr-program", "@"),
ARGPARSE_s_n (oDisableDirmngr, "disable-dirmngr", "@"),
ARGPARSE_s_s (oDisplay, "display", "@"),
@@ -895,6 +898,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_n (oNoAutoKeyLocate, "no-auto-key-locate", "@"),
ARGPARSE_s_n (oNoAutostart, "no-autostart", "@"),
ARGPARSE_s_n (oNoSymkeyCache, "no-symkey-cache", "@"),
+ ARGPARSE_s_n (oUseKeyboxd, "use-keyboxd", "@"),
/* Dummy options with warnings. */
ARGPARSE_s_n (oUseAgent, "use-agent", "@"),
@@ -2734,6 +2738,11 @@ main (int argc, char **argv)
case oGpgAgentInfo:
obsolete_option (configname, configlineno, "gpg-agent-info");
break;
+
+ case oUseKeyboxd:
+ opt.use_keyboxd = 1;
+ break;
+
case oReaderPort:
obsolete_scdaemon_option (configname, configlineno, "reader-port");
break;
@@ -3491,6 +3500,7 @@ main (int argc, char **argv)
pers_compress_list=pargs.r.ret_str;
break;
case oAgentProgram: opt.agent_program = pargs.r.ret_str; break;
+ case oKeyboxdProgram: opt.keyboxd_program = pargs.r.ret_str; break;
case oDirmngrProgram: opt.dirmngr_program = pargs.r.ret_str; break;
case oDisableDirmngr: opt.disable_dirmngr = 1; break;
case oWeakDigest:
@@ -4105,8 +4115,10 @@ main (int argc, char **argv)
/* Add the keyrings, but not for some special commands. We always
* need to add the keyrings if we are running under SELinux, this
* is so that the rings are added to the list of secured files.
- * We do not add any keyring if --no-keyring has been used. */
- if (default_keyring >= 0
+ * We do not add any keyring if --no-keyring or --use-keyboxd has
+ * been used. */
+ if (!opt.use_keyboxd
+ && default_keyring >= 0
&& (ALWAYS_ADD_KEYRINGS
|| (cmd != aDeArmor && cmd != aEnArmor && cmd != aGPGConfTest)))
{
@@ -4118,9 +4130,8 @@ main (int argc, char **argv)
}
FREE_STRLIST(nrings);
+ /* In loopback mode, never ask for the password multiple times. */
if (opt.pinentry_mode == PINENTRY_MODE_LOOPBACK)
- /* In loopback mode, never ask for the password multiple
- times. */
{
opt.passphrase_repeat = 0;
}
@@ -5064,7 +5075,7 @@ main (int argc, char **argv)
policy = parse_tofu_policy (argv[0]);
- hd = keydb_new ();
+ hd = keydb_new (ctrl);
if (! hd)
{
write_status_failure ("tofu-driver", gpg_error(GPG_ERR_GENERAL));