From 75084776140610f31f28371a2c78191464577c40 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Sun, 21 Jun 2020 18:48:46 +0200 Subject: Fixes a double-error-handlign with SSL trust. Error page is now more correct --- src/ssltrust.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/ssltrust.cpp') diff --git a/src/ssltrust.cpp b/src/ssltrust.cpp index bbbc360..f35988e 100644 --- a/src/ssltrust.cpp +++ b/src/ssltrust.cpp @@ -48,16 +48,21 @@ void SslTrust::save(QSettings &settings) const } bool SslTrust::isTrusted(QUrl const & url, const QSslCertificate &certificate) +{ + return (getTrust(url, certificate) == Trusted); +} + +SslTrust::TrustStatus SslTrust::getTrust(const QUrl &url, const QSslCertificate &certificate) { if(trust_level == TrustEverything) - return true; + return Trusted; if(auto host_or_none = trusted_hosts.get(url.host()); host_or_none) { if(host_or_none->public_key == certificate.publicKey()) - return true; + return Trusted; qDebug() << "certificate mismatch for" << url; - return false; + return Mistrusted; } else { @@ -70,9 +75,9 @@ bool SslTrust::isTrusted(QUrl const & url, const QSslCertificate &certificate) bool ok = trusted_hosts.insert(host); assert(ok); - return true; + return Trusted; } - return false; + return Untrusted; } } -- cgit v1.2.3