GnuTLS debug callback: check for existing \n
authorPhil Pennock <pdp@exim.org>
Sun, 20 May 2012 09:33:22 +0000 (05:33 -0400)
committerPhil Pennock <pdp@exim.org>
Sun, 20 May 2012 09:33:22 +0000 (05:33 -0400)
src/src/tls-gnu.c

index 05a3e084c2d9e71a71069763beb60e34494cde9c..51fdb86574d30507be67d2fac0f5841f17213edc 100644 (file)
@@ -1183,7 +1183,14 @@ return TRUE;
 static void
 exim_gnutls_logger_cb(int level, const char *message)
 {
-  DEBUG(D_tls) debug_printf("GnuTLS<%d>: %s\n", level, message);
+  size_t len = strlen(message);
+  if (len < 1)
+    {
+    DEBUG(D_tls) debug_printf("GnuTLS<%d> empty debug message\n", level);
+    return;
+    }
+  DEBUG(D_tls) debug_printf("GnuTLS<%d>: %s%s", level, message,
+      message[len-1] == '\n' ? "" : "\n");
 }
 #endif