浏览代码

Bug 2109: Restoring support for legacy version of the Digest algorithm specified in RFC 2069

https://winscp.net/tracker/2109

Source commit: 78e64e5b3878203717efc91a9ad491f63849f4e2
Martin Prikryl 2 年之前
父节点
当前提交
8a69c52dbe
共有 3 个文件被更改,包括 16 次插入0 次删除
  1. 9 0
      source/core/SessionData.cpp
  2. 3 0
      source/core/SessionData.h
  3. 4 0
      source/core/WebDAVFileSystem.cpp

+ 9 - 0
source/core/SessionData.cpp

@@ -229,6 +229,7 @@ void __fastcall TSessionData::DefaultSettings()
   EncryptKey = UnicodeString();
 
   WebDavLiberalEscaping = false;
+  WebDavAuthLegacy = false;
 
   ProxyMethod = ::pmNone;
   ProxyHost = L"proxy";
@@ -525,6 +526,7 @@ void __fastcall TSessionData::NonPersistant()
   PROPERTY_HANDLER(EncryptKey, F); \
   \
   PROPERTY(WebDavLiberalEscaping); \
+  PROPERTY(WebDavAuthLegacy); \
   \
   PROPERTY(PuttySettings); \
   \
@@ -924,6 +926,7 @@ void __fastcall TSessionData::DoLoad(THierarchicalStorage * Storage, bool PuttyI
   LOAD_PASSWORD(EncryptKey, L"EncryptKeyPlain");
 
   WebDavLiberalEscaping = Storage->ReadBool(L"WebDavLiberalEscaping", WebDavLiberalEscaping);
+  WebDavAuthLegacy = Storage->ReadBool(L"WebDavAuthLegacy", WebDavAuthLegacy);
 
   IsWorkspace = Storage->ReadBool(L"IsWorkspace", IsWorkspace);
   Link = Storage->ReadString(L"Link", Link);
@@ -1227,6 +1230,7 @@ void __fastcall TSessionData::DoSave(THierarchicalStorage * Storage,
     WRITE_DATA(Integer, MaxTlsVersion);
 
     WRITE_DATA(Bool, WebDavLiberalEscaping);
+    WRITE_DATA(Bool, WebDavAuthLegacy);
 
     WRITE_DATA(Bool, IsWorkspace);
     WRITE_DATA(String, Link);
@@ -4610,6 +4614,11 @@ void __fastcall TSessionData::SetWebDavLiberalEscaping(bool value)
   SET_SESSION_PROPERTY(WebDavLiberalEscaping);
 }
 //---------------------------------------------------------------------
+void __fastcall TSessionData::SetWebDavAuthLegacy(bool value)
+{
+  SET_SESSION_PROPERTY(WebDavAuthLegacy);
+}
+//---------------------------------------------------------------------
 UnicodeString __fastcall TSessionData::GetInfoTip()
 {
   if (UsesSsh)

+ 3 - 0
source/core/SessionData.h

@@ -243,6 +243,7 @@ private:
   UnicodeString FWinTitle;
   RawByteString FEncryptKey;
   bool FWebDavLiberalEscaping;
+  bool FWebDavAuthLegacy;
 
   UnicodeString FOrigHostName;
   int FOrigPortNumber;
@@ -434,6 +435,7 @@ private:
   UnicodeString __fastcall GetEncryptKey() const;
   void __fastcall SetEncryptKey(UnicodeString value);
   void __fastcall SetWebDavLiberalEscaping(bool value);
+  void __fastcall SetWebDavAuthLegacy(bool value);
 
   TDateTime __fastcall GetTimeoutDT();
   void __fastcall SavePasswords(THierarchicalStorage * Storage, bool PuttyExport, bool DoNotEncryptPasswords, bool SaveAll);
@@ -717,6 +719,7 @@ public:
   __property UnicodeString WinTitle = { read = FWinTitle, write = SetWinTitle };
   __property UnicodeString EncryptKey = { read = GetEncryptKey, write = SetEncryptKey };
   __property bool WebDavLiberalEscaping = { read = FWebDavLiberalEscaping, write = SetWebDavLiberalEscaping };
+  __property bool WebDavAuthLegacy = { read = FWebDavAuthLegacy, write = SetWebDavAuthLegacy };
 
   __property UnicodeString StorageKey = { read = GetStorageKey };
   __property UnicodeString SiteKey = { read = GetSiteKey };

+ 4 - 0
source/core/WebDAVFileSystem.cpp

@@ -396,6 +396,10 @@ void __fastcall TWebDAVFileSystem::NeonAddAuthentiation(TSessionContext * Sessio
   {
     NeonAuthTypes |= NE_AUTH_NEGOTIATE;
   }
+  if (FTerminal->SessionData->WebDavAuthLegacy)
+  {
+    NeonAuthTypes |= NE_AUTH_LEGACY_DIGEST;
+  }
   ne_add_server_auth(SessionContext->NeonSession, NeonAuthTypes, NeonRequestAuth, SessionContext);
 }
 //---------------------------------------------------------------------------