From e405ec25e30b2187bb6ada867b87f16e9454ef0b Mon Sep 17 00:00:00 2001 From: Xinyu Hou Date: Wed, 15 Apr 2015 13:25:18 +0100 Subject: [PATCH] Always log out server fingerprint #4522 --- src/lib/plugin/ns/SecureSocket.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/lib/plugin/ns/SecureSocket.cpp b/src/lib/plugin/ns/SecureSocket.cpp index 22815cce..7f78554c 100644 --- a/src/lib/plugin/ns/SecureSocket.cpp +++ b/src/lib/plugin/ns/SecureSocket.cpp @@ -461,29 +461,27 @@ SecureSocket::verifyCertFingerprint() // format fingerprint into hexdecimal format with colon separator String fingerprint(reinterpret_cast(tempFingerprint), tempFingerprintLen); formatFingerprint(fingerprint); + LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str())); // check if this fingerprint exist String fileLine; std::ifstream file; file.open(m_certFingerprintFilename.c_str()); + bool isValid = false; while (!file.eof()) { getline(file,fileLine); // example of a fingerprint:A1:B2:C3 if (!fileLine.empty()) { if (fileLine.compare(fingerprint) == 0) { - file.close(); - return true; + isValid = true; + break; } } } file.close(); - - LOG((CLOG_NOTE "new fingerprint from a server")); - LOG((CLOG_NOTE "server fingerprint: %s", fingerprint.c_str())); - - return false; + return isValid; } ISocketMultiplexerJob*