diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2011-03-01 15:58:30 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2011-03-04 12:36:53 (GMT) |
commit | 206b614f2e9623d792e6f398bf11765a44c272f5 (patch) | |
tree | 409de97cd08e70e7f61035aff87dcbd6c9fd53a3 /src/network/ssl/qsslsocket_openssl.cpp | |
parent | 7458c4bb9a0f6f925cb6002d3b664bbbc21e75ef (diff) | |
download | Qt-206b614f2e9623d792e6f398bf11765a44c272f5.zip Qt-206b614f2e9623d792e6f398bf11765a44c272f5.tar.gz Qt-206b614f2e9623d792e6f398bf11765a44c272f5.tar.bz2 |
SSL backend: check at runtime for the right OpenSSL version for SNI
SNI = Server Name Indication. The function "SSL_ctrl()" has been there
since always in OpenSSL, but not with the specific enum
SSL_CTRL_SET_TLSEXT_HOSTNAME, so let's avoid the call for older
versions.
Additionally, fix the resolving of SSL_CTX_load_verify_locations for
Symbian (is not used in Symbian yet).
Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network/ssl/qsslsocket_openssl.cpp')
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 455a49f1..646889c 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -393,14 +393,15 @@ init_context: } #if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) - if (client) { + if (client && q_SSLeay() >= 0x00090806fL) { // Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format. QString tlsHostName = verificationPeerName.isEmpty() ? q->peerName() : verificationPeerName; if (tlsHostName.isEmpty()) tlsHostName = hostName; QByteArray ace = QUrl::toAce(tlsHostName); if (!ace.isEmpty()) { - q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData()); + if (!q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData())) + qWarning("could not set SSL_CTRL_SET_TLSEXT_HOSTNAME, Server Name Indication disabled"); } } #endif |