Changeset View
Changeset View
Standalone View
Standalone View
src/widgets/sslui.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | bool KIO::SslUi::askIgnoreSslErrors(const KSslErrorUiData &uiData, RulesStorage storedRules) | 35 | bool KIO::SslUi::askIgnoreSslErrors(const KSslErrorUiData &uiData, RulesStorage storedRules) | ||
36 | { | 36 | { | ||
37 | const KSslErrorUiData::Private *ud = KSslErrorUiData::Private::get(&uiData); | 37 | const KSslErrorUiData::Private *ud = KSslErrorUiData::Private::get(&uiData); | ||
38 | if (ud->sslErrors.isEmpty()) { | 38 | if (ud->sslErrors.isEmpty()) { | ||
39 | return true; | 39 | return true; | ||
40 | } | 40 | } | ||
41 | 41 | | |||
42 | QList<KSslError> fatalErrors = KSslCertificateManager::nonIgnorableErrors(ud->sslErrors); | 42 | const QList<QSslError> fatalErrors = KSslCertificateManager::nonIgnorableErrors(ud->sslErrors); | ||
43 | if (!fatalErrors.isEmpty()) { | 43 | if (!fatalErrors.isEmpty()) { | ||
44 | //TODO message "sorry, fatal error, you can't override it" | 44 | //TODO message "sorry, fatal error, you can't override it" | ||
45 | return false; | 45 | return false; | ||
46 | } | 46 | } | ||
47 | if (ud->certificateChain.isEmpty()) { | 47 | if (ud->certificateChain.isEmpty()) { | ||
48 | // SSL without certificates is quite useless and should never happen | 48 | // SSL without certificates is quite useless and should never happen | ||
49 | KMessageBox::sorry(nullptr, i18n("The remote host did not send any SSL certificates.\n" | 49 | KMessageBox::sorry(nullptr, i18n("The remote host did not send any SSL certificates.\n" | ||
50 | "Aborting because the identity of the host cannot be established.")); | 50 | "Aborting because the identity of the host cannot be established.")); | ||
51 | return false; | 51 | return false; | ||
52 | } | 52 | } | ||
53 | 53 | | |||
54 | KSslCertificateManager *const cm = KSslCertificateManager::self(); | 54 | KSslCertificateManager *const cm = KSslCertificateManager::self(); | ||
55 | KSslCertificateRule rule(ud->certificateChain.first(), ud->host); | 55 | KSslCertificateRule rule(ud->certificateChain.first(), ud->host); | ||
56 | if (storedRules & RecallRules) { | 56 | if (storedRules & RecallRules) { | ||
57 | rule = cm->rule(ud->certificateChain.first(), ud->host); | 57 | rule = cm->rule(ud->certificateChain.first(), ud->host); | ||
58 | // remove previously seen and acknowledged errors | 58 | // remove previously seen and acknowledged errors | ||
59 | QList<KSslError> remainingErrors = rule.filterErrors(ud->sslErrors); | 59 | const QList<QSslError> remainingErrors = rule.filterErrors(ud->sslErrors); | ||
60 | if (remainingErrors.isEmpty()) { | 60 | if (remainingErrors.isEmpty()) { | ||
61 | //qDebug() << "Error list empty after removing errors to be ignored. Continuing."; | 61 | //qDebug() << "Error list empty after removing errors to be ignored. Continuing."; | ||
62 | return true; | 62 | return true; | ||
63 | } | 63 | } | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | //### We don't ask to permanently reject the certificate | 66 | //### We don't ask to permanently reject the certificate | ||
67 | 67 | | |||
68 | QString message = i18n("The server failed the authenticity check (%1).\n\n", ud->host); | 68 | QString message = i18n("The server failed the authenticity check (%1).\n\n", ud->host); | ||
69 | for (const KSslError &err : qAsConst(ud->sslErrors)) { | 69 | for (const QSslError &err : qAsConst(ud->sslErrors)) { | ||
70 | message.append(err.errorString() + QLatin1Char('\n')); | 70 | message.append(err.errorString() + QLatin1Char('\n')); | ||
71 | } | 71 | } | ||
72 | message = message.trimmed(); | 72 | message = message.trimmed(); | ||
73 | 73 | | |||
74 | int msgResult; | 74 | int msgResult; | ||
75 | do { | 75 | do { | ||
76 | msgResult = KMessageBox::warningYesNoCancel(nullptr, message, i18n("Server Authentication"), | 76 | msgResult = KMessageBox::warningYesNoCancel(nullptr, message, i18n("Server Authentication"), | ||
77 | KGuiItem(i18n("&Details"), QStringLiteral("help-about")), | 77 | KGuiItem(i18n("&Details"), QStringLiteral("help-about")), | ||
▲ Show 20 Lines • Show All 58 Lines • Show Last 20 Lines |