소스 검색

Logging a complete host key only on Debug log level

Source commit: 11a479cbccfe8dc493b0230c1e318e433af03b16
Martin Prikryl 7 년 전
부모
커밋
4060c7b495
1개의 변경된 파일13개의 추가작업 그리고 3개의 파일을 삭제
  1. 13 3
      source/core/SecureShell.cpp

+ 13 - 3
source/core/SecureShell.cpp

@@ -2215,7 +2215,10 @@ void __fastcall TPasteKeyHandler::Paste(TObject * /*Sender*/, unsigned int & Ans
 void __fastcall TSecureShell::VerifyHostKey(UnicodeString Host, int Port,
 void __fastcall TSecureShell::VerifyHostKey(UnicodeString Host, int Port,
   const UnicodeString KeyType, UnicodeString KeyStr, UnicodeString Fingerprint)
   const UnicodeString KeyType, UnicodeString KeyStr, UnicodeString Fingerprint)
 {
 {
-  LogEvent(FORMAT(L"Verifying host key %s %s with fingerprint %s", (KeyType, FormatKeyStr(KeyStr), Fingerprint)));
+  if (Configuration->ActualLogProtocol >= 1)
+  {
+    LogEvent(FORMAT(L"Verifying host key %s %s with fingerprints %s", (KeyType, FormatKeyStr(KeyStr), Fingerprint)));
+  }
 
 
   GotHostKey();
   GotHostKey();
 
 
@@ -2257,8 +2260,15 @@ void __fastcall TSecureShell::VerifyHostKey(UnicodeString Host, int Port,
     }
     }
     else
     else
     {
     {
-      UnicodeString FormattedKey = Fingerprint ? StoredKey : FormatKeyStr(StoredKey);
-      LogEvent(FORMAT(L"Host key does not match cached key %s", (FormattedKey)));
+      if (Configuration->ActualLogProtocol >= 1)
+      {
+        UnicodeString FormattedKey = Fingerprint ? StoredKey : FormatKeyStr(StoredKey);
+        LogEvent(FORMAT(L"Host key does not match cached key %s", (FormattedKey)));
+      }
+      else
+      {
+        LogEvent(L"Host key does not match cached key");
+      }
     }
     }
   }
   }