[exim-cvs] Fix debug output of TLS keying info, client-side…

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Fix debug output of TLS keying info, client-side with OpenSSL
Gitweb: https://git.exim.org/exim.git/commitdiff/1f93955ec73611886a4dc90bde07c3b91b666f53
Commit:     1f93955ec73611886a4dc90bde07c3b91b666f53
Parent:     0781a8a50694b18cc1cf30e90a7d127ef0bfe7e9
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Tue Mar 12 23:30:03 2019 +0000
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Tue Mar 12 23:30:03 2019 +0000


    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 306877f..d37c789 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
   }