, _capabilities(QVariantMap())
, _am(0)
, _credentials(0)
- , _treatSslErrorsAsFailure(false)
, _davPath( Theme::instance()->webDavPath() )
, _wasMigrated(false)
{
_approvedCerts += certs;
}
-void Account::resetSslCertErrorState()
+void Account::resetRejectedCertificates()
{
- _treatSslErrorsAsFailure = false;
+ _rejectedCertificates.clear();
}
void Account::setSslErrorHandler(AbstractSslErrorHandler *handler)
<< error.errorString() << "("<< error.error() << ")" << "\n";
}
- if( _treatSslErrorsAsFailure ) {
- // User decided once not to trust. Honor this decision.
+ bool allPreviouslyRejected = true;
+ foreach (const QSslError &error, errors) {
+ if (!_rejectedCertificates.contains(error.certificate())) {
+ allPreviouslyRejected = false;
+ }
+ }
+
+ // If all certs have previously been rejected by the user, don't ask again.
+ if( allPreviouslyRejected ) {
qDebug() << out << "Certs not trusted by user decision, returning.";
return;
}
// certificate changes.
reply->ignoreSslErrors(errors);
} else {
- _treatSslErrorsAsFailure = true;
+ // Mark all involved certificates as rejected, so we don't ask the user again.
+ foreach (const QSslError &error, errors) {
+ if (!_rejectedCertificates.contains(error.certificate())) {
+ _rejectedCertificates.append(error.certificate());
+ }
+ }
// if during normal operation, a new certificate was MITM'ed, and the user does not
// ACK it, the running request must be aborted and the QNAM must be reset, to not
// treat the new cert as granted. See bug #3283
// Usually when a user explicitly rejects a certificate we don't
// ask again. After this call, a dialog will again be shown when
// the next unknown certificate is encountered.
- void resetSslCertErrorState();
+ void resetRejectedCertificates();
// pluggable handler
void setSslErrorHandler(AbstractSslErrorHandler *handler);
QuotaInfo *_quotaInfo;
QNetworkAccessManager *_am;
AbstractCredentials* _credentials;
- bool _treatSslErrorsAsFailure;
+
+ /// Certificates that were explicitly rejected by the user
+ QList<QSslCertificate> _rejectedCertificates;
+
static QString _configFileName;
QByteArray _pemCertificate;
QString _pemPrivateKey;