summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2011-02-25 10:49:40 (GMT)
committerPeter Hartmann <peter.hartmann@nokia.com>2011-02-28 12:39:09 (GMT)
commit3a16e772efe7f39d506b90e14b74a2b078648a56 (patch)
treedee41284cb46b76a497f9c8664955374d65e2d73
parentc675b021d2d598a924a7c7e9786fbf7c9620549c (diff)
downloadQt-3a16e772efe7f39d506b90e14b74a2b078648a56.zip
Qt-3a16e772efe7f39d506b90e14b74a2b078648a56.tar.gz
Qt-3a16e772efe7f39d506b90e14b74a2b078648a56.tar.bz2
QSslSocket SNI: prefer verificationPeerName then peerName then hostName
As suggested by p--hartmann in a comment for MR 1574. Task-number: QTBUG-1352 Merge-request: 1110 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 11dc941..60d6cae 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -389,9 +389,12 @@ init_context:
#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT)
if (client) {
// Set server hostname on TLS extension. RFC4366 section 3.1 requires it in ACE format.
- QByteArray ace = QUrl::toAce(hostName);
+ 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());
+ q_SSL_ctrl(ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, ace.constData());
}
}
#endif