aboutsummaryrefslogtreecommitdiff
path: root/src/ssltrust.cpp
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-21 18:48:46 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-21 18:48:46 +0200
commit75084776140610f31f28371a2c78191464577c40 (patch)
treec8967b31c5d64e7e4592ad62742a9cbd61304f64 /src/ssltrust.cpp
parent79a03469fc46ced070980a1446af94877dc8c466 (diff)
downloadkristall-75084776140610f31f28371a2c78191464577c40.tar.gz
Fixes a double-error-handlign with SSL trust. Error page is now more correct
Diffstat (limited to 'src/ssltrust.cpp')
-rw-r--r--src/ssltrust.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/ssltrust.cpp b/src/ssltrust.cpp
index bbbc360..f35988e 100644
--- a/src/ssltrust.cpp
+++ b/src/ssltrust.cpp
@@ -49,15 +49,20 @@ 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;
}
}