summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2020-12-17 06:42:11 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-12-17 20:56:12 +0000
commitacf00dd72d892d32bd1a7ce416a6c4556b259289 (patch)
tree3a3cc94f0f3e3660802aeb10f5340bf82b8d3db3 /src/network
parent136cbafad59909c991a80db0b992a3920a9696c6 (diff)
QSslCertificate::operator == - cleanup error queue
Another case when an OpenSSL's call can dump some errors into the shared error queue discovered. An invalid certificate with non-null X509 * may result in several errors appended to the queue. Change-Id: I1278b371bd1edf2d656760c371bfb6da5dcab6ec Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 3bc398f76669c2532ae6e3f163f994feb7e6a0bf) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/network')
-rw-r--r--src/network/ssl/qsslcertificate_openssl.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/network/ssl/qsslcertificate_openssl.cpp b/src/network/ssl/qsslcertificate_openssl.cpp
index 35521427b2..11ad9aaf9a 100644
--- a/src/network/ssl/qsslcertificate_openssl.cpp
+++ b/src/network/ssl/qsslcertificate_openssl.cpp
@@ -65,10 +65,17 @@ bool QSslCertificate::operator==(const QSslCertificate &other) const
{
if (d == other.d)
return true;
+
if (d->null && other.d->null)
return true;
- if (d->x509 && other.d->x509)
- return q_X509_cmp(d->x509, other.d->x509) == 0;
+
+ if (d->x509 && other.d->x509) {
+ const int ret = q_X509_cmp(d->x509, other.d->x509);
+ if (ret >= -1 && ret <= 1)
+ return ret == 0;
+ QSslSocketBackendPrivate::logAndClearErrorQueue();
+ }
+
return false;
}