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

581 Commits

Author SHA1 Message Date
Martin Prikryl
4436072fa4 Issue 2476 – Memory leak in encrypted HTTP/S3/WebDAV connections
https://winscp.net/tracker/2476

Source commit: 45dbb0fae90b5bfd3b728375b7dbd94ef9ce884d
2026-10-23 00:37:03 +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
ac781f63fe Update to Expat 2.9.0
Source commit: 2d2fc87baa17104082d3ddaab96216a3f342f60a
2026-10-07 11:03:29 +02:00
Martin Prikryl
5c76bf8072 Merge branch 'thirdparty'
Source commit: 96da2dafb48f70ed7cf98a429d23bb512b2b3b8f
2026-10-07 11:02:43 +02:00
Martin Prikryl
9c19e6d63c Expat 2.9.0
Source commit: 9520d6bddf1be7c834a80342838ef015b8ea9999
2026-10-07 00:39:45 +02:00
Martin Prikryl
ea94f08215 Update to OpenSSL 3.5.9
Source commit: 4828d4a32aea4cb4489052ba450a1c868321f5e9
2026-10-02 17:55:17 +02:00
Martin Prikryl
53e9fa9cba Merge branch 'thirdparty'
# Conflicts:

#	libs/openssl/crypto/init.c

Source commit: 4564413da7872ac62838988bc1fff4e10082b5a4
2026-10-01 00:39:32 +02:00
Martin Prikryl
76ef84ee9f OpenSSL 3.5.9
Source commit: 576ad7c53795c8bad0ac3c54f37ffd83319c0077
2026-10-01 00:38:31 +02:00
Martin Prikryl
aa84919ea2 Merge branch 'thirdparty'
Source commit: 2020b08ce3f76bbae0802da3b6fbfc79817ade7d
2026-09-26 00:35:22 +02:00
Martin Prikryl
6814e509cf Expat 2.8.5
Source commit: 1faef679c1850b80451cfda839d0a3b1ea197c41
2026-09-26 00:34:43 +02:00
Martin Prikryl
64050d10c7 Removing no longer working OneDrive code
Source commit: 8a28dd98ba1cf2216dbd176900d23c8acf13685c
2026-09-25 00:36:53 +02:00
Martin Prikryl
80f7773ea2 Merge branch 'thirdparty'
Source commit: 8baf37239762f63d26a76d5aa9dd9f44a538bbc5
2026-09-02 00:36:29 +02:00
Martin Prikryl
f48325f758 Expat 2.8.4
Source commit: 47ffe2198fed8a585d5ca8d6d7124598408897bd
2026-09-02 00:35:39 +02:00
Martin Prikryl
82fe067bda Update to OpenSSL 3.5.8
Source commit: 43037597e93625bae8773c60ce0feae26a106060
2026-08-27 00:37:06 +02:00
Martin Prikryl
e3497c4411 Merge branch 'thirdparty'
# Conflicts:

#	libs/openssl/include/openssl/ssl.h

Source commit: 9979bc91fbab012071e38fdab32966af9e79afc6
2026-08-27 00:36:12 +02:00
Martin Prikryl
a168770743 OpenSSL 3.5.8
Source commit: ba6936b76d9bf4f428bfbc29abbe02df58a16e65
2026-08-27 00:35:11 +02:00
Martin Prikryl
581da2d798 Merge branch 'thirdparty'
Source commit: d330ffdfcb7222faab1e4203abff99a3854ecae4
2026-08-16 01:27:23 +02:00
Martin Prikryl
f8247526e4 Expat 2.8.3
Source commit: 12eb4234f9ccfec589a52cd7d76da604e75e1da1
2026-08-16 01:26:34 +02:00
Martin Prikryl
9bcb264950 Merge branch 'thirdparty'
Source commit: 7eee29ff2009c9975a02857cde0ea37055642bc6
2026-06-29 00:55:07 +02:00
Martin Prikryl
fc2b9236e9 Expat 2.8.2
Source commit: 0542fa1babe450ff98112f020e675f6feb6dffe0
2026-06-27 00:56:14 +02:00
Martin Prikryl
a2baba0f5b Removing unwanted OpenSSL doc and test files (from 28af0833)
Source commit: 980a90fd97d34855433d547e3c1b3c512d2a72bf
2026-06-17 15:50:47 +02:00
Martin Prikryl
dd1665bccb Update to OpenSSL 3.5.7
Source commit: 936bca5fc8eaae2a1dfec090ef63df64ba622115
2026-06-11 01:04:29 +02:00
Martin Prikryl
ae879128e8 Merge branch 'thirdparty_dev' into dev
# Conflicts:

#	libs/openssl/include/openssl/ssl.h

Source commit: dd87f85cf0fc77acc5a675b1ae2cc0ecdcd7019c
2026-06-11 01:01:07 +02:00
Martin Prikryl
86d1ef99b1 OpenSSL 3.5.7
Source commit: 1c948c123bc7fe5c5dd0d6fd7a725eba2fc8af3d
2026-06-11 00:57:07 +02:00
Martin Prikryl
028b5324f5 Merge branch 'thirdparty_dev' into dev
Source commit: cb4bcb3c658e4fd70026be8eb9d979f2b34ecb74
2026-05-14 01:02:32 +02:00
Martin Prikryl
1879dc7a0d Expat 2.8.1
Source commit: 22774117d76e43bc57ff1e12423ca6ee12c75830
2026-05-14 00:59:49 +02:00
Martin Prikryl
d725f98ec4 Issue 618 – Experimental 64-bit version of WinSCP
https://winscp.net/tracker/618

