Forráskód Böngészése

Bug 1708: Remembered private key passphrase is not passed to PuTTY

https://winscp.net/tracker/1708
(cherry picked from commit 75d9f4b4665601d7ad8282d184989f46efb4336d)

Source commit: 3f52257cdc9576387a5befd202fa7cd62c93f61c
Martin Prikryl 7 éve
szülő
commit
e6403eac39
1 módosított fájl, 13 hozzáadás és 1 törlés
  1. 13 1
      source/windows/GUITools.cpp

+ 13 - 1
source/windows/GUITools.cpp

@@ -82,7 +82,19 @@ void __fastcall OpenSessionInPutty(const UnicodeString PuttyPath,
   {
 
     AParams = ExpandEnvironmentVariables(AParams);
-    UnicodeString Password = GUIConfiguration->PuttyPassword ? SessionData->Password : UnicodeString();
+    UnicodeString Password;
+    if (GUIConfiguration->PuttyPassword)
+    {
+      // Passphrase has precendence, as it's more likely entered by user during authentication, hence more likely really needed.
+      if (!SessionData->Passphrase.IsEmpty())
+      {
+        Password = SessionData->Passphrase;
+      }
+      else if (!SessionData->Password.IsEmpty())
+      {
+        Password = SessionData->Password;
+      }
+    }
     TCustomCommandData Data(SessionData, SessionData->UserName, Password);
     TRemoteCustomCommand RemoteCustomCommand(Data, SessionData->RemoteDirectory);
     TWinInteractiveCustomCommand InteractiveCustomCommand(