Module: kamailio
Branch: 5.2
Commit: 1d06499462e1e893e5965d2cc9553cbdd5bd347d
URL:
https://github.com/kamailio/kamailio/commit/1d06499462e1e893e5965d2cc9553cb…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2019-05-21T13:20:23+02:00
tls: register SNI callback for server default profile
- make SNI work for other profile when the default one does not have
server_name
- GH #1938
(cherry picked from commit 08d22b7bd95828554e30f4c23e906cd9d234e1cd)
---
Modified: src/modules/tls/tls_domain.c
---
Diff:
https://github.com/kamailio/kamailio/commit/1d06499462e1e893e5965d2cc9553cb…
Patch:
https://github.com/kamailio/kamailio/commit/1d06499462e1e893e5965d2cc9553cb…
---
diff --git a/src/modules/tls/tls_domain.c b/src/modules/tls/tls_domain.c
index f22b8e8049..fff4603eba 100644
--- a/src/modules/tls/tls_domain.c
+++ b/src/modules/tls/tls_domain.c
@@ -1061,17 +1061,20 @@ static int ksr_tls_fix_domain(tls_domain_t* d, tls_domain_t* def)
* check server domains for server_name extension and register
* callback function
*/
- if ((d->type & TLS_DOMAIN_SRV) && d->server_name.len>0) {
+ if ((d->type & TLS_DOMAIN_SRV)
+ && (d->server_name.len>0 || (d->type & TLS_DOMAIN_DEF))) {
if (!SSL_CTX_set_tlsext_servername_callback(d->ctx[i], tls_server_name_cb)) {
LM_ERR("register server_name callback handler for socket "
"[%s:%d], server_name='%s' failed for proc %d\n",
- ip_addr2a(&d->ip), d->port, d->server_name.s, i);
+ ip_addr2a(&d->ip), d->port,
+ (d->server_name.s)?d->server_name.s:"<default>", i);
return -1;
}
if (!SSL_CTX_set_tlsext_servername_arg(d->ctx[i], d)) {
LM_ERR("register server_name callback handler data for socket "
"[%s:%d], server_name='%s' failed for proc %d\n",
- ip_addr2a(&d->ip), d->port, d->server_name.s, i);
+ ip_addr2a(&d->ip), d->port,
+ (d->server_name.s)?d->server_name.s:"<default>", i);
return -1;
}
}
@@ -1079,10 +1082,11 @@ static int ksr_tls_fix_domain(tls_domain_t* d, tls_domain_t* def)
}
#ifndef OPENSSL_NO_TLSEXT
- if ((d->type & TLS_DOMAIN_SRV) && d->server_name.len>0) {
+ if ((d->type & TLS_DOMAIN_SRV)
+ && (d->server_name.len>0 || (d->type & TLS_DOMAIN_DEF))) {
LM_NOTICE("registered server_name callback handler for socket "
"[%s:%d], server_name='%s' ...\n", ip_addr2a(&d->ip),
d->port,
- d->server_name.s);
+ (d->server_name.s)?d->server_name.s:"<default>");
}
#endif