Source commit: 329fb51d696db6c1d37d5c5240ff253af0df941b
2026-05-11 18:39:51 +02:00
Martin Prikryl
91a3ddc224 Tagging some changes from a2119a7e
Source commit: 489a67936704ca871ee14d099db554e14fce19c7
2026-05-08 00:53:25 +02:00
Martin Prikryl
9a6f85da4e OpenSSL 3.6.5 version of aes_core and aes_cbc
Source commit: f952ddf76a911cff80f23a63bdde23549058d80e
2026-05-08 00:50:39 +02:00
Martin Prikryl
4e0a766b85 Getting ready for object file extension being different for 64-bit
(OBJ_EXT was by mistake included [and not used] by ee950ff4, now shortened to O)

Source commit: 11c56961c6833cac923617d2cb1649d752a66aa3
2026-05-07 01:06:00 +02:00
Martin Prikryl
a58995e61e aes_core and aes_cbc are 32-bit specific
Source commit: 4aadabac7c0d7081c21bf1772a299f3100f1e53e
2026-05-07 01:03:55 +02:00
Martin Prikryl
9c0d5a9892 -ffunction-sections is 32-bit specific and -munwind-tables -fno-common are needed on all platforms
On 64-bit the -ffunction-sections seems to cause troubles when passing an exception through C code

Source commit: 9b234ea57e1d565674c3a124a646f6df80672561
2026-04-30 01:10:36 +02:00
Martin Prikryl
b01b169704 Restored faster C TLS/SSL AES implementation
Reverts 5851fe38

Source commit: f41be0ca0b016b0d555532b593982f3c83add32b
2026-04-29 01:03:34 +02:00
Martin Prikryl
a0de61a739 Restoring use of RtlGenRandom for Expat 2.8.0
See 2d5ba44d

Source commit: 8d288fe0cb0b8870204d7bb3f1c5c0ef98efe470
2026-04-28 07:14:55 +02:00
Martin Prikryl
ec1c8b76f1 Merge branch 'thirdparty_dev' into dev
# Conflicts:
#	libs/expat/lib/xmlparse.c

Source commit: 85307ce76d87367e99498c31b078e940a41058ca
2026-04-28 07:12:27 +02:00
Martin Prikryl
481b19aba5 Expat 2.8.0
Source commit: 74e09188924a23353c8da0927f68f70858e44e88
2026-04-28 07:10:02 +02:00
Martin Prikryl
f2dff5f7cc Removing some unused OpenSSL AES code
Source commit: 8c4bd9d870ced6b9283a5a0fdfbfe286ab8a20b5
2026-04-22 01:37:58 +02:00
Martin Prikryl
693f5da37c Removing CFileException MFC class
Originally because it seemed that it was causing problems with 64-bit build, which wasn't true in the end. But it's a good move anyway.

Source commit: 2d2d341d8e98f31692c1beca8445899e289ee0cb
2026-04-18 01:11:47 +02:00
Martin Prikryl
d35e49d5d0 Update to OpenSSL 3.5.6
Source commit: c97a56b706bc704b5472a71b657bbd398ad96a46
2026-04-09 01:12:15 +02:00
Martin Prikryl
28af0833ef Merge branch 'thirdparty_dev' into dev
# Conflicts:

#	libs/openssl/include/openssl/cmp.h

Source commit: d607feabaff43b24df8f714ab126558d615bd6f9
2026-04-08 17:12:05 +02:00
Martin Prikryl
a1e18b6312 OpenSSL 3.5.6
Source commit: 8fbe63cb73d53c5cf2262c44d963a7ed0aa4c241
2026-04-08 17:09:23 +02:00
Martin Prikryl
9d7f8f521e Updating neon version to 0.37.1
Source commit: e0445ff98dafbade26fd2a43c76593841d2532b7
2026-03-19 07:34:18 +01:00
Martin Prikryl
88ae9107b3 Merge branch 'thirdparty_dev' into dev
Source commit: f600e135c41bbdcebf2ade12e4661ee33cfeea96
2026-03-19 01:42:15 +01:00
Martin Prikryl
fae0318289 neon 0.37.1
Source commit: c37fcebdcfd5eb3f4181be05ecfe0de9365dac65
2026-03-19 01:38:17 +01:00
Martin Prikryl
c8a49b9f06 Merge branch 'thirdparty_dev' into dev
Source commit: a7ddb169b015c31189ffaa9866db6c6e8d02f3ff
2026-03-19 01:17:41 +01:00
Martin Prikryl
5ad2bb89b6 Merge branch 'thirdparty' into thirdparty_dev
Source commit: 6825732fcf58cb870af112219026e32d55e6a62d
2026-03-19 01:14:22 +01:00
Martin Prikryl
ef26f43dee Expat 2.7.5
Source commit: 007e278da76849e3b8b6643ee79e7c493eb495af
2026-03-19 01:11:04 +01:00
Martin Prikryl
a24a1842ec Expat 2.7.4
(cherry picked from commit 9830812690)

Source commit: ed6bd9a0fba8479952e6799a90a2ce396cbcdadc
2026-03-19 01:08:41 +01:00
Martin Prikryl
93a3d71129 Whitespace
Source commit: 8cc6251756a8c3ec678f5eb05194a28d2c2128e7
2026-03-10 09:20:00 +01:00