Skip to content

Commit

Permalink
Use peerName instead of peerAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Steele committed Nov 18, 2019
1 parent 39ece29 commit 893726c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/vmime/net/tls/gnutls/TLSSocket_GnuTLS.cpp
Expand Up @@ -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) {

Expand Down
6 changes: 3 additions & 3 deletions src/vmime/net/tls/openssl/TLSSocket_OpenSSL.cpp
Expand Up @@ -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");
}

Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 893726c

Please sign in to comment.