From 1003de21b5d9c6880b4680df976bb8819665e1f7 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Wed, 26 Feb 2025 12:12:54 -0500 Subject: [PATCH] refactor: do not show error if the fingerprint database is not created yet --- src/lib/net/SecureSocket.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/lib/net/SecureSocket.cpp b/src/lib/net/SecureSocket.cpp index 1891fc62c..d0c7ea514 100644 --- a/src/lib/net/SecureSocket.cpp +++ b/src/lib/net/SecureSocket.cpp @@ -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;