diff --git a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp index b0a497f0..53e4eaee 100644 --- a/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp +++ b/src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp @@ -317,9 +317,9 @@ void TLSSocket_GnuTLS::handshake() { // Start handshaking process try { - string peerAddress = getPeerAddress(); + string peerName = getPeerName(); - gnutls_server_name_set(*m_session->m_gnutlsSession, GNUTLS_NAME_DNS, peerAddress.c_str(), peerAddress.size()); + gnutls_server_name_set(*m_session->m_gnutlsSession, GNUTLS_NAME_DNS, peerName.c_str(), peerName.size()); while (true) { diff --git a/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp b/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp index 2f115f6c..978f0ca6 100644 --- a/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp +++ b/src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp @@ -122,9 +122,9 @@ TLSSocket_OpenSSL::~TLSSocket_OpenSSL() { void TLSSocket_OpenSSL::createSSLHandle() { if (m_wrapped->isConnected()) { - string peerAddress = getPeerAddress(); + string peerName = getPeerName(); - if (peerAddress.empty()) { + if (peerName.empty()) { throw exceptions::tls_exception("Unknown host name, will not be able to set SNI"); } @@ -168,7 +168,7 @@ void TLSSocket_OpenSSL::createSSLHandle() { } SSL_set_bio(m_ssl, sockBio, sockBio); - SSL_set_tlsext_host_name(m_ssl, peerAddress.c_str()); + SSL_set_tlsext_host_name(m_ssl, peerName.c_str()); SSL_set_connect_state(m_ssl); SSL_set_mode(m_ssl, SSL_MODE_AUTO_RETRY | SSL_MODE_ENABLE_PARTIAL_WRITE | SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);