summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers')
-rw-r--r--Swift/Controllers/MainController.cpp6
-rw-r--r--Swift/Controllers/Storages/CertificateStorageTrustChecker.h12
-rw-r--r--Swift/Controllers/UIInterfaces/LoginWindow.h2
3 files changed, 10 insertions, 10 deletions
diff --git a/Swift/Controllers/MainController.cpp b/Swift/Controllers/MainController.cpp
index 40b4ded..cb43057 100644
--- a/Swift/Controllers/MainController.cpp
+++ b/Swift/Controllers/MainController.cpp
@@ -559,9 +559,9 @@ void MainController::handleDisconnected(const boost::optional<ClientError>& erro
}
bool forceReconnectAfterCertificateTrust = false;
if (!certificateErrorMessage.empty()) {
- Certificate::ref certificate = certificateTrustChecker_->getLastCertificate();
- if (loginWindow_->askUserToTrustCertificatePermanently(certificateErrorMessage, certificate)) {
- certificateStorage_->addCertificate(certificate);
+ std::vector<Certificate::ref> certificates = certificateTrustChecker_->getLastCertificateChain();
+ if (!certificates.empty() && loginWindow_->askUserToTrustCertificatePermanently(certificateErrorMessage, certificates)) {
+ certificateStorage_->addCertificate(certificates[0]);
forceReconnectAfterCertificateTrust = true;
}
else {
diff --git a/Swift/Controllers/Storages/CertificateStorageTrustChecker.h b/Swift/Controllers/Storages/CertificateStorageTrustChecker.h
index 40838dd..a73590a 100644
--- a/Swift/Controllers/Storages/CertificateStorageTrustChecker.h
+++ b/Swift/Controllers/Storages/CertificateStorageTrustChecker.h
@@ -18,17 +18,17 @@ namespace Swift {
CertificateStorageTrustChecker(CertificateStorage* storage) : storage(storage) {
}
- virtual bool isCertificateTrusted(Certificate::ref certificate) {
- lastCertificate = certificate;
- return storage->hasCertificate(certificate);
+ virtual bool isCertificateTrusted(Certificate::ref, const std::vector<Certificate::ref>& certificateChain) {
+ lastCertificateChain = std::vector<Certificate::ref>(certificateChain.begin(), certificateChain.end());
+ return certificateChain.empty() ? false : storage->hasCertificate(certificateChain[0]);
}
- Certificate::ref getLastCertificate() const {
- return lastCertificate;
+ const std::vector<Certificate::ref>& getLastCertificateChain() const {
+ return lastCertificateChain;
}
private:
CertificateStorage* storage;
- Certificate::ref lastCertificate;
+ std::vector<Certificate::ref> lastCertificateChain;
};
}
diff --git a/Swift/Controllers/UIInterfaces/LoginWindow.h b/Swift/Controllers/UIInterfaces/LoginWindow.h
index bbbbe35..f1c2ce1 100644
--- a/Swift/Controllers/UIInterfaces/LoginWindow.h
+++ b/Swift/Controllers/UIInterfaces/LoginWindow.h
@@ -31,7 +31,7 @@ namespace Swift {
virtual void setLoginAutomatically(bool loginAutomatically) = 0;
virtual void quit() = 0;
/** Blocking request whether a cert should be permanently trusted.*/
- virtual bool askUserToTrustCertificatePermanently(const std::string& message, Certificate::ref) = 0;
+ virtual bool askUserToTrustCertificatePermanently(const std::string& message, const std::vector<Certificate::ref>& certificateChain) = 0;
boost::signal<void ()> onCancelLoginRequest;
boost::signal<void ()> onQuitRequest;