[sr-dev] git:master:d2906da9: tls: better log messages when failing to create ssl ctx

Daniel-Constantin Mierla miconda at gmail.com
Tue May 26 15:05:50 CEST 2020


Module: kamailio
Branch: master
Commit: d2906da97d2429bfdff089203f933de2d282a86d
URL: https://github.com/kamailio/kamailio/commit/d2906da97d2429bfdff089203f933de2d282a86d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2020-05-26T15:05:15+02:00

tls: better log messages when failing to create ssl ctx

---

Modified: src/modules/tls/tls_domain.c

---

Diff:  https://github.com/kamailio/kamailio/commit/d2906da97d2429bfdff089203f933de2d282a86d.diff
Patch: https://github.com/kamailio/kamailio/commit/d2906da97d2429bfdff089203f933de2d282a86d.patch

---

diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c
index 3932141f0e..a8859c4a31 100644
--- a/src/modules/tls/tls_domain.c
+++ b/src/modules/tls/tls_domain.c
@@ -1036,7 +1036,11 @@ static int ksr_tls_fix_domain(tls_domain_t* d, tls_domain_t* def)
 			d->ctx[i] = SSL_CTX_new((SSL_METHOD*)ssl_methods[d->method - 1]);
 		}
 		if (d->ctx[i] == NULL) {
-			ERR("%s: Cannot create SSL context\n", tls_domain_str(d));
+			unsigned long e = 0;
+			e = ERR_peek_last_error();
+			ERR("%s: Cannot create SSL context [%d] (%lu: %s / %s)\n",
+					tls_domain_str(d), i, e, ERR_error_string(e, NULL),
+					ERR_reason_error_string(e));
 			return -1;
 		}
 		if(d->method>TLS_USE_TLSvRANGE) {
@@ -1046,7 +1050,11 @@ static int ksr_tls_fix_domain(tls_domain_t* d, tls_domain_t* def)
 		/* libssl >= 1.1.0 */
 		d->ctx[i] = SSL_CTX_new(sr_tls_methods[d->method - 1].TLSMethod);
 		if (d->ctx[i] == NULL) {
-			ERR("%s: Cannot create SSL context\n", tls_domain_str(d));
+			unsigned long e = 0;
+			e = ERR_peek_last_error();
+			ERR("%s: Cannot create SSL context [%d] (%lu: %s / %s)\n",
+					tls_domain_str(d), i, e, ERR_error_string(e, NULL),
+					ERR_reason_error_string(e));
 			return -1;
 		}
 		if(d->method>TLS_USE_TLSvRANGE) {




More information about the sr-dev mailing list