Changeset View
Changeset View
Standalone View
Standalone View
src/core/ksslcertificatemanager.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
52 | #mail.kdab.net = ExpireUTC 2008-08-20T18:22:14, All <- not implemented | 52 | #mail.kdab.net = ExpireUTC 2008-08-20T18:22:14, All <- not implemented | ||
53 | #* = ExpireUTC 9999-12-31T23:59:59, Reject #we know that something is wrong with that certificate | 53 | #* = ExpireUTC 9999-12-31T23:59:59, Reject #we know that something is wrong with that certificate | ||
54 | CertificatePEM = <PEM-encoded certificate> #host entries are all lowercase, thus no clashes | 54 | CertificatePEM = <PEM-encoded certificate> #host entries are all lowercase, thus no clashes | ||
55 | 55 | | |||
56 | */ | 56 | */ | ||
57 | 57 | | |||
58 | // TODO GUI for managing exception rules | 58 | // TODO GUI for managing exception rules | ||
59 | 59 | | |||
60 | class KSslCertificateRulePrivate | | |||
61 | { | | |||
62 | public: | | |||
63 | QSslCertificate certificate; | | |||
64 | QString hostName; | | |||
65 | bool isRejected; | | |||
66 | QDateTime expiryDateTime; | | |||
67 | QList<QSslError::SslError> ignoredErrors; | | |||
68 | }; | | |||
69 | | ||||
70 | KSslCertificateRule::KSslCertificateRule(const QSslCertificate &cert, const QString &hostName) | 60 | KSslCertificateRule::KSslCertificateRule(const QSslCertificate &cert, const QString &hostName) | ||
71 | : d(new KSslCertificateRulePrivate()) | 61 | : d(new KSslCertificateRulePrivate()) | ||
72 | { | 62 | { | ||
73 | d->certificate = cert; | 63 | d->certificate = cert; | ||
74 | d->hostName = hostName; | 64 | d->hostName = hostName; | ||
75 | d->isRejected = false; | 65 | d->isRejected = false; | ||
76 | } | 66 | } | ||
77 | 67 | | |||
▲ Show 20 Lines • Show All 85 Lines • ▼ Show 20 Line(s) | 152 | { | |||
163 | d->ignoredErrors.clear(); | 153 | d->ignoredErrors.clear(); | ||
164 | for (const QSslError &error : errors) { | 154 | for (const QSslError &error : errors) { | ||
165 | if (!isErrorIgnored(error.error())) { | 155 | if (!isErrorIgnored(error.error())) { | ||
166 | d->ignoredErrors.append(error.error()); | 156 | d->ignoredErrors.append(error.error()); | ||
167 | } | 157 | } | ||
168 | } | 158 | } | ||
169 | } | 159 | } | ||
170 | 160 | | |||
161 | void KSslCertificateRule::setIgnoredErrors(const QList<QSslError::SslError> &errors) | ||||
162 | { | ||||
163 | d->ignoredErrors.clear(); | ||||
164 | for (QSslError::SslError error : errors) { | ||||
165 | if (!isErrorIgnored(error)) { | ||||
166 | d->ignoredErrors.append(error); | ||||
167 | } | ||||
168 | } | ||||
169 | } | ||||
170 | | ||||
171 | QList<KSslError::Error> KSslCertificateRule::ignoredErrors() const | 171 | QList<KSslError::Error> KSslCertificateRule::ignoredErrors() const | ||
172 | { | 172 | { | ||
173 | // TODO KF6: return d->ignoredErrors | 173 | // TODO KF6: return d->ignoredErrors | ||
174 | // return d->ignoredErrors; | 174 | // return d->ignoredErrors; | ||
175 | QList<KSslError::Error> errors; | 175 | QList<KSslError::Error> errors; | ||
176 | errors.reserve(d->ignoredErrors.size()); | 176 | errors.reserve(d->ignoredErrors.size()); | ||
177 | std::transform(d->ignoredErrors.cbegin(), d->ignoredErrors.cend(), std::back_inserter(errors), KSslErrorPrivate::errorFromQSslError); | 177 | std::transform(d->ignoredErrors.cbegin(), d->ignoredErrors.cend(), std::back_inserter(errors), KSslErrorPrivate::errorFromQSslError); | ||
178 | return errors; | 178 | return errors; | ||
▲ Show 20 Lines • Show All 363 Lines • Show Last 20 Lines |