Fix debug output of TLS keying info, client-side with OpenSSL
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 12 Mar 2019 23:30:03 +0000 (23:30 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Tue, 12 Mar 2019 23:30:03 +0000 (23:30 +0000)
src/src/tls-openssl.c

index 306877f22f039c0d83ccb555826f71afa368b309..d37c789704336c119e09a62b76bec61c3c588a00 100644 (file)
@@ -2723,12 +2723,17 @@ DEBUG(D_tls)
 #ifdef EXIM_HAVE_OPENSSL_KEYLOG
   {
   BIO * bp = BIO_new(BIO_s_mem());
 #ifdef EXIM_HAVE_OPENSSL_KEYLOG
   {
   BIO * bp = BIO_new(BIO_s_mem());
-  uschar * s;
-  int len;
-  SSL_SESSION_print_keylog(bp, SSL_get_session(server_ssl));
-  len = (int) BIO_get_mem_data(bp, CSS &s);
-  debug_printf("%.*s", len, s);
-  BIO_free(bp);
+  if (bp)
+    {
+    uschar * s;
+    int len;
+    SSL_SESSION_print_keylog(bp, SSL_get_session(exim_client_ctx->ssl));
+    len = (int) BIO_get_mem_data(bp, CSS &s);
+    debug_printf("%.*s", len, s);
+    BIO_free(bp);
+    }
+  else
+    debug_printf("(alloc failure for keylog)\n");
   }
 #endif
   }
   }
 #endif
   }