[SSL] Properly restore user accepted certificats

This commit is contained in:
Hannah von Reth 2020-02-10 13:08:19 +01:00 committed by Kevin Ottens
parent c8dd333e31
commit ba87fc9e78
No known key found for this signature in database
GPG key ID: 074BBBCB8DECC9E2
2 changed files with 4 additions and 1 deletions

View file

@ -332,7 +332,9 @@ AccountPtr AccountManager::loadAccountHelper(QSettings &settings)
// now the server cert, it is in the general group
settings.beginGroup(QLatin1String("General"));
acc->setApprovedCerts(QSslCertificate::fromData(settings.value(caCertsKeyC).toByteArray()));
const auto certs = QSslCertificate::fromData(settings.value(caCertsKeyC).toByteArray());
qCInfo(lcAccountManager) << "Restored: " << certs.count() << " unknown certs.";
acc->setApprovedCerts(certs);
settings.endGroup();
return acc;

View file

@ -327,6 +327,7 @@ QSslConfiguration Account::getOrCreateSslConfig()
void Account::setApprovedCerts(const QList<QSslCertificate> certs)
{
_approvedCerts = certs;
QSslSocket::addDefaultCaCertificates(certs);
}
void Account::addApprovedCerts(const QList<QSslCertificate> certs)