CA fetcher - do not add CA root if it's already present

As it was found recently CA fetcher, while building a chain with a missing
intermediary, may return the root we are already aware of (had in the "ROOT"
store). While this is in general harmless, it can be a bit surprising if
some code is analyzing the list of CA certificates after a handshake.

Pick-to: 5.15
Change-Id: I1df3b537e2a812de17e2c94ad4643cf36e7e946f
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
bb10
Timur Pocheptsov 2020-05-11 12:06:38 +02:00
parent b428e98052
commit 479c3bd93b
1 changed files with 2 additions and 0 deletions

View File

@ -2467,6 +2467,8 @@ void QSslSocketPrivate::addDefaultCaCertificate(const QSslCertificate &cert)
{
QSslSocketPrivate::ensureInitialized();
QMutexLocker locker(&globalData()->mutex);
if (globalData()->config->caCertificates.contains(cert))
return;
globalData()->config.detach();
globalData()->config->caCertificates += cert;
globalData()->dtlsConfig.detach();