From e90afb8526d45d7ead8a662c5113e08370937f9d Mon Sep 17 00:00:00 2001 From: Viktor Gotwig Date: Tue, 21 Nov 2017 15:58:25 +0100 Subject: [PATCH] Adding tls host name extension (SNI) Signed-off-by: Viktor Gotwig --- lib/net_mosq.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/net_mosq.c b/lib/net_mosq.c index 73c3207d..d331ef07 100644 --- a/lib/net_mosq.c +++ b/lib/net_mosq.c @@ -589,6 +589,14 @@ int net__socket_connect_step3(struct mosquitto *mosq, const char *host, uint16_t } SSL_set_bio(mosq->ssl, bio, bio); + /* + * required for the SNI resolving + */ + if(SSL_set_tlsext_host_name(mosq->ssl, host) != 1) { + COMPAT_CLOSE(mosq->sock); + return MOSQ_ERR_TLS; + } + if(net__socket_connect_tls(mosq)){ return MOSQ_ERR_TLS; }