diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-03-14 16:11:21 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-03-15 15:27:59 (GMT) |
commit | d4d7f3575c229848f08c7df75a1281755d6c41a8 (patch) | |
tree | 0e71b85e107eb171ad4c20e2b4da8252739f35cd /tests | |
parent | 761bccd408c72e1d1d10d6c69f9f1d01fff30a0c (diff) | |
download | Qt-d4d7f3575c229848f08c7df75a1281755d6c41a8.zip Qt-d4d7f3575c229848f08c7df75a1281755d6c41a8.tar.gz Qt-d4d7f3575c229848f08c7df75a1281755d6c41a8.tar.bz2 |
SSL: Fix memleak related to local certificate
Task-number: QTBUG-6504
Task-number: QTBUG-8924
Task-number: QTBUG-5645
Reviewed-by: andreas
Reviewed-by: Peter Hartmann
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qsslsocket/tst_qsslsocket.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/auto/qsslsocket/tst_qsslsocket.cpp b/tests/auto/qsslsocket/tst_qsslsocket.cpp index ad2b50d..4397ab1 100644 --- a/tests/auto/qsslsocket/tst_qsslsocket.cpp +++ b/tests/auto/qsslsocket/tst_qsslsocket.cpp @@ -666,6 +666,21 @@ void tst_QSslSocket::isEncrypted() void tst_QSslSocket::localCertificate() { + if (!QSslSocket::supportsSsl()) + return; + + // This test does not make 100% sense yet. We just set some local CA/cert/key and use it + // to authenticate ourselves against the server. The server does not actually check this + // values. This test should just run the codepath inside qsslsocket_openssl.cpp + + QSslSocketPtr socket = newSocket(); + QList<QSslCertificate> localCert = QSslCertificate::fromPath(SRCDIR "certs/qt-test-server-cacert.pem"); + socket->setCaCertificates(localCert); + socket->setLocalCertificate(QLatin1String(SRCDIR "certs/fluke.cert")); + socket->setPrivateKey(QLatin1String(SRCDIR "certs/fluke.key")); + + socket->connectToHostEncrypted(QtNetworkSettings::serverName(), 443); + QVERIFY(socket->waitForEncrypted(5000)); } void tst_QSslSocket::mode() |