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.

Pick-to: 6.0 5.15
Change-Id: I1278b371bd1edf2d656760c371bfb6da5dcab6ec
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Timur Pocheptsov 2020-12-17 06:42:11 +01:00
parent 61943aefd6
commit 3bc398f766
1 changed files with 9 additions and 2 deletions

View File

@ -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;
}