summaryrefslogtreecommitdiffstats
path: root/dirmngr/dirmngr.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2017-02-20 17:24:00 +0100
committerWerner Koch <wk@gnupg.org>2017-02-20 17:24:00 +0100
commita022baa4a487eec769411255a64088450c4c8a49 (patch)
tree112e938b27c7a1e4b13baa3e4e31cbd435dac23f /dirmngr/dirmngr.c
parentcommon: New function log_logv_with_prefix. (diff)
downloadgnupg2-a022baa4a487eec769411255a64088450c4c8a49.tar.xz
gnupg2-a022baa4a487eec769411255a64088450c4c8a49.zip
dirmngr: Setup a log handler for ntbtls.
* dirmngr/dirmngr.c (my_ntbtls_log_handler) [HTTP_USE_NTBTLS]: New. (main) [HTTP_USE_NTBTLS]: Register log handler. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to '')
-rw-r--r--dirmngr/dirmngr.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 718296d0f..5e6d98367 100644
--- a/dirmngr/dirmngr.c
+++ b/dirmngr/dirmngr.c
@@ -715,6 +715,23 @@ pid_suffix_callback (unsigned long *r_suffix)
}
#endif /*!HAVE_W32_SYSTEM*/
+#if HTTP_USE_NTBTLS
+static void
+my_ntbtls_log_handler (void *opaque, int level, const char *fmt, va_list argv)
+{
+ (void)opaque;
+
+ if (level == -1)
+ log_logv_with_prefix (GPGRT_LOG_INFO, "ntbtls: ", fmt, argv);
+ else
+ {
+ char prefix[10+20];
+ snprintf (prefix, sizeof prefix, "ntbtls(%d): ", level);
+ log_logv_with_prefix (GPGRT_LOG_DEBUG, prefix, fmt, argv);
+ }
+}
+#endif
+
static void
thread_init (void)
@@ -801,6 +818,10 @@ main (int argc, char **argv)
setup_libgcrypt_logging ();
+#if HTTP_USE_NTBTLS
+ ntbtls_set_log_handler (my_ntbtls_log_handler, NULL);
+#endif
+
/* Setup defaults. */
shell = getenv ("SHELL");
if (shell && strlen (shell) >= 3 && !strcmp (shell+strlen (shell)-3, "csh") )