1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

300 Commits

Author SHA1 Message Date
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
Martin Prikryl
3a3c431786 Issue 2474 – Failure when SSH authentication banner is displayed while reconnecting a session
https://winscp.net/tracker/2474

Source commit: 15d2da2605dc40a7fd6601d32b1f6d6625c591b3
2026-10-20 16:14:05 +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
Eduardo Correia
63a6579fac Define TTerminal::LogEvent out of line, as the files calling it need
TTerminal::LogEvent is defined `inline` in Terminal.cpp, but the file
systems (FtpFileSystem.cpp and others) call it too. An inline function must
be defined in every translation unit that uses it; when it is not, the
program is ill-formed, and whether it links depends on the compiler keeping
an out-of-line copy. An optimizing clang build (-O2, -O3) inlines every call
within Terminal.cpp and emits none, so the other files' calls are undefined
at link time. Without `inline` the definition is the one every caller links
to; the calls within Terminal.cpp may still be inlined.
2026-10-16 13:45:16 +02:00
Martin Prikryl
a6916d4101 Unused code obsoleted by 64050d10
Source commit: 92ea806f97f6683c5e5158c7236b49ce04aa620c
2026-10-03 08:42:27 +02:00
Martin Prikryl
c03ad642b3 Issue 2427 – Prevent moving or copying a file or folder over ancestor folder with the same name
https://winscp.net/tracker/2427

Source commit: a65fa3e19024af7ee500f875a8ff4f3401c8052c
2026-03-10 01:11:25 +01: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
db7648e1b8 Issue 2404 – Do not redundantly verify WebDAV or S3 certificate in Windows Certificate store if it is already marked as trusted in session settings
https://winscp.net/tracker/2404

Source commit: 69f696bc9c5ca484e2c4e6b46428e6d8b90a876e
2025-10-16 14:32:18 +02:00
Martin Prikryl
3cd64f2a19 Issue 2020 – Synchronize two local directories
https://winscp.net/tracker/2020

Source commit: a0ab887a23e4362bb62824434893a97540b24e4a
2025-10-02 22:14:52 +02:00
Martin Prikryl
ecc09219da Consistent order
Source commit: 9cc30d3ce3c7e1472b1476c5edcbb5a353f4687e
2025-10-02 18:19:26 +02:00
Martin Prikryl
be4bdb61f4 Factoring out some functionality that can be adapted for local-local synchronization (Issue 2020)
Should be noop

Source commit: 61e723f9dc994acfaee0398acc77b9abe60111cb
2025-10-02 00:59:59 +02:00
Martin Prikryl
fa31217b53 Refactoring in anticipation of synchronization not always being local-remote (Issue 2020)
Source commit: 2d05944202efceaff012888c6b0de956314c91b6
2025-10-01 15:30:12 +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
086aec0991 No need to suspend operation, while logging an exception
In the past the predecessor of HandleException probably showed the error, but it did not already in 3.0

