From 600374f0e4ff5d497120a2dbabd6d0a9ed05c47c Mon Sep 17 00:00:00 2001 From: David Faure Date: Fri, 25 Feb 2011 11:49:43 +0100 Subject: 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 --- src/network/ssl/qsslsocket.cpp | 28 ++++++++++++++++++++++++++++ src/network/ssl/qsslsocket.h | 3 +++ 2 files changed, 31 insertions(+) diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp index 61f27fe..b9d8e16 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 703a1fb..648fd8c 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; -- cgit v0.12