Selaa lähdekoodia

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

https://winscp.net/tracker/1799
(cherry picked from commit c43cde2bd9c6213872f220c955fc5f837357670f)

Source commit: 04da363894ea70eec23c947bf4a7c28317a1ca1b
Martin Prikryl 6 vuotta sitten
vanhempi
sitoutus
ac2057902d
2 muutettua tiedostoa jossa 15 lisäystä ja 2 poistoa
  1. 14 2
      source/core/SessionData.cpp
  2. 1 0
      source/core/SessionData.h

+ 14 - 2
source/core/SessionData.cpp

@@ -4803,6 +4803,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++)
   {
@@ -4813,7 +4818,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
@@ -4845,7 +4857,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

@@ -729,6 +729,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();
 };
 //---------------------------------------------------------------------------