1
0
Эх сурвалжийг харах

Fix some warnings introduced by recent commits (pasting host key + configurable priority of host keys)

Source commit: b440d37ac2952c964601b22182a92c9a49ba15fe
Martin Prikryl 8 жил өмнө
parent
commit
1abb0a80e4
1 өөрчлөгдсөн 29 нэмэгдсэн , 27 устгасан
  1. 29 27
      source/core/SecureShell.cpp

+ 29 - 27
source/core/SecureShell.cpp

@@ -2173,42 +2173,44 @@ struct TPasteKeyHandler
   UnicodeString NormalizedFingerprint;
   TSessionUI * UI;
 
-  void __fastcall Paste(TObject * /*Sender*/, unsigned int & Answer)
+  void __fastcall Paste(TObject * Sender, unsigned int & Answer);
+};
+//---------------------------------------------------------------------------
+void __fastcall TPasteKeyHandler::Paste(TObject * /*Sender*/, unsigned int & Answer)
+{
+  UnicodeString ClipboardText;
+  if (TextFromClipboard(ClipboardText, true))
   {
-    UnicodeString ClipboardText;
-    if (TextFromClipboard(ClipboardText, true))
+    UnicodeString NormalizedClipboardFingerprint = NormalizeFingerprint(ClipboardText);
+    // case insensitive comparison, contrary to VerifyHostKey (we should change to insesitive there too)
+    if (SameText(NormalizedClipboardFingerprint, NormalizedFingerprint) ||
+        SameText(ClipboardText, KeyStr))
     {
-      UnicodeString NormalizedClipboardFingerprint = NormalizeFingerprint(ClipboardText);
-      // case insensitive comparison, contrary to VerifyHostKey (we should change to insesitive there too)
-      if (SameText(NormalizedClipboardFingerprint, NormalizedFingerprint) ||
-          SameText(ClipboardText, KeyStr))
-      {
-        Answer = qaYes;
-      }
-      else
+      Answer = qaYes;
+    }
+    else
+    {
+      const struct ssh_signkey * Algorithm;
+      try
       {
-        const struct ssh_signkey * Algorithm;
-        try
+        UnicodeString Key = ParseOpenSshPubLine(ClipboardText, Algorithm);
+        if (Key == KeyStr)
         {
-          UnicodeString Key = ParseOpenSshPubLine(ClipboardText, Algorithm);
-          if (Key == KeyStr)
-          {
-            Answer = qaYes;
-          }
-        }
-        catch (...)
-        {
-          // swallow
+          Answer = qaYes;
         }
       }
+      catch (...)
+      {
+        // swallow
+      }
     }
+  }
 
-    if (Answer == 0)
-    {
-      UI->QueryUser(LoadStr(HOSTKEY_NOT_MATCH_CLIPBOARD), NULL, qaOK, NULL, qtError);
-    }
+  if (Answer == 0)
+  {
+    UI->QueryUser(LoadStr(HOSTKEY_NOT_MATCH_CLIPBOARD), NULL, qaOK, NULL, qtError);
   }
-};
+}
 //---------------------------------------------------------------------------
 void __fastcall TSecureShell::VerifyHostKey(UnicodeString Host, int Port,
   const UnicodeString KeyType, UnicodeString KeyStr, UnicodeString Fingerprint)