Source commit: 9ec53d6edfaef2acf288b0ebbf6f9eb90a242ba4
2025-09-16 11:27:59 +02:00
Martin Prikryl
1d9fe8c955 Changing compiler to Clang/bcc32c
- regarding the ILINK_LibraryPath for Cfg_1_Win32 (Debug):
Win32\Debug (not only Win32c\Debug) needs to be before Win32c\Release, as win32c does not include debug builds of Pascal code - so without that VCL debugging won't work
- IDE insist on adding CC_Suffix to all projects once switched to Clang, although it is only used in WinSCP.cbproj
- UNICODE define: Not needed for build (it's implicit), but CodeInsight does not know it it somehow

Source commit: da06d73eb86caff5ca9cac0185bed54da0da8f07
2025-09-04 07:53:01 +02:00
Martin Prikryl
ba680d6e2e Avoid redundantly capturing exception stack trace
Jcl captures exception stack trace on its own, so it's redundant to do it again. And mainly, capturing it the second time somehow does not work with Clang

Source commit: 92a3533d082138b3e5c3729ac35f5fbf0b09b57f
2025-09-03 12:19:54 +02:00
Martin Prikryl
34ec281e6d Invalid assertion
Caused by Issue 2370

Source commit: 5313aac260b424eeee78c98040085228416db030
2025-08-29 01:11:26 +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
4c615a1ff1 Clang imposed changes that should be noop and have no effect on classic compiler (mostly for release build) (4th after cea3db7f)
Source commit: 6071393e7ecab31c096ca36631fd59b29469c08c
2025-08-01 09:33:52 +02:00
Martin Prikryl
4a96d205d0 Workaround for Clang crash on multiple-inheritance
(Clang internal compiler error happens in release build only)

Source commit: dc0f9ba27579e218b78d015d90e09406cfeeb957
2025-08-01 09:29:57 +02:00
Martin Prikryl
2d1584ef93 Issue 2392 – Command md5sums is incorrectly used to calculate MD5 checksum instead of md5sum
https://winscp.net/tracker/2392

Source commit: 3bca0e6f6a40eb2951753643fc5a1e277e70fc61
2025-07-28 01:06:34 +02:00
Martin Prikryl
ba8994ca1f Issue 2379 – Failure when canceling reconnection on authentication banner, when the connection was already closed by the server
https://winscp.net/tracker/2379

Source commit: 6797a6eb7c41fff0ae0fe6b2ae8d7be0a1db52c6
2025-06-03 16:44:44 +02:00
Martin Prikryl
2817363be8 Typo in logging
Source commit: 370895085717826a2edcb446bb097badd49a4411
2025-04-29 00:58:36 +02:00
Martin Prikryl
f02b75470e Some (hopefully noop) refactoring to solve Clang internal compiler error when using new variable in __finally block + Some other small code changes imposed by Clang
(cherry picked from commit 92ba1e3f0e)

Source commit: 61a79bd46194d4318828269d21fe548f508dda03
2025-03-14 16:21:31 +01:00
Martin Prikryl
5dc46ec23f Clang identifies some functions as "noreturn" + one noexcept(false)
(cherry picked from commit 7b54dde3a6)

Source commit: e6fd24a871e574ed762797210a5ce126deeab1f3
2025-03-14 16:19:14 +01:00
Martin Prikryl
3f4e41fee0 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

(cherry picked from commit f7f00c631e)

Source commit: 90ad9390853aba308abe73cf02e0281238c53c87
2025-03-13 16:46:26 +01:00
Martin Prikryl
8cd48fd0e5 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

(cherry picked from commit 4019b56ffb)

Source commit: 8f8d10bc0c9f4ca626dceda1d3e9889dc22f4394
2025-03-13 06:42:18 +01:00
Martin Prikryl
0d64cc1278 Issue 2352 – Remember empty session password
https://winscp.net/tracker/2352

Source commit: 8deb7a84540894f0ce1a0b3c0ff08ebffdaa44df
2025-02-28 14:27:35 +01:00
Martin Prikryl
3dcb30ca22 Issue 2342 – Command-line interface for installing public key into server
https://winscp.net/tracker/2342

Source commit: 4dee00b059312367058fa5bcccac2cc187ad14a3
2025-01-25 01:04:17 +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
Martin Prikryl
ff0a744b58 Issue 2335 – Tunneled session password is not remembered
https://winscp.net/tracker/2335

Source commit: ce6d0598ef31e1871eaecd8d67c9b0f6a81b7d39
2025-01-03 16:49:05 +01:00
Michael Lukashov
400bee57cf minor: Fix typos (#59)
Fix various minor typos
2024-12-25 11:25:35 +01:00
Martin Prikryl
cbd7e799df Issue 2318 – Optionally push synchronization actions to queue
https://winscp.net/tracker/2318

Source commit: 8d79009ebeabde5ce762a82d61f36e18c1517d9b
2024-12-23 15:48:13 +01:00
Martin Prikryl
c3aadded64 Factoring out some commons synchronization checklist functions
Source commit: 476fef1cfeea061ec1d35cdb24b2528263eaf247
2024-12-14 01:15:01 +01:00
Martin Prikryl
fb3489c2ec Ongoing local delete operation can be moved to a background queue (only on a remote tab, as local tabs do not have a queue)
Primarily to allow Issue 2318

Source commit: 6145552c9ea62fcf0b13f5d414c9a0b38fbf2f41
2024-12-11 01:26:14 +01:00
Martin Prikryl
e613fa29fe Bug fix: When moving an ongoing delete operation to background queue, it might attempt to delete the current file again, failing the operation
Overall, the test for cancel is probably redundant for all scenarios. But to limit impact, I'm keeping it for most scenarios, except for the delete.

Source commit: c24c339bd5c5621a74c356b8189487e35dc2ab41
2024-12-11 01:21:14 +01:00
Martin Prikryl
1162407e42 Commit 19ae9e1d broke cache invalidation of uploaded subdirectories
Source commit: 49697ac3b4216b850de8d58e589a27b3950bffe0
2024-10-31 00:57:45 +01:00
Martin Prikryl
19ae9e1dca On Synchronization checklist window Move command can be used with a set of orphaned files and new folder in source directory
... to create that directory on the target side and move the orphaned files there

Source commit: 11d34258171557f7d9e38ee80132d000f77c939e
2024-10-18 00:51:18 +02:00
Martin Prikryl
1ae9bc261e Logging memory use
Source commit: 462fbe382672518108065de26b20243398f38ed6
2024-09-21 01:02:57 +02:00
Martin Prikryl
3a3f514c59 Issue 912 – Thumbnail view in file panel (remote)
https://winscp.net/tracker/912

Source commit: 8fbf80f9ea42f043cfb856821f474c80da45aa5e
2024-09-05 13:05:19 +02:00
Martin Prikryl
9f9d4655f1 Easier use of TValueRestorer
Source commit: 605e98cefaa62284f2b1150fdc355e88d48bdbd3
2024-03-20 13:56:00 +01:00
Martin Prikryl
d2deb06e87 Bug fix: Possibility that files in root folder were incorrectly used
Source commit: 88e091dd7ad1cbdac404d6e883ff8a44aa89b316
2024-03-12 14:36:12 +01:00
Martin Prikryl
e782da2c87 Issue 2260 – Failure when trying to synchronize files by checksum on server that does not support it
https://winscp.net/tracker/2260

Source commit: d23d1a3ca251922e98b128ea807f120a690fe517
2024-02-21 01:03:48 +01:00
Martin Prikryl
aa964c3fd2 Ignore attempts to directly move/duplicate file over itself, as if protocol requires deleting, the file would be lost
Source commit: 0a3fb92c74e25dfc9d99ea868f03a50a5c8586ec
2024-01-10 19:11:31 +01:00
Mikhail Lukashov
a8e6220b88 fix typos 2024-01-05 10:37:32 +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
e6f16c13f9 Failure when moving files using FTP, caused by fbf8bdb1
Source commit: c09ff9ada6a917a59b00a79ad9f5d1f0d27bdf62
2023-11-07 10:11:17 +01:00