aboutsummaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2015-06-23 07:12:44 +0000
committerWerner Koch <[email protected]>2015-06-23 07:13:45 +0000
commit54a0ed3d9b10a3c6dfb3d6a4d20b693a3183f8f6 (patch)
tree1ef4ed41f92876b09273a74031ef2173aaea7d95 /dirmngr/dirmngr.c
parentcommon: Improve fucntion parse_debug_flag. (diff)
downloadgnupg-54a0ed3d9b10a3c6dfb3d6a4d20b693a3183f8f6.tar.gz
gnupg-54a0ed3d9b10a3c6dfb3d6a4d20b693a3183f8f6.zip
Allow use of debug flag names for all tools.
* g13/g13.c: Make use of debug_parse_flag. * scd/scdaemon.c: Ditto. * sm/gpgsm.c: Ditto * agent/gpg-agent.c: Ditto. But do not terminate on "help" * dirmngr/dirmngr.c: Ditto. Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r--dirmngr/dirmngr.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index a9efba9cc..10cc45e00 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -219,7 +219,7 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_s_s (oSocketName, "socket-name", "@"), /* Only for debugging. */
ARGPARSE_s_u (oFakedSystemTime, "faked-system-time", "@"), /*(epoch time)*/
- ARGPARSE_p_u (oDebug, "debug", "@"),
+ ARGPARSE_s_s (oDebug, "debug", "@"),
ARGPARSE_s_n (oDebugAll, "debug-all", "@"),
ARGPARSE_s_i (oGnutlsDebug, "gnutls-debug", "@"),
ARGPARSE_s_i (oGnutlsDebug, "tls-debug", "@"),
@@ -237,6 +237,20 @@ static ARGPARSE_OPTS opts[] = {
ARGPARSE_end ()
};
+/* The list of supported debug flags. */
+static struct debug_flags_s debug_flags [] =
+ {
+ { DBG_X509_VALUE , "x509" },
+ { DBG_CRYPTO_VALUE , "crypto" },
+ { DBG_MEMORY_VALUE , "memory" },
+ { DBG_CACHE_VALUE , "cache" },
+ { DBG_MEMSTAT_VALUE, "memstat" },
+ { DBG_HASHING_VALUE, "hashing" },
+ { DBG_IPC_VALUE , "ipc" },
+ { DBG_LOOKUP_VALUE , "lookup" },
+ { 77, NULL } /* 77 := Do not exit on "help" or "?". */
+ };
+
#define DEFAULT_MAX_REPLIES 10
#define DEFAULT_LDAP_TIMEOUT 100 /* arbitrary large timeout */
@@ -441,6 +455,9 @@ set_debug (void)
gnutls_global_set_log_level (opt_gnutls_debug);
}
#endif /*HTTP_USE_GNUTLS*/
+
+ if (opt.debug)
+ parse_debug_flag (NULL, &opt.debug, debug_flags);
}
@@ -508,7 +525,9 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread)
{
case oQuiet: opt.quiet = 1; break;
case oVerbose: opt.verbose++; break;
- case oDebug: opt.debug |= pargs->r.ret_ulong; break;
+ case oDebug:
+ parse_debug_flag (pargs->r.ret_str, &opt.debug, debug_flags);
+ break;
case oDebugAll: opt.debug = ~0; break;
case oDebugLevel: debug_level = pargs->r.ret_str; break;
case oGnutlsDebug: opt_gnutls_debug = pargs->r.ret_int; break;
@@ -866,9 +885,6 @@ main (int argc, char **argv)
case oVerbose: opt.verbose++; break;
case oBatch: opt.batch=1; break;
- case oDebug: opt.debug |= pargs.r.ret_ulong; break;
- case oDebugAll: opt.debug = ~0; break;
- case oDebugLevel: debug_level = pargs.r.ret_str; break;
case oDebugWait: debug_wait = pargs.r.ret_int; break;
case oOptions: