[Pkg-gnupg-commit] [gnupg2] 108/166: dirmngr: Setup a log handler for ntbtls.

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Mar 16 22:33:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch experimental
in repository gnupg2.

commit a022baa4a487eec769411255a64088450c4c8a49
Author: Werner Koch <wk at gnupg.org>
Date:   Mon Feb 20 17:24:00 2017 +0100

    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 at gnupg.org>
---
 dirmngr/dirmngr.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c
index 718296d..5e6d983 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") )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gnupg2.git



More information about the Pkg-gnupg-commit mailing list