瀏覽代碼

Bug 1799: Master password prompt unintentionally appears when selecting site folder with a site with an encrypted password

https://winscp.net/tracker/1799

Source commit: 4afcf8e9f42b2999107fa170a8e93b8deac0df6c
Martin Prikryl 6 年之前
父節點
當前提交
c43cde2bd9
共有 2 個文件被更改,包括 15 次插入2 次删除
  1. 14 2
      source/core/SessionData.cpp
  2. 1 0
      source/core/SessionData.h

+ 14 - 2
source/core/SessionData.cpp

@@ -4937,6 +4937,11 @@ TSessionData * __fastcall TStoredSessionList::CheckIsInFolderOrWorkspaceAndResol
 }
 //---------------------------------------------------------------------------
 void __fastcall TStoredSessionList::GetFolderOrWorkspace(const UnicodeString & Name, TList * List)
+{
+  DoGetFolderOrWorkspace(Name, List, false);
+}
+//---------------------------------------------------------------------------
+void __fastcall TStoredSessionList::DoGetFolderOrWorkspace(const UnicodeString & Name, TList * List, bool NoRecrypt)
 {
   for (int Index = 0; (Index < Count); Index++)
   {
@@ -4947,7 +4952,14 @@ void __fastcall TStoredSessionList::GetFolderOrWorkspace(const UnicodeString & N
     if (Data != NULL)
     {
       TSessionData * Data2 = new TSessionData(L"");
-      Data2->Assign(Data);
+      if (NoRecrypt)
+      {
+        Data2->CopyDataNoRecrypt(Data);
+      }
+      else
+      {
+        Data2->Assign(Data);
+      }
 
       if (!RawData->Link.IsEmpty() && (DebugAlwaysTrue(Data != RawData)) &&
           // BACKWARD COMPATIBILITY
@@ -4979,7 +4991,7 @@ TStrings * __fastcall TStoredSessionList::GetFolderOrWorkspaceList(
   const UnicodeString & Name)
 {
   std::unique_ptr<TObjectList> DataList(new TObjectList());
-  GetFolderOrWorkspace(Name, DataList.get());
+  DoGetFolderOrWorkspace(Name, DataList.get(), true);
 
   std::unique_ptr<TStringList> Result(new TStringList());
   for (int Index = 0; (Index < DataList->Count); Index++)

+ 1 - 0
source/core/SessionData.h

@@ -744,6 +744,7 @@ private:
   TSessionData * __fastcall CheckIsInFolderOrWorkspaceAndResolve(
     TSessionData * Data, const UnicodeString & Name);
   void __fastcall ImportLevelFromFilezilla(_di_IXMLNode Node, const UnicodeString & Path, _di_IXMLNode SettingsNode);
+  void __fastcall DoGetFolderOrWorkspace(const UnicodeString & Name, TList * List, bool NoRecrypt);
   static THierarchicalStorage * __fastcall CreateHostKeysStorageForWritting();
 };
 //---------------------------------------------------------------------------