From 45cf7d13eb68be0fd469fd49275c000a2c7bcc2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= <slavek.banko@axis.cz>
Date: Sun, 9 Apr 2017 20:17:40 +0200
Subject: KSSL: Set hostname in TLSext to enable SNI support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
---
 tdeio/kssl/kssl.cc | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'tdeio/kssl')

diff --git a/tdeio/kssl/kssl.cc b/tdeio/kssl/kssl.cc
index e5f092157..0f34a55da 100644
--- a/tdeio/kssl/kssl.cc
+++ b/tdeio/kssl/kssl.cc
@@ -329,6 +329,9 @@ int rc;
 		d->m_ssl = 0;
 		return rc;
 	}
+#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
+	d->kossl->SSL_set_tlsext_host_name(d->m_ssl, d->proxyPeer.ascii());
+#endif
 
 	rc = d->kossl->SSL_accept(d->m_ssl);
 	if (rc == 1) {
@@ -424,6 +427,9 @@ int rc;
 		d->m_ssl = 0;
 		return rc;
 	}
+#ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME
+	d->kossl->SSL_set_tlsext_host_name(d->m_ssl, d->proxyPeer.ascii());
+#endif
 
 connect_again:
 	rc = d->kossl->SSL_connect(d->m_ssl);
-- 
cgit v1.2.1