refactor: do not show error if the fingerprint database is not created yet

This commit is contained in:
sithlord48
2025-02-26 12:12:54 -05:00
committed by Nick Bolton
parent b3866b69b2
commit 1003de21b5

View File

@ -675,13 +675,17 @@ bool SecureSocket::verifyCertFingerprint(const deskflow::fs::path &fingerprintDb
deskflow::openUtf8Path(file, fingerprintDbPath);
deskflow::FingerprintDatabase db;
db.read(fingerprintDbPath);
if (!db.fingerprints().empty()) {
LOG((CLOG_NOTE "read %d fingerprints from %s", db.fingerprints().size(), fingerprintDbPath.c_str()));
} else {
const bool emptyDB = db.fingerprints().empty();
if (file.good() && emptyDB) {
LOG((CLOG_ERR "failed to open trusted fingerprints file: %s", fingerprintDbPath.c_str()));
return false;
}
if (!emptyDB) {
LOG((CLOG_NOTE "read %d fingerprints from %s", db.fingerprints().size(), fingerprintDbPath.c_str()));
}
if (!db.isTrusted(sha256)) {
LOG((CLOG_WARN "fingerprint does not match trusted fingerprint"));
return false;