From 1f93955ec73611886a4dc90bde07c3b91b666f53 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Tue, 12 Mar 2019 23:30:03 +0000 Subject: [PATCH] Fix debug output of TLS keying info, client-side with OpenSSL --- src/src/tls-openssl.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/src/tls-openssl.c b/src/src/tls-openssl.c index 306877f22..d37c78970 100644 --- a/src/src/tls-openssl.c +++ b/src/src/tls-openssl.c @@ -2723,12 +2723,17 @@ DEBUG(D_tls) #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 } -- 2.25.1