1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-25 14:19:30 +03:00

196 Commits

Author SHA1 Message Date
Martin Prikryl
bd10c64863 Due to wrong compiler directive, old-style casts were omitted in e5efed89
Source commit: 9864e1dc6f39b5b029461f8850c068c6d3b1a487
2026-10-24 00:39:18 +02:00
Martin Prikryl
6f39a04987 Issue 2475 – Support client certificates with intermediate certificate
https://winscp.net/tracker/2475

Source commit: 7075ae74fd7e6cd92ed8d8e7422528dc56743158
2026-10-22 00:36:04 +02:00
Eduardo C.
a8fc40bd0e Portability: let core build with clang on Linux and Windows (#79)
* Cast between closure types with a functional cast, not reinterpret_cast

A Borland __closure is a built-in (code, data) pair, so reinterpret_cast
between two closure types is allowed. Under standard C++ a closure is a
class, and reinterpret_cast cannot convert one class object into another.
The functional cast is the old C-style cast this line had before
"Refactoring old-style casts" (e5efed895), so C++Builder compiles it as it
did then, and a compiler implementing closures as classes can give it the
same meaning.

* Read the knocked FTP port's IPv4 address as 32 bits

The address is read through an unsigned long pointer. That is 32 bits on
Windows (LLP64), so it reads exactly the four address bytes there; on LP64
targets unsigned long is 64 bits, and the read runs four bytes past the
address into whatever follows it in gethostbyname's buffer. The assignment
to the 32-bit s_addr then keeps the right bytes on little-endian machines,
which is why it goes unnoticed, but the over-read is undefined. ULONG is 32
bits on every Windows compiler, as Windows API layers for POSIX define it
too.

* Compile the synchronize checklist's Explorer file operation on Windows only

TSynchronizeChecklistFileOperation carries out a synchronization checklist
through Explorer's IFileOperation (a Shell COM object), so that local
deletions go to the recycle bin with Explorer's progress and undo. Only
WinSCP's Windows GUI uses it (CustomScpExplorer.cpp). Elsewhere neither the
object nor the interfaces exist, and declaring them only to compile would
pretend to a facility that is not there; a frontend on another platform
implements the operation its own way. The class and its implementation are
guarded with _WIN32, which C++Builder defines, so the Windows build is
unchanged.

* Declare the SIOCATMARK result as ULONG, the type p_ioctlsocket takes

network.c declares ioctlsocket as taking ULONG * (its DECL_WINDOWS_FUNCTION)
but passes a u_long. Both are 32 bits on Windows, so the two agree there. On
an LP64 platform u_long is 64 bits and ULONG 32, so the pointer types differ
and the callee would write half the variable. ULONG is what the declaration
says, and is the same type on Windows.

* Pick aes-ni.c's _mm_setr_epi8 for any GCC-compatible compiler

MM_SETR_EPI8 uses _mm_setr_epi8 only under _WIN64, falling back to a brace
initialiser that is correct for MSVC's __m128i (a byte union) but fills
clang's and GCC's (a two-lane vector) wrongly; the _WIN64 condition fixed
that for Win64 builds only. Any compiler defining __GNUC__ (clang does) now
takes the intrinsic.

* Compile WinSCP's Windows-only additions to neon on Windows only

WinSCP builds neon for Win32 alone, and three of its additions assume it:
ne_openssl.c includes <windows.h> (it uses nothing from it), timed_connect
switches the socket to non-blocking mode with Winsock's ioctlsocket instead
of upstream's fcntl, and ne_sock_sspi_init calls into SSPI unconditionally.
On POSIX neon uses BSD sockets directly, so the include is guarded with
_WIN32, the two ioctlsocket branches are taken only on _WIN32 (upstream's
fcntl code beside them is used otherwise), and ne_sock_sspi_init calls SSPI
under HAVE_SSPI, as ne_sock_init's own call does, reporting failure (-1)
without it -- which WebDAVFileSystem.cpp already handles as SSPI being
unavailable. C++Builder defines _WIN32 and neon's Win32 config.h defines
HAVE_SSPI, so the Windows build is unchanged.

* Use in_addr's s_addr in FileZilla's proxy layer

AsyncProxySocketLayer.cpp reaches the IPv4 address through Winsock's union,
sin_addr.S_un.S_addr. Winsock also defines s_addr as exactly that member
(#define s_addr S_un.S_addr), and s_addr is the name BSD sockets and POSIX
give the field; a POSIX in_addr has no S_un. Same field, so the Windows
build is unchanged.

* Pass FileZilla's two tool strings as UnicodeString, not std::wstring

CFileZillaTools::GetClientString and CustomReason return std::wstring; the
rest of the interface between core and FileZilla, and both sides' own code,
use UnicodeString or wchar_t pointers. Built with a 2-byte wchar_t on a
platform whose C++ library assumes 4 (clang's -fshort-wchar on Linux),
std::wstring is unusable: libstdc++ provides basic_string<wchar_t> as a
precompiled extern template for its own wchar_t, and char_traits<wchar_t>
calls the C library's 4-byte wcslen and wmemcpy: a Linux build of
FtpFileSystem.cpp imported wcslen through it. The values are only built from
UnicodeString, compared with empty() and read with c_str(), so UnicodeString
is a direct replacement (IsEmpty for empty). On Windows, where wchar_t is 2
bytes throughout, behaviour is unchanged.

* Build storage key paths with backslashes on every platform

THierarchicalStorage joins registry and INI key paths (Sessions\My site)
through its IncludeTrailingBackslash and ExcludeTrailingBackslash members,
which defer to the RTL functions of those names. The RTL's add and strip the
platform's path delimiter: a backslash on Windows, a slash on POSIX, where
these functions also build local file paths. Keys are not file paths: their
separator is a backslash everywhere, and the INI file's sections say so. The
members now add and strip a backslash themselves; on Windows that is what
the RTL did, so the behaviour there is unchanged. Without this, on POSIX the
current key became "Sessions/", matched no section, and no stored site
loaded.

* Hand neon a copy of the TLS-init closure, not its two pointers

SetNeonTlsInit stores the closure in the neon session by reinterpreting it
as a TMethod and saving its code and data pointers, and ne_init_ssl_session
rebuilds it with MakeMethod. That relies on a closure being exactly those
two pointers, which only Borland's __closure is; with any other closure type
the saved words are its internals, read from a by-value parameter that is
gone by the time neon calls back, and the rebuilt closure is garbage (a
clang build's first WebDAV-over-TLS connection crashed there). The session
now holds a heap copy of the closure, freed by neon's destroy-session hook
-- which also covers the sessions libs3 creates and destroys itself -- and
ne_init_ssl_session calls that copy. On C++Builder the behaviour is the
same, at the cost of one small allocation per session.

* Take CString's search results as const wchar_t *

CString::Find, ReverseFind and FindOneOf search the const string c_str()
returns and keep the result in a wchar_t *. ISO C++ declares wcschr,
wcsrchr, wcsstr and wcspbrk on a const string as returning const wchar_t *,
as MSVC's and newer mingw-w64 headers (llvm-mingw's) do, so the
initialisation does not compile there. The pointers are only compared and
subtracted: const is all they need.

* Index the string a string-list property returns, not the property

GetLocales takes a character of Exts->Strings[Index]. Under clang the
__declspec(property) standing for TStrings::Strings' __property reads a
second subscript as the property's own second index, so the expression is a
two-argument call to the getter and does not compile (parentheses do not
change that). Read into a UnicodeString first, the second subscript indexes
the string the property returns, as under C++Builder.

---------

Co-authored-by: Eduardo Correia <ecorreia@apliant.com.br>
2026-10-20 16:01:54 +02:00
Martin Prikryl
a6916d4101 Unused code obsoleted by 64050d10
Source commit: 92ea806f97f6683c5e5158c7236b49ce04aa620c
2026-10-03 08:42:27 +02:00
Martin Prikryl
a2119a7eac Types and casts safe in respect to pointer size for forward 64-bit compatibility
Also GetWindowLongPtr and GWLP_USERDATA

https://winscp.net/tracker/618

Source commit: c85fdf15e50ce8a6f35b1c4d2a0125a0b9c4f1f0
2026-01-22 14:51:13 +01:00
Martin Prikryl
e5efed8955 Refactoring old-style casts
Source commit: 3c37b3a958525c595ad44b081b2e0f3b288b8eb0
2025-12-18 01:20:33 +01:00
Martin Prikryl
a5dcb5f03c Using std::size instead of custom macro
Source commit: 1a89c80dd42426351f261526b617534bab664208
2025-12-07 01:17:54 +01:00
Martin Prikryl
5c6ca0c8be Typo in logging
Source commit: 56263391a0b8b89922ebb688e5a38adb30724bb9
2025-10-07 15:35:34 +02:00
Martin Prikryl
a01665f294 Factoring out universal path utility functions that will also be used Issue 2020
Source commit: ecc9f746b50cf7f0203dcb08b1db627375cf5295
2025-10-01 01:19:58 +02:00
Martin Prikryl
e2c5a499fa Bug fix: TDateTime/float equality comparison is not reliable (particularly with Clang)
Not sure if the problem can actually occur with classic compiler, so not logging this publicly

Source commit: b67371b1deed393e1abf636504ae26bb786314f3
2025-09-04 13:24:15 +02:00
Martin Prikryl
b13e2e7c2b #pragma package(smart_init) is not useful out of packages
Source commit: 7635ac3b532214f27ea2b6fe6aa80398c857cfcd
2025-08-23 01:06:48 +02:00
Martin Prikryl
3817bbd736 Preparing for separate pre-compiled header file required by Clang
- Once doing that, including more headers to PCH, not just vcl.h
- Clang won't need explicit include, but we will probably keep it anyway.
- #pragma hdrstop has no effect in Clang

Source commit: adc8a268b6907c5337ccaa430cca7526793a3019
2025-08-22 15:43:55 +02:00
Martin Prikryl
8a6d3c374a Assertions and used variables corrections identified or imposed by Clang
Source commit: 7867f23a32b6fc0056ca5d37e3868daa67e05ca4
2025-08-01 09:32:00 +02:00
Martin Prikryl
8073dbef30 Clang incorrectly warns about some variables being unintialized, while the classic compiler warns that the value is never used
Source commit: 85cc13e319936e7644a5adde71d09623113e9176
2025-03-14 09:32:53 +01:00
Martin Prikryl
f7f00c631e Clang imposed changes that should be noop and have no effect on classic compiler
Mostly:
– incorrectly identified uninitialized variables
– explicit static global variables
– const, sign and down casts and safety
– typename use
– semicolon after function implementation
– unused variables, fields, arguments and macros
– field initialization order
– exact include filename case
– redundant in code macros already defined at project level

Source commit: 5c1338d95bd275082288dd1e773a033df6e379cd
2025-03-13 16:39:24 +01:00
Martin Prikryl
4019b56ffb Code errors identified by Clang
Notably:
Bug fix: Monospace font is not remembered if SSH banners are administratively forced
Change: Bug fix: In XML log, filename tag was included in stat tag, although explicitly documented not to

Source commit: 693ecd9b083f1460dc4d1ae1ff49e625989f8a50
2025-03-13 06:36:08 +01:00
Martin Prikryl
e202af0bdc Issue 2353 – Display and modify S3 file/object tags
https://winscp.net/tracker/2353

Source commit: 2193f9e58d66031ce58013da6a509090582addbe
2025-03-04 15:13:03 +01:00
Martin Prikryl
ef4e1e87ab Unused parameter
(it seems that it was never used)

Source commit: 7a61240971f9606d2156e588352db3f63d531e7f
2025-01-24 01:14:40 +01:00
Michael Lukashov
400bee57cf minor: Fix typos (#59)
Fix various minor typos
2024-12-25 11:25:35 +01:00
Martin Prikryl
ae9b173170 Issue 2327 – Failure when opening TLS connection with invalid OpenSSL configuration file
https://winscp.net/tracker/2327

Source commit: ee33d2badfff95c721fe412c86e7b305674e6703
2024-11-20 01:09:37 +01:00
Martin Prikryl
3086bbd89f Issue 2302 – Incorrect "Credentials were not specified" error when authentication fails due to incorrect password with FTP protocol
https://winscp.net/tracker/2302

Source commit: 480d0c63ad07cffc824177e867fc0cff57fddadd
2024-07-12 16:26:45 +02:00
Martin Prikryl
16e9c0ccec Issue 2300 – Compatibility with FTP servers that return an empty path in root
https://winscp.net/tracker/2300

Source commit: 653c803d0d0d2210133463b7c67432c34155b5e3
2024-07-09 18:19:49 +02:00
Martin Prikryl
15112f5277 Issue 2299 – Better error message when server is using incompatible TLS protocol version
https://winscp.net/tracker/2299

Source commit: 03997d32ab26920b5c4c3fb934e1595db6fe8d38
2024-07-08 01:19:53 +02:00
smoking_ace
0d5e233ee0 Typo Fixes in the comments (#54)
* ThemePageControl.cpp : Typo Fix

* UnixDriveView.cpp : Typo fixes

* FtpFileSystem.cpp: Typo Fix

* ThemePageControl.cpp: Incorporting the comments

* Update ThemePageControl.cpp

* Update UnixDriveView.cpp
2024-05-29 09:04:15 +02:00
Martin Prikryl
1e598b64c3 Issue 2267 – Failure when canceling FTP connection while reading remote directory
https://winscp.net/tracker/2267
(cherry picked from commit c2b06d67df)

Source commit: 6a330e45dffac5acceccaeadc836617c040b12c7
2024-02-28 13:17:18 +01:00
Martin Prikryl
e9e8afdcf4 Issue 2253 – Do not fail connection when FTP server responds to CSID command with an error
https://winscp.net/tracker/2253

Source commit: 32b2d4467a6d2b08922faf340282ec194d4dad65
2024-01-19 00:59:58 +01:00
Martin Prikryl
17aab2d53e Issue 2252 – FTP CSID command does not end with semicolon
https://winscp.net/tracker/2252

Source commit: 46e2472f7b85bd4e9b1e952ad276728a84d51535
2024-01-19 00:58:00 +01:00
Martin Prikryl
c97a8ab847 Issue 2250 – Configurable FTP TLS shutdown procedure
https://winscp.net/tracker/2250

Source commit: 509a6c3b0efed21c398810e7ead00bd9235ee35d
2024-01-15 15:33:10 +01:00
Mikhail Lukashov
a8e6220b88 fix typos 2024-01-05 10:37:32 +01:00
Martin Prikryl
03520d3092 Debug logging for rare FTP ASCII transfer size discrepancy
Source commit: 649e8429fe8d0699e0bb6ab9c74f0d760d79ce1d
2023-12-27 18:53:16 +01:00
Martin Prikryl
0e0c2f2006 Issue 2244 – Do not use directory listing to keep FTP session alive by default
https://winscp.net/tracker/2244

Source commit: 61d8886b91c8375f597a8b8b9b0975e40b9003a6
2023-12-15 15:48:50 +01:00
Martin Prikryl
9a06496936 Bug fix: When S3 or WebDAV server did not provide file timestamp, downloaded file was set to oldest possible timestamp
Source commit: cfb2d3d552d1c7d4192a6d152a9c4fd105f22484
2023-11-24 01:19:20 +01:00
Martin Prikryl
700baf45ee Restoring consistent behavior of failing, between duplicating and moving/renaming files over existing file with WebDAV protocol in scripting and .NET assembly
The discrepancy was introduced by Bug 2120 cb021fe3.
This restores the mv/MoveFile behavior to fail, if the target file exists with WebDAV protocol (but still allows overwrite in the GUI).
The cp/DuplicateFile behavior is unchanged, but the internal API was modified to match that of mv/MoveFile, in anticipation of aligning move/duplicate command behavior in GUI and need to keep current scripting/.NET behavior.

Source commit: 4661a3ea7ec8123231e376aae9913ce8457750dd
2023-10-25 01:43:14 +02:00
Martin Prikryl
c034f6c808 Bug 2222: Allow disabling SFTP extension use
https://winscp.net/tracker/2222

Source commit: 46cf6d64305cfb253f6b4c099633eec468c13c7b
2023-09-16 01:11:05 +02:00
Martin Prikryl
acd12ea3d7 More meaningful error message when credentials are missing in scripting and .NET assembly
Source commit: a374ebe71eea553a366120f46b8d3169ad735a7a
2023-08-25 01:10:22 +02:00
Martin Prikryl
1aee6f1464 Bug 513: Download single large file using multiple SFTP connections
https://winscp.net/tracker/513

Source commit: d57dcad76dfe8b333dfedd8419bce984a181280c
2023-07-27 01:02:51 +02:00
Martin Prikryl
1577b39b76 Bug 2194: Support for ProFTPD command OPTS REST STOR to query if upload restart is possible
https://winscp.net/tracker/2194

Source commit: 6b8e7e9e8d046a5a45f6ae586cb8ad9d5b61f09a
2023-06-08 01:04:28 +02:00
Martin Prikryl
8daf97a9cd Support for FTP CSID command
Source commit: cc520d28465829220862788c3e06a7f6d29f1b8e
2023-02-06 15:37:06 +01:00
Martin Prikryl
31740ae6b2 Bug fix: Failure when parsing FTP checksum response misses the actual response
Not really tests, but seem like an obvious mistake from Bug 2023 (37c0decb)

Source commit: f763ad23e896b619ddb910311cbbdb9d40a1b285
2023-02-06 15:34:53 +01:00
Martin Prikryl
e5628b72f3 Bug 2019: Error when uploading file sized just below 32 kB boundary to FTP server over TLS 1.3
https://winscp.net/tracker/2019

Source commit: 20c418a5e796357ab6e842d95bf3614a21f1e4fc
2023-01-18 01:01:37 +01:00
Martin Prikryl
50ef941c92 Comment that TLS shutdown hack for FileZilla Server does not seem to be needed since 1.6.0
Source commit: e9f6f913004785ca6edbcacd9177e4c434fae735
2023-01-18 00:59:06 +01:00
Martin Prikryl
cb021fe3e3 Bug 2120: Consistent behavior across protocols when renaming/moving remote files
https://winscp.net/tracker/2120

Source commit: 0f11f96996352d8354d27e06d699e2c3baa4653f
2022-10-01 01:03:37 +02:00
Martin Prikryl
2093433737 Bug 2110: Automatically reconnect when FTP server fails to open data connection with 426 code, if it previously worked
https://winscp.net/tracker/2110

Source commit: 3d005504b54d9b6f9dfa9799978827d7052029f6
2022-09-08 00:50:08 +02:00
Martin Prikryl
e69b2bc2a6 Redundant check
(copy pasted from the SFTP implementation, where it is needed)

Source commit: c0ac647a5f982ef55125d8d2fbca7bc9d8e20e5c
2022-07-15 00:56:11 +02:00
Martin Prikryl
8994d1f98e Simplifying CalculateFilesChecksum API
There's a small side-effect: The scripting "checksum" command now prints file name only while before it printed the path as it was original specified in the command.

Source commit: 7594ed8befc67e4da3153cc8b1b711ab104db867
2022-07-14 00:57:43 +02:00
Martin Prikryl
1f30e227e9 Redundant calls to AbsolutePath
Source commit: b59a83297872509aa55685521ec2a8197e85ae88
2022-07-14 00:55:38 +02:00
Martin Prikryl
03e38c75ae Refactoring checksum calculation to share more code between FTP and SFTP in anticipation of reusing it for SCP/Shell
Source commit: 9a5138737031573ad64085fa64ef8fdd7fca8f77
2022-07-02 01:05:31 +02:00
Martin Prikryl
ee08afa721 Bug 2087: Hang when entering small directories with FTP protocol
https://winscp.net/tracker/2087

Source commit: 263b35c88eab44b87f4dc6aebe01eb8db264e9e3
2022-06-15 01:06:32 +02:00
Martin Prikryl
7996f5831a Bug 2086: Restore previous behaviour with MVS systems
https://winscp.net/tracker/2086

Source commit: 12cb13147524df8aeb44ecb58c17d91ca5f42864
2022-06-08 01:06:50 +02:00
Martin Prikryl
5f3d00d2c9 Incorrect comment (from 9370bfd1)
Source commit: 5870f8a8b23ecb6122475fd0d4b65c94e1f73293
2022-06-08 01:01:18 +02:00