[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kio] src/core: frameworks port of commit 38a89ca:
From: Dawit Alemayehu <adawit () kde ! org>
Date: 2014-11-10 13:28:36
Message-ID: E1Xnp1I-0007uy-0y () scm ! kde ! org
[Download RAW message or body]
Git commit 294a6a0d983e22723851fe07e381e70cb57c6744 by Dawit Alemayehu.
Committed on 10/11/2014 at 13:29.
Pushed by adawit into branch 'master'.
frameworks port of commit 38a89ca:
Allow user to cancel out of the certificate accept duration dialog box.
CCBUG: 335375
M +26 -22 src/core/tcpslavebase.cpp
http://commits.kde.org/kio/294a6a0d983e22723851fe07e381e70cb57c6744
diff --git a/src/core/tcpslavebase.cpp b/src/core/tcpslavebase.cpp
index 9f9c8b7..e62e72a 100644
--- a/src/core/tcpslavebase.cpp
+++ b/src/core/tcpslavebase.cpp
@@ -816,40 +816,44 @@ TCPSlaveBase::SslResult TCPSlaveBase::verifyServerCertificate()
message = message.trimmed();
int msgResult;
+ QDateTime ruleExpiry = QDateTime::currentDateTime();
do {
msgResult = messageBox(WarningYesNoCancel, message,
i18n("Server Authentication"),
i18n("&Details"), i18n("Co&ntinue"));
- if (msgResult == SlaveBase::Yes) {
+ switch (msgResult) {
+ case SlaveBase::Yes:
//Details was chosen- show the certificate and error details
messageBox(SSLMessageBox /*the SSL info dialog*/, d->host);
- } else if (msgResult == SlaveBase::Cancel) {
+ break;
+ case SlaveBase::No: {
+ //fall through on SlaveBase::No
+ const int result = messageBox(WarningYesNoCancel,
+ i18n("Would you like to accept this "
+ "certificate forever without "
+ "being prompted?"),
+ i18n("Server Authentication"),
+ i18n("&Forever"),
+ i18n("&Current Session only"));
+ if (result == SlaveBase::Yes) {
+ //accept forever ("for a very long time")
+ ruleExpiry = ruleExpiry.addYears(1000);
+ } else if (result == SlaveBase::No) {
+ //accept "for a short time", half an hour.
+ ruleExpiry = ruleExpiry.addSecs(30*60);
+ } else {
+ msgResult = SlaveBase::Yes;
+ }
+ break;
+ }
+ case SlaveBase::Cancel:
return ResultFailed;
- } else if (msgResult != SlaveBase::No) {
+ default:
qWarning() << "Unexpected MessageBox response received:" << msgResult;
return ResultFailed;
}
- //fall through on SlaveBase::No
} while (msgResult == SlaveBase::Yes);
- //Save the user's choice to ignore the SSL errors.
-
- msgResult = messageBox(WarningYesNo,
- i18n("Would you like to accept this "
- "certificate forever without "
- "being prompted?"),
- i18n("Server Authentication"),
- i18n("&Forever"),
- i18n("&Current Session only"));
- QDateTime ruleExpiry = QDateTime::currentDateTime();
- if (msgResult == SlaveBase::Yes) {
- //accept forever ("for a very long time")
- ruleExpiry = ruleExpiry.addYears(1000);
- } else {
- //accept "for a short time", half an hour.
- ruleExpiry = ruleExpiry.addSecs(30 * 60);
- }
-
//TODO special cases for wildcard domain name in the certificate!
//rule = KSslCertificateRule(d->socket.peerCertificateChain().first(), whatever);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic