Browse Source

Identifying as WinSCP (including version) in FTP CLNT command + Sending CLNT command even to FileZilla FTP server.

Source commit: ea33c352329f16bec43d0a1fc157310d88681584
Martin Prikryl 10 years ago
parent
commit
ae81567cb5

+ 6 - 0
source/core/FtpFileSystem.cpp

@@ -61,6 +61,7 @@ protected:
   virtual void PreserveDownloadFileTime(HANDLE Handle, void * UserData);
   virtual bool GetFileModificationTimeInUtc(const wchar_t * FileName, struct tm & Time);
   virtual wchar_t * LastSysErrorMessage();
+  virtual std::wstring GetClientString();
 
 private:
   TFTPFileSystem * FFileSystem;
@@ -157,6 +158,11 @@ wchar_t * TFileZillaImpl::LastSysErrorMessage()
   return _wcsdup(::LastSysErrorMessage().c_str());
 }
 //---------------------------------------------------------------------------
+std::wstring TFileZillaImpl::GetClientString()
+{
+  return std::wstring(SshVersionString().c_str());
+}
+//---------------------------------------------------------------------------
 //---------------------------------------------------------------------------
 class TMessageQueue : public std::list<std::pair<WPARAM, LPARAM> >
 {

+ 1 - 0
source/filezilla/FilezillaTools.h

@@ -10,6 +10,7 @@ public:
   virtual void PreserveDownloadFileTime(HANDLE Handle, void * UserData) = 0;
   virtual bool GetFileModificationTimeInUtc(const wchar_t * FileName, struct tm & Time) = 0;
   virtual wchar_t * LastSysErrorMessage() = 0;
+  virtual std::wstring GetClientString() = 0;
 };
 //---------------------------------------------------------------------------
 #endif // FileZillaToolsH

+ 2 - 2
source/filezilla/FtpControlSocket.cpp

@@ -774,14 +774,14 @@ void CFtpControlSocket::LogOnToServer(BOOL bSkipReply /*=FALSE*/)
     GetIntern()->PostMessage(FZ_MSG_MAKEMSG(FZ_MSG_CAPABILITIES, 0), (LPARAM)&m_serverCapabilities);
     if (!m_bAnnouncesUTF8 && !m_CurrentServer.nUTF8)
       m_bUTF8 = false;
-    if (m_bUTF8 && m_hasClntCmd && !m_isFileZilla)
+    if (m_hasClntCmd)
     {
       // Some servers refuse to enable UTF8 if client does not send CLNT command
       // to fix compatibility with Internet Explorer, but in the process breaking
       // compatibility with other clients.
       // Rather than forcing MS to fix Internet Explorer, letting other clients
       // suffer is a questionable decision in my opinion.
-      if (Send(L"CLNT FileZilla"))
+      if (Send(CString(L"CLNT ") + m_pTools->GetClientString().c_str()))
         m_Operation.nOpState = CONNECT_CLNT;
       return;
     }