diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-13 22:18:43 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-05-13 22:19:10 +0200 |
commit | 3d4aeb791990f359e277efbfb0a1f1793945b55d (patch) | |
tree | e877b7b4ad76d554aa3dbe6131d03b98a7447c63 /src/network/ssl/qsslsocket_openssl.cpp | |
parent | b861c43395b17d5df34f24853faa21b9824a53af (diff) | |
parent | c8de2a8b5f5d0b9b3bc1d8ed8d3027ac40b00ee3 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/gui/kernel/qguiapplication.cpp
Change-Id: Ibe75603dc8a51769db6550ea3f07bc8d19b0be85
Diffstat (limited to 'src/network/ssl/qsslsocket_openssl.cpp')
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index b0d1ed2c4f..173d8eaa89 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -1633,23 +1633,23 @@ QList<QSslError> QSslSocketBackendPrivate::verify(QList<QSslCertificate> certifi setDefaultCaCertificates(defaultCaCertificates() + systemCaCertificates()); } - QList<QSslCertificate> expiredCerts; - foreach (const QSslCertificate &caCertificate, QSslSocket::defaultCaCertificates()) { - // add expired certs later, so that the - // valid ones are used before the expired ones - if (caCertificate.expiryDate() < QDateTime::currentDateTime()) { - expiredCerts.append(caCertificate); - } else { + // From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html: + // + // If several CA certificates matching the name, key identifier, and + // serial number condition are available, only the first one will be + // examined. This may lead to unexpected results if the same CA + // certificate is available with different expiration dates. If a + // ``certificate expired'' verification error occurs, no other + // certificate will be searched. Make sure to not have expired + // certificates mixed with valid ones. + // + // See also: QSslContext::fromConfiguration() + if (caCertificate.expiryDate() >= QDateTime::currentDateTime()) { q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle())); } } - // now add the expired certs - foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(certStore, reinterpret_cast<X509 *>(caCertificate.handle())); - } - QMutexLocker sslErrorListMutexLocker(&_q_sslErrorList()->mutex); // Register a custom callback to get all verification errors. |