[sr-dev] git:master:70929120: tls: test the pointer to CA file path when setting the client property

Daniel-Constantin Mierla miconda at gmail.com
Tue Mar 23 12:54:45 CET 2021


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2021-03-23T12:53:38+01:00

tls: test the pointer to CA file path when setting the client property

---

Modified: src/modules/tls/tls_domain.c

---

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

---

diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c
index bfc2e38d3f..ab45fa7136 100644
--- a/src/modules/tls/tls_domain.c
+++ b/src/modules/tls/tls_domain.c
@@ -580,9 +580,9 @@ static int load_ca_list(tls_domain_t* d)
 		DBG("%s: No CA list configured\n", tls_domain_str(d));
 		return 0;
 	}
-	if (d->ca_file.len>0 && fix_shm_pathname(&d->ca_file) < 0)
+	if (d->ca_file.s && d->ca_file.len>0 && fix_shm_pathname(&d->ca_file) < 0)
 		return -1;
-	if (d->ca_path.len>0 && fix_shm_pathname(&d->ca_path) < 0)
+	if (d->ca_path.s && d->ca_path.len>0 && fix_shm_pathname(&d->ca_path) < 0)
 		return -1;
 	procs_no=get_max_procs();
 	for(i = 0; i < procs_no; i++) {
@@ -594,7 +594,7 @@ static int load_ca_list(tls_domain_t* d)
 			TLS_ERR("load_ca_list:");
 			return -1;
 		}
-		if(d->ca_file.len>0) {
+		if(d->ca_file.s && d->ca_file.len>0) {
 			SSL_CTX_set_client_CA_list(d->ctx[i],
 					SSL_load_client_CA_file(d->ca_file.s));
 			if (SSL_CTX_get_client_CA_list(d->ctx[i]) == 0) {




More information about the sr-dev mailing list