summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2009-02-27 15:36:59 +0100
committerWerner Koch <wk@gnupg.org>2009-02-27 15:36:59 +0100
commitec4a3eb3c5b45321125a9b1fb2b8cd5ee20c52de (patch)
tree4ee2b19d3f5b44349fe36a40f28d0835e51d9fd8 /tools
parentFixed a nasty bug in scdaemon which led to a card reset if the card was (diff)
downloadgnupg2-ec4a3eb3c5b45321125a9b1fb2b8cd5ee20c52de.tar.xz
gnupg2-ec4a3eb3c5b45321125a9b1fb2b8cd5ee20c52de.zip
Fix a gpg2 problem with removed cards.
Allow runtime conf change for scdaemon. New commands for scdaemon.
Diffstat (limited to 'tools')
-rw-r--r--tools/ChangeLog7
-rw-r--r--tools/gpgconf-comp.c48
2 files changed, 42 insertions, 13 deletions
diff --git a/tools/ChangeLog b/tools/ChangeLog
index 8c3474168..dbe090f0b 100644
--- a/tools/ChangeLog
+++ b/tools/ChangeLog
@@ -1,3 +1,10 @@
+2009-02-27 Werner Koch <wk@g10code.com>
+
+ * gpgconf-comp.c (gpg_agent_runtime_change): Declare static.
+ (scdaemon_runtime_change): New.
+ (gc_backend_scdaemon): Register new function.
+ (gc_options_scdaemon): Make most options runtime changable.
+
2009-01-20 Werner Koch <wk@g10code.com>
* gpgconf.c (main): Print more directories.
diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c
index 6af8e9027..66fe30dcb 100644
--- a/tools/gpgconf-comp.c
+++ b/tools/gpgconf-comp.c
@@ -104,7 +104,8 @@ gc_error (int status, int errnum, const char *fmt, ...)
/* Forward declaration. */
-void gpg_agent_runtime_change (void);
+static void gpg_agent_runtime_change (void);
+static void scdaemon_runtime_change (void);
/* Backend configuration. Backends are used to decide how the default
and current value of an option can be determined, and how the
@@ -181,7 +182,7 @@ static struct
{ "GPG Agent", "gpg-agent", GNUPG_MODULE_NAME_AGENT,
gpg_agent_runtime_change, "gpgconf-gpg-agent.conf" },
{ "SCDaemon", "scdaemon", GNUPG_MODULE_NAME_SCDAEMON,
- NULL, "gpgconf-scdaemon.conf" },
+ scdaemon_runtime_change, "gpgconf-scdaemon.conf" },
{ "DirMngr", "dirmngr", GNUPG_MODULE_NAME_DIRMNGR,
NULL, "gpgconf-dirmngr.conf" },
{ "DirMngr LDAP Server List", NULL, 0,
@@ -574,7 +575,7 @@ static gc_option_t gc_options_scdaemon[] =
{ "Monitor",
GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC,
"gnupg", N_("Options controlling the diagnostic output") },
- { "verbose", GC_OPT_FLAG_LIST, GC_LEVEL_BASIC,
+ { "verbose", GC_OPT_FLAG_LIST|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
"gnupg", "verbose",
GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
{ "quiet", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
@@ -590,39 +591,39 @@ static gc_option_t gc_options_scdaemon[] =
{ "options", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT,
"gnupg", "|FILE|read options from FILE",
GC_ARG_TYPE_FILENAME, GC_BACKEND_SCDAEMON },
- { "reader-port", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
+ { "reader-port", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
"gnupg", "|N|connect to reader at port N",
GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON },
- { "ctapi-driver", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED,
+ { "ctapi-driver", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_ADVANCED,
"gnupg", "|NAME|use NAME as ct-API driver",
GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON },
- { "pcsc-driver", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED,
+ { "pcsc-driver", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_ADVANCED,
"gnupg", "|NAME|use NAME as PC/SC driver",
GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON },
- { "disable-ccid", GC_OPT_FLAG_NONE, GC_LEVEL_EXPERT,
+ { "disable-ccid", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_EXPERT,
"gnupg", "do not use the internal CCID driver",
GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
- { "disable-keypad", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
+ { "disable-keypad", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
"gnupg", "do not use a reader's keypad",
GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
- { "card-timeout", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
+ { "card-timeout", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
"gnupg", "|N|disconnect the card after N seconds of inactivity",
GC_ARG_TYPE_UINT32, GC_BACKEND_SCDAEMON },
{ "Debug",
GC_OPT_FLAG_GROUP, GC_LEVEL_ADVANCED,
"gnupg", N_("Options useful for debugging") },
- { "debug-level", GC_OPT_FLAG_ARG_OPT, GC_LEVEL_ADVANCED,
+ { "debug-level", GC_OPT_FLAG_ARG_OPT|GC_OPT_FLAG_RUNTIME, GC_LEVEL_ADVANCED,
"gnupg", "|LEVEL|set the debugging level to LEVEL",
GC_ARG_TYPE_STRING, GC_BACKEND_SCDAEMON },
- { "log-file", GC_OPT_FLAG_NONE, GC_LEVEL_ADVANCED,
+ { "log-file", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_ADVANCED,
"gnupg", N_("|FILE|write a log to FILE"),
GC_ARG_TYPE_FILENAME, GC_BACKEND_SCDAEMON },
{ "Security",
GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC,
"gnupg", N_("Options controlling the security") },
- { "deny-admin", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC,
+ { "deny-admin", GC_OPT_FLAG_NONE|GC_OPT_FLAG_RUNTIME, GC_LEVEL_BASIC,
"gnupg", "deny the use of admin card commands",
GC_ARG_TYPE_NONE, GC_BACKEND_SCDAEMON },
@@ -994,7 +995,7 @@ struct error_line_s
/* Engine specific support. */
-void
+static void
gpg_agent_runtime_change (void)
{
#ifndef HAVE_W32_SYSTEM
@@ -1045,6 +1046,27 @@ gpg_agent_runtime_change (void)
}
+static void
+scdaemon_runtime_change (void)
+{
+ gpg_error_t err;
+ const char *pgmname;
+ const char *argv[2];
+ pid_t pid;
+
+ pgmname = gnupg_module_name (GNUPG_MODULE_NAME_CONNECT_AGENT);
+ argv[0] = "scd killscd";
+ argv[1] = NULL;
+
+ err = gnupg_spawn_process_fd (pgmname, argv, -1, -1, -1, &pid);
+ if (!err)
+ err = gnupg_wait_process (pgmname, pid, NULL);
+ if (err)
+ gc_error (0, 0, "error running `%s%s': %s",
+ pgmname, " scd killscd", gpg_strerror (err));
+}
+
+
/* More or less Robust version of dgettext. It has the side effect of
switching the codeset to utf-8 because this is what we want to