Explorar o código

Issue 2265 – Password pipe cannot be used to open session in an existing instance

https://winscp.net/tracker/2265

Source commit: 947e31d551b284e0e59296c8a5a21805817678d7
Martin Prikryl hai 1 ano
pai
achega
9936e7893b
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      source/core/SessionData.cpp

+ 6 - 2
source/core/SessionData.cpp

@@ -2237,6 +2237,7 @@ bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
   }
 
   bool Unsafe = FLAGSET(Flags, pufUnsafe);
+  bool ParseOnly = FLAGSET(Flags, pufParseOnly);
   if (!Url.IsEmpty())
   {
     UnicodeString DecodedUrl = DecodeUrlChars(Url);
@@ -2281,7 +2282,6 @@ bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
 
     UnicodeString ARemoteDirectory;
 
-    bool ParseOnly = FLAGSET(Flags, pufParseOnly);
     if (Data != NULL)
     {
       DoCopyData(Data, ParseOnly);
@@ -2581,7 +2581,11 @@ bool __fastcall TSessionData::ParseUrl(UnicodeString Url, TOptions * Options,
         ApplyRawSettings(RawSettings.get(), Unsafe);
       }
     }
-    if (Options->FindSwitch(PASSWORDSFROMFILES_SWITCH))
+    if (Options->FindSwitch(PASSWORDSFROMFILES_SWITCH) &&
+        // Ad-hoc condition for the current only specific use of pufParseOnly
+        // (when we do not want to consume the password pipe by the current instance,
+        // in case the URL needs to be passed to another instance)
+        !ParseOnly)
     {
       ReadPasswordsFromFiles();
     }