Skip to content

Commit

Permalink
WinSCP 5.7.6
Browse files Browse the repository at this point in the history
  • Loading branch information
martinprikryl committed Nov 4, 2015
1 parent 58eedd2 commit 6c7f647
Show file tree
Hide file tree
Showing 26 changed files with 243 additions and 131 deletions.
4 changes: 4 additions & 0 deletions dotnet/Session.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,10 @@ private void ProcessOutputDataReceived(object sender, OutputDataReceivedEventArg
{
Logger.WriteLine("Scheduling output: [{0}]", e.Data);
Output.InternalAdd(e.Data);
if (Output.Count > 1000)
{
Output.InternalRemoveFirst();
}
GotOutput();
ScheduleEvent(() => RaiseOutputDataReceived(e.Data));
}
Expand Down
5 changes: 5 additions & 0 deletions dotnet/internal/ReadOnlyInteropCollectionHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ public void InternalAdd(T item)
_list.Add(item);
}

public void InternalRemoveFirst()
{
_list.RemoveAt(0);
}

public T this[int index]
{
get
Expand Down
5 changes: 5 additions & 0 deletions dotnet/interopcollections/StringCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ internal void InternalAdd(string item)
_helper.InternalAdd(item);
}

internal void InternalRemoveFirst()
{
_helper.InternalRemoveFirst();
}

private readonly ReadOnlyInteropCollectionHelper<string> _helper = new ReadOnlyInteropCollectionHelper<string>();
}
}
6 changes: 3 additions & 3 deletions dotnet/properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a0b93468-d98a-4845-a234-8076229ad93f")]

[assembly: AssemblyVersion("1.2.9.0")]
[assembly: AssemblyFileVersion("1.2.9.0")]
[assembly: AssemblyInformationalVersionAttribute("5.7.5.0")]
[assembly: AssemblyVersion("1.2.10.0")]
[assembly: AssemblyFileVersion("1.2.10.0")]
[assembly: AssemblyInformationalVersionAttribute("5.7.6.0")]

[assembly: CLSCompliant(true)]

2 changes: 1 addition & 1 deletion source/Console.cbproj
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
<ProjectType>CppConsoleApplication</ProjectType>
<SanitizedProjectName>Console</SanitizedProjectName>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Console interface for WinSCP;FileVersion=4.1.0.0;InternalName=console;LegalCopyright=(c) 2000-2015 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.com;ProductName=WinSCP;ProductVersion=5.7.5.0;ReleaseType=stable;WWW=http://winscp.net/</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Console interface for WinSCP;FileVersion=4.1.0.0;InternalName=console;LegalCopyright=(c) 2000-2015 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.com;ProductName=WinSCP;ProductVersion=5.7.6.0;ReleaseType=stable;WWW=http://winscp.net/</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_MajorVer>4</VerInfo_MajorVer>
<VerInfo_MinorVer>1</VerInfo_MinorVer>
Expand Down
2 changes: 1 addition & 1 deletion source/DragExt.cbproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<SanitizedProjectName>DragExt</SanitizedProjectName>
<VerInfo_DLL>true</VerInfo_DLL>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Drag&amp;Drop shell extension for WinSCP (32-bit);FileVersion=1.2.1.0;InternalName=dragext32;LegalCopyright=(c) 2000-2015 Martin Prikryl;LegalTrademarks=;OriginalFilename=dragext.dll;ProductName=WinSCP;ProductVersion=5.7.5.0;ReleaseType=stable;WWW=http://winscp.net/</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=Drag&amp;Drop shell extension for WinSCP (32-bit);FileVersion=1.2.1.0;InternalName=dragext32;LegalCopyright=(c) 2000-2015 Martin Prikryl;LegalTrademarks=;OriginalFilename=dragext.dll;ProductName=WinSCP;ProductVersion=5.7.6.0;ReleaseType=stable;WWW=http://winscp.net/</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_MinorVer>2</VerInfo_MinorVer>
<VerInfo_Release>1</VerInfo_Release>
Expand Down
4 changes: 2 additions & 2 deletions source/DragExt64.rc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1 VERSIONINFO
FILEVERSION 1,2,1,0
PRODUCTVERSION 5,7,5,0
PRODUCTVERSION 5,7,6,0
FILEOS 0x4
FILETYPE 0x2
{
Expand All @@ -16,7 +16,7 @@ FILETYPE 0x2
VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "dragext64.dll\0"
VALUE "ProductName", "WinSCP\0"
VALUE "ProductVersion", "5.7.5.0\0"
VALUE "ProductVersion", "5.7.6.0\0"
VALUE "ReleaseType", "stable\0"
VALUE "WWW", "http://winscp.net/\0"
}
Expand Down
4 changes: 2 additions & 2 deletions source/WinSCP.cbproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@
<SanitizedProjectName>WinSCP</SanitizedProjectName>
<UsingDelphiRTL>true</UsingDelphiRTL>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=WinSCP: SFTP, FTP and SCP client;FileVersion=5.7.5.0;InternalName=winscp;LegalCopyright=(c) 2000-2015 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.exe;ProductName=WinSCP;ProductVersion=5.7.5.0;ReleaseType=stable;WWW=http://winscp.net/</VerInfo_Keys>
<VerInfo_Keys>CompanyName=Martin Prikryl;FileDescription=WinSCP: SFTP, FTP and SCP client;FileVersion=5.7.6.0;InternalName=winscp;LegalCopyright=(c) 2000-2015 Martin Prikryl;LegalTrademarks=;OriginalFilename=winscp.exe;ProductName=WinSCP;ProductVersion=5.7.6.0;ReleaseType=stable;WWW=http://winscp.net/</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<VerInfo_MajorVer>5</VerInfo_MajorVer>
<VerInfo_MinorVer>7</VerInfo_MinorVer>
<VerInfo_Release>5</VerInfo_Release>
<VerInfo_Release>6</VerInfo_Release>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<Defines>IDE;STRICT;$(Defines)</Defines>
Expand Down
36 changes: 20 additions & 16 deletions source/components/UnixDirView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,25 +429,29 @@ void __fastcall TUnixDirView::PerformItemDragDropOperation(TListItem * Item,
#ifndef DESIGN_ONLY
if (OnDDFileOperation)
{
assert(DragDropFilesEx->FileList->Count > 0);
// Could be empty if the source application does not provide any files;
// or if the IDataObject fails GetData, like Visual Studio Code 0.8.0:
// https://code.visualstudio.com/issues/detail/19410
if (DragDropFilesEx->FileList->Count > 0)
{
UnicodeString SourceDirectory;
UnicodeString TargetDirectory;

UnicodeString SourceDirectory;
UnicodeString TargetDirectory;
SourceDirectory = ExtractFilePath(DragDropFilesEx->FileList->Items[0]->Name);
if (Item)
{
assert(ITEMFILE->IsDirectory && (Terminal->Files->IndexOf(ITEMFILE) >= 0));
TargetDirectory = ITEMFILE->FullFileName;
}
else
{
TargetDirectory = Path;
}

SourceDirectory = ExtractFilePath(DragDropFilesEx->FileList->Items[0]->Name);
if (Item)
{
assert(ITEMFILE->IsDirectory && (Terminal->Files->IndexOf(ITEMFILE) >= 0));
TargetDirectory = ITEMFILE->FullFileName;
bool DoFileOperation = true;
OnDDFileOperation(this, Effect, SourceDirectory, TargetDirectory,
DoFileOperation);
}
else
{
TargetDirectory = Path;
}

bool DoFileOperation = true;
OnDDFileOperation(this, Effect, SourceDirectory, TargetDirectory,
DoFileOperation);
}
#else
USEDPARAM(Item);
Expand Down
21 changes: 12 additions & 9 deletions source/components/UnixDriveView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,18 +528,21 @@ void __fastcall TCustomUnixDriveView::PerformDragDropFileOperation(
{
if (OnDDFileOperation)
{
assert(DragDropFilesEx->FileList->Count > 0);
assert(Node != NULL);
// see a comment in TUnixDirView::PerformItemDragDropOperation
if (DragDropFilesEx->FileList->Count > 0)
{
assert(Node != NULL);

UnicodeString SourceDirectory;
UnicodeString TargetDirectory;
UnicodeString SourceDirectory;
UnicodeString TargetDirectory;

SourceDirectory = ExtractFilePath(DragDropFilesEx->FileList->Items[0]->Name);
TargetDirectory = NodeData(Node)->Directory;
SourceDirectory = ExtractFilePath(DragDropFilesEx->FileList->Items[0]->Name);
TargetDirectory = NodeData(Node)->Directory;

bool DoFileOperation = true;
OnDDFileOperation(this, Effect, SourceDirectory, TargetDirectory,
DoFileOperation);
bool DoFileOperation = true;
OnDDFileOperation(this, Effect, SourceDirectory, TargetDirectory,
DoFileOperation);
}
}
}
//---------------------------------------------------------------------------
Expand Down
92 changes: 62 additions & 30 deletions source/core/FtpFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,8 @@ void __fastcall TFTPFileSystem::Open()
}
}

FTransferActiveImmediately = (Data->FtpTransferActiveImmediately == asOn);

UnicodeString HostName = Data->HostNameExpanded;
UnicodeString UserName = Data->UserNameExpanded;
UnicodeString Password = Data->Password;
Expand Down Expand Up @@ -743,6 +745,15 @@ void __fastcall TFTPFileSystem::CollectUsage()
{
FTerminal->Configuration->Usage->Inc(L"OpenedSessionsFTPSyncplify");
}
// 220-Idea FTP Server v0.80 (xxx.home.pl) [xxx.xxx.xxx.xxx]
// 220 Ready
// ...
// SYST
// UNIX Type: L8
else if (ContainsText(FWelcomeMessage, L"Idea FTP Server"))
{
FTerminal->Configuration->Usage->Inc(L"OpenedSessionsFTPIdea");
}
else
{
FTerminal->Configuration->Usage->Inc(L"OpenedSessionsFTPOther");
Expand Down Expand Up @@ -2431,7 +2442,7 @@ void __fastcall TFTPFileSystem::AutoDetectTimeDifference(TRemoteFileList * FileL
TDateTime UtcModification = UtcFile->Modification;
delete UtcFile;

FTimeDifference = SecondsBetween(UtcModification, File->Modification);
FTimeDifference = static_cast<__int64>(SecsPerDay * (UtcModification - File->Modification));

UnicodeString LogMessage;
if (FTimeDifference == 0)
Expand Down Expand Up @@ -2563,10 +2574,9 @@ void __fastcall TFTPFileSystem::DoReadFile(const UnicodeString & AFileName,
if (File != NULL)
{
AFile = File->Duplicate();
ApplyTimeDifference(AFile);
}

ApplyTimeDifference(AFile);

FLastDataSent = Now();
}
__finally
Expand Down Expand Up @@ -2597,41 +2607,50 @@ void __fastcall TFTPFileSystem::ReadFile(const UnicodeString FileName,
}
else
{
// FZAPI does not have efficient way to read properties of one file.
// In case we need properties of set of files from the same directory,
// cache the file list for future
if ((FFileListCache != NULL) &&
UnixSamePath(Path, FFileListCache->Directory) &&
(UnixIsAbsolutePath(FFileListCache->Directory) ||
(FFileListCachePath == CurrentDirectory)))
if (IsUnixRootPath(FileName))
{
AFile = FFileListCache->FindFile(NameOnly);
AFile = new TRemoteDirectoryFile();
AFile->FullFileName = FileName;
AFile->FileName = L"";
}
// if cache is invalid or file is not in cache, (re)read the directory
if (AFile == NULL)
else
{
TRemoteFileList * FileListCache = new TRemoteFileList();
FileListCache->Directory = Path;
try
// FZAPI does not have efficient way to read properties of one file.
// In case we need properties of set of files from the same directory,
// cache the file list for future
if ((FFileListCache != NULL) &&
UnixSamePath(Path, FFileListCache->Directory) &&
(UnixIsAbsolutePath(FFileListCache->Directory) ||
(FFileListCachePath == CurrentDirectory)))
{
ReadDirectory(FileListCache);
AFile = FFileListCache->FindFile(NameOnly);
}
catch(...)
// if cache is invalid or file is not in cache, (re)read the directory
if (AFile == NULL)
{
delete FileListCache;
throw;
TRemoteFileList * FileListCache = new TRemoteFileList();
FileListCache->Directory = Path;
try
{
ReadDirectory(FileListCache);
}
catch(...)
{
delete FileListCache;
throw;
}
// set only after we successfully read the directory,
// otherwise, when we reconnect from ReadDirectory,
// the FFileListCache is reset from ResetCache.
delete FFileListCache;
FFileListCache = FileListCache;
FFileListCachePath = GetCurrentDirectory();

AFile = FFileListCache->FindFile(NameOnly);
}
// set only after we successfully read the directory,
// otherwise, when we reconnect from ReadDirectory,
// the FFileListCache is reset from ResetCache.
delete FFileListCache;
FFileListCache = FileListCache;
FFileListCachePath = GetCurrentDirectory();

AFile = FFileListCache->FindFile(NameOnly);
Own = false;
}

Own = false;
}

if (AFile == NULL)
Expand Down Expand Up @@ -2982,7 +3001,7 @@ int __fastcall TFTPFileSystem::GetOptionVal(int OptionID) const
break;

case OPTION_MPEXT_TRANSFER_ACTIVE_IMMEDIATELY:
Result = Data->FtpTransferActiveImmediately;
Result = FTransferActiveImmediately;
break;

case OPTION_MPEXT_REMOVE_BOM:
Expand Down Expand Up @@ -3455,6 +3474,10 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
// SIZE
// 211 End

// This format is according to RFC 2228.
// Is used by ProFTPD when MultilineRFC2228 is enabled
// http://www.proftpd.org/docs/directives/linked/config_ref_MultilineRFC2228.html

// 211-Features:
// 211-MDTM
// 211-REST STREAM
Expand All @@ -3471,6 +3494,8 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
// MDTM
// 211 END

// Partially duplicated in CFtpControlSocket::OnReceive

bool HasCodePrefix =
(Response.Length() >= 3) &&
TryStrToInt(Response.SubString(1, 3), Code) &&
Expand Down Expand Up @@ -3531,6 +3556,13 @@ void __fastcall TFTPFileSystem::HandleReplyStatus(UnicodeString Response)
{
FTerminal->DisplayBanner(FWelcomeMessage);
}
// Idea FTP Server v0.80
if ((FTerminal->SessionData->FtpTransferActiveImmediately == asAuto) &&
FWelcomeMessage.Pos(L"Idea FTP Server") > 0)
{
FTerminal->LogEvent(L"The server requires TLS/SSL handshake on transfer connection before responding 1yz to STOR/APPE");
FTransferActiveImmediately = true;
}
}
}
else if (FLastCommand == PASS)
Expand Down
1 change: 1 addition & 0 deletions source/core/FtpFileSystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ friend class TFileListHelper;
std::unique_ptr<TStrings> FHashAlgs;
bool FSupportsAnyChecksumFeature;
UnicodeString FLastCommandSent;
bool FTransferActiveImmediately;
mutable UnicodeString FOptionScratch;
};
//---------------------------------------------------------------------------
Expand Down
12 changes: 12 additions & 0 deletions source/core/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,12 @@ TStrings * __fastcall TScript::CreateFileList(TScriptProcParams * Parameters, in
for (int i = Start; i <= End; i++)
{
UnicodeString FileName = Parameters->Param[i];

if (SimpleUnixExcludeTrailingBackslash(FileName) != FileName)
{
PrintLine(LoadStr(SCRIPT_AMBIGUOUS_SLASH_IN_PATH));
}

if (FLAGSET(ListType, fltDirectories))
{
TRemoteFile * File = new TRemoteFile();
Expand Down Expand Up @@ -686,6 +692,12 @@ TStrings * __fastcall TScript::CreateLocalFileList(TScriptProcParams * Parameter
// (it actually won't make a difference functionally as we fall back to adding
// the path as is in "else" branch, but the comment "let it fail later" won't stand)
UnicodeString FileName = ExcludeTrailingBackslash(Parameters->Param[i]);

if (FileName != Parameters->Param[i])
{
PrintLine(LoadStr(SCRIPT_AMBIGUOUS_SLASH_IN_PATH));
}

if (FLAGSET(ListType, fltMask))
{
TSearchRecChecked SearchRec;
Expand Down
4 changes: 4 additions & 0 deletions source/core/SecureShell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2353,6 +2353,10 @@ void __fastcall TSecureShell::CollectUsage()
{
Configuration->Usage->Inc(L"OpenedSessionsSSHSyncplify");
}
else if (ContainsText(FSessionInfo.SshImplementation, L"zFTPServer"))
{
Configuration->Usage->Inc(L"OpenedSessionsSSHzFTP");
}
else
{
Configuration->Usage->Inc(L"OpenedSessionsSSHOther");
Expand Down
Loading

0 comments on commit 6c7f647

Please sign in to comment.