summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2011-02-25 11:49:43 +0100
committerPeter Hartmann <peter.hartmann@nokia.com>2011-02-28 13:39:20 +0100
commit600374f0e4ff5d497120a2dbabd6d0a9ed05c47c (patch)
tree17e9c79a4f79c839dfb6a25440ec649fdf7caae8 /src/network
parent3a16e772efe7f39d506b90e14b74a2b078648a56 (diff)
Add QSslSocket::setPeerVerifyName()/peerVerifyName()
This allows to set the sslPeerName even when not using connectToHostEncrypted, but rather connectToHost + startClientEncryption Task-number: QTBUG-1352 Merge-request: 1110 Reviewed-by: Peter Hartmann <peter.hartmann@nokia.com>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qsslsocket.cpp28
-rw-r--r--src/network/ssl/qsslsocket.h3
2 files changed, 31 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 61f27fe6a6..b9d8e1642f 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -659,6 +659,34 @@ void QSslSocket::setPeerVerifyDepth(int depth)
}
/*!
+ \since 4.8
+
+ Returns the different hostname for the certificate validation, as set by
+ setPeerVerifyName or by connectToHostEncrypted.
+
+ \sa setPeerVerifyName(), connectToHostEncrypted()
+*/
+QString QSslSocket::peerVerifyName() const
+{
+ Q_D(const QSslSocket);
+ return d->verificationPeerName;
+}
+
+/*!
+ \since 4.8
+
+ Sets a different hostname for the certificate validation instead of the one used for the TCP
+ connection.
+
+ \sa connectToHostEncrypted()
+*/
+void QSslSocket::setPeerVerifyName(const QString &hostName)
+{
+ Q_D(QSslSocket);
+ d->verificationPeerName = hostName;
+}
+
+/*!
\reimp
Returns the number of decrypted bytes that are immediately available for
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index 703a1fbf34..648fd8c1d0 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -106,6 +106,9 @@ public:
int peerVerifyDepth() const;
void setPeerVerifyDepth(int depth);
+ QString peerVerifyName() const;
+ void setPeerVerifyName(const QString &hostName);
+
// From QIODevice
qint64 bytesAvailable() const;
qint64 bytesToWrite() const;