add debug notes to help identify where trusted fingerprints file is

This commit is contained in:
Dayne Broderson 2018-12-19 20:36:57 -09:00 committed by Adrian Lucrèce Céleste
parent ea3e20ade1
commit 5f71b47b5a

View File

@ -704,18 +704,30 @@ SecureSocket::verifyCertFingerprint()
kFingerprintDirName,
kFingerprintTrustedServersFilename);
// Provide debug hint as to what file is being used to verify fingerprint trust
LOG((CLOG_NOTE "trustedServersFilename: %s", trustedServersFilename.c_str() ));
// check if this fingerprint exist
String fileLine;
std::ifstream file;
file.open(trustedServersFilename.c_str());
if ( ! file.is_open() ) {
LOG((CLOG_NOTE "Unable to open trustedServersFile: %s", trustedServersFilename.c_str() ));
} else {
LOG((CLOG_NOTE "Opened trustedServersFilename: %s", trustedServersFilename.c_str() ));
}
bool isValid = false;
while (!file.eof() && file.is_open()) {
getline(file,fileLine);
if (!fileLine.empty()) {
if (fileLine.compare(fingerprint) == 0) {
LOG((CLOG_NOTE "Fingerprint matchs trusted fingerprint"));
isValid = true;
break;
} else {
LOG((CLOG_NOTE "Fingerprint does not match trusted fingerprint"));
}
}
}