浏览代码

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

https://winscp.net/tracker/2265

Source commit: 947e31d551b284e0e59296c8a5a21805817678d7
Martin Prikryl 1 年之前
父节点
当前提交
9936e7893b
共有 1 个文件被更改,包括 6 次插入2 次删除
  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();
     }