summaryrefslogtreecommitdiffstats
path: root/tests/auto/qsslsocket
diff options
context:
space:
mode:
authorPeter Hartmann <peter.hartmann@nokia.com>2011-03-28 15:06:25 +0200
committerPeter Hartmann <peter.hartmann@nokia.com>2011-04-07 15:19:00 +0200
commit4d67ecf8a40ad0669c269091a6e15b157b4090a6 (patch)
tree61a1f0a9e0d186ee169c27adc82c3e0bc8a14351 /tests/auto/qsslsocket
parent2310cbe07b8f7de64d47fe825e0f5a49359923d8 (diff)
SSL code: introduce new error value for blacklisted certificates
improve error reporting by introducing a new enum value in case the peer certificate is blacklisted. Reviewed-by: Markus Goetz Task-number: QTBUG-18338
Diffstat (limited to 'tests/auto/qsslsocket')
-rw-r--r--tests/auto/qsslsocket/tst_qsslsocket.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp
index 9c32c2b2c5..5b30a39eaf 100644
--- a/tests/auto/qsslsocket/tst_qsslsocket.cpp
+++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp
@@ -188,7 +188,7 @@ private slots:
void ignoreSslErrorsListWithSlot();
void readFromClosedSocket();
void writeBigChunk();
- void blacklist();
+ void blacklistedCertificates();
void setEmptyDefaultConfiguration();
static void exitLoop()
@@ -1983,7 +1983,7 @@ void tst_QSslSocket::writeBigChunk()
socket->close();
}
-void tst_QSslSocket::blacklist()
+void tst_QSslSocket::blacklistedCertificates()
{
QFETCH_GLOBAL(bool, setProxy);
if (setProxy)
@@ -2004,14 +2004,15 @@ void tst_QSslSocket::blacklist()
QVERIFY(sender->state() == QAbstractSocket::ConnectedState);
receiver->setObjectName("receiver");
sender->setObjectName("sender");
- receiver->ignoreSslErrors();
receiver->startClientEncryption();
- connect(receiver, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(exitLoop()));
+ connect(receiver, SIGNAL(sslErrors(QList<QSslError>)), SLOT(exitLoop()));
connect(receiver, SIGNAL(encrypted()), SLOT(exitLoop()));
enterLoop(1);
- QCOMPARE(receiver->error(), QAbstractSocket::SslHandshakeFailedError);
- QCOMPARE(receiver->errorString(), QString("The peer certificate is blacklisted"));
+ QList<QSslError> sslErrors = receiver->sslErrors();
+ QVERIFY(sslErrors.count() > 0);
+ // there are more errors (self signed cert and hostname mismatch), but we only care about the blacklist error
+ QCOMPARE(sslErrors.at(0).error(), QSslError::CertificateBlacklisted);
}
void tst_QSslSocket::setEmptyDefaultConfiguration()