refactor: do not show error if the fingerprint database is not created yet
This commit is contained in:
parent
b3866b69b2
commit
1003de21b5
1 changed files with 7 additions and 3 deletions
|
|
@ -675,13 +675,17 @@ bool SecureSocket::verifyCertFingerprint(const deskflow::fs::path &fingerprintDb
|
||||||
deskflow::openUtf8Path(file, fingerprintDbPath);
|
deskflow::openUtf8Path(file, fingerprintDbPath);
|
||||||
deskflow::FingerprintDatabase db;
|
deskflow::FingerprintDatabase db;
|
||||||
db.read(fingerprintDbPath);
|
db.read(fingerprintDbPath);
|
||||||
if (!db.fingerprints().empty()) {
|
const bool emptyDB = db.fingerprints().empty();
|
||||||
LOG((CLOG_NOTE "read %d fingerprints from %s", db.fingerprints().size(), fingerprintDbPath.c_str()));
|
|
||||||
} else {
|
if (file.good() && emptyDB) {
|
||||||
LOG((CLOG_ERR "failed to open trusted fingerprints file: %s", fingerprintDbPath.c_str()));
|
LOG((CLOG_ERR "failed to open trusted fingerprints file: %s", fingerprintDbPath.c_str()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!emptyDB) {
|
||||||
|
LOG((CLOG_NOTE "read %d fingerprints from %s", db.fingerprints().size(), fingerprintDbPath.c_str()));
|
||||||
|
}
|
||||||
|
|
||||||
if (!db.isTrusted(sha256)) {
|
if (!db.isTrusted(sha256)) {
|
||||||
LOG((CLOG_WARN "fingerprint does not match trusted fingerprint"));
|
LOG((CLOG_WARN "fingerprint does not match trusted fingerprint"));
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue