diff options
author | Martin Jones <martin.jones@nokia.com> | 2011-04-27 05:22:20 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2011-04-27 05:22:20 (GMT) |
commit | dcf9a1f2f20248de0da9549af54bc3a4844eaf5b (patch) | |
tree | c9eee3ff39000816113bcab3a5c035da97c2a9fc /src/network/ssl/qsslsocket_openssl.cpp | |
parent | 47712d1f330e4b22ce6dd30e7557288ef7f7fca0 (diff) | |
parent | 415951891cd75170f1e4b89b46effa3319b56e4e (diff) | |
download | Qt-dcf9a1f2f20248de0da9549af54bc3a4844eaf5b.zip Qt-dcf9a1f2f20248de0da9549af54bc3a4844eaf5b.tar.gz Qt-dcf9a1f2f20248de0da9549af54bc3a4844eaf5b.tar.bz2 |
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt into 4.7
Diffstat (limited to 'src/network/ssl/qsslsocket_openssl.cpp')
-rw-r--r-- | src/network/ssl/qsslsocket_openssl.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index 84e14ff..2427193 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -312,9 +312,18 @@ init_context: q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); } } + + bool addExpiredCerts = true; +#if defined(Q_OS_MAC) && (MAC_OS_X_VERSION_MAX_ALLOWED == MAC_OS_X_VERSION_10_5) + //On Leopard SSL does not work if we add the expired certificates. + if (QSysInfo::MacintoshVersion == QSysInfo::MV_10_5) + addExpiredCerts = false; +#endif // now add the expired certs - foreach (const QSslCertificate &caCertificate, expiredCerts) { - q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); + if (addExpiredCerts) { + foreach (const QSslCertificate &caCertificate, expiredCerts) { + q_X509_STORE_add_cert(ctx->cert_store, (X509 *)caCertificate.handle()); + } } // Register a custom callback to get all verification errors. @@ -1184,6 +1193,13 @@ bool QSslSocketBackendPrivate::startHandshake() X509 *x509 = q_SSL_get_peer_certificate(ssl); configuration.peerCertificate = QSslCertificatePrivate::QSslCertificate_from_X509(x509); q_X509_free(x509); + if (QSslCertificatePrivate::isBlacklisted(configuration.peerCertificate)) { + q->setErrorString(QSslSocket::tr("The peer certificate is blacklisted")); + q->setSocketError(QAbstractSocket::SslHandshakeFailedError); + emit q->error(QAbstractSocket::SslHandshakeFailedError); + plainSocket->disconnectFromHost(); + return false; + } // Start translating errors. QList<QSslError> errors; |