diff --git a/src/security/certstore.cpp b/src/security/certstore.cpp index 0c2f0e8e77b455030625091da9f344d15b26bbf9..8bd9236568b3d8c69ba86ac767a9416515121d90 100644 --- a/src/security/certstore.cpp +++ b/src/security/certstore.cpp @@ -604,12 +604,14 @@ TrustStore::getCertificateStatus(const std::string& cert_id) const auto cert = certStore_.getCertificate(cert_id); if (!cert) return PermissionStatus::UNDEFINED; - auto allowed = false; auto found = false; + auto allowed = false; + auto found = false; while (cert) { auto s = certStatus_.find(cert->getId().toString()); if (s != std::end(certStatus_)) { if (!found) { - found = true; allowed = true; // we need to find at least a certificate + found = true; + allowed = true; // we need to find at least a certificate } allowed &= s->second.second.allowed; if (!allowed) @@ -618,10 +620,11 @@ TrustStore::getCertificateStatus(const std::string& cert_id) const auto us = unknownCertStatus_.find(cert->getId().toString()); if (us != std::end(unknownCertStatus_)) { if (!found) { - found = true; allowed = true; // we need to find at least a certificate + found = true; + allowed = true; // we need to find at least a certificate } - allowed &= s->second.second.allowed; - if (!us->second.allowed) + allowed &= us->second.allowed; + if (!allowed) return PermissionStatus::BANNED; } }