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

225 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
094515154c Issue 1950 – Parsing of multiline VMS FTP listing entries is broken
The previous fix from e757f7b7 only fixed a small part of the problem (before the parsing result was corrupted, while after the fix file details were not parsed).

https://winscp.net/tracker/1950

Source commit: 2853e4d6abe65217f72ab4f8f840b1a15b1184d6
2026-10-21 00:35:21 +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
Build Server
ec328f18f1 Letter casing in filename
Source commit: bfe6ab0ffce08654cf659554c2924befa72f8383
2026-10-15 16:21:59 +02:00
Martin Prikryl
e9b1860006 Link updates
Source commit: d947e04bdfdcaec955178b255bad454e9e9fa84a
2026-09-03 16:40:56 +02:00
Martin Prikryl
11ce2859c0 Links update
Source commit: a99ad766ce70165b2aa13cc27bb88f8bd4a57893
2026-09-01 12:52:09 +02:00
Martin Prikryl
b9307ef5f8 Link update
Source commit: 8c66ef0daac794fa894cd1eddad7362a4d271035
2026-07-10 08:13:03 +02:00
Martin Prikryl
5a8c4cdaea Using "username" and "hostname" as one word
Source commit: d86c0d6704a14fff6e3dca57868548df1f80cdd7
2026-05-29 01:15:26 +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
7285339f8f Correct type
Source commit: 838828f2d7f207ea0273421b663d36495690c83d
2026-04-10 16:28:35 +02:00
Martin Prikryl
d8eb4a837b Issue 2435 – Failure when trying to connect via HTTP proxy to FTP host with excessively long login details
https://winscp.net/tracker/2435

Source commit: e9ef2e7a66c7acc8bb087b11436166dab967ee00
2026-04-10 01:18:27 +02:00
Martin Prikryl
bdc1aefa86 Types and casts safe in respect to pointer size for forward 64-bit compatibility (2nd after a2119a7e)
https://winscp.net/tracker/618

Source commit: c34c42432b77f29fc4e5f6824021c9d282a19525
2026-03-28 01:12:40 +01:00
Martin Prikryl
7e83e14f24 Removing code for listening over proxy, which is never used (and part of it is not 64-bit ready)
Source commit: 6b69572a80001b9aa5e425c6a360989740c17ad7
2026-03-07 01:07:38 +01:00
Martin Prikryl
afbaf8f9ea Shared BOM declaration
Source commit: cba15f59434ab48b2f30e93d304e8e3fcffd0463
2026-01-22 14:53:05 +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
4645876213 Refactoring UTF conversion in FTP with use of UTF8String
Source commit: 39bbfdb678746abe00f95f7e9385c155ae2882ff
2026-01-07 01:17:36 +01:00
Martin Prikryl
0eb2d61e79 Obsolete MFC defines
Source commit: a483896659000749dcf4c3566f4c449abdb838ba
2025-12-21 01:37:23 +01:00
Martin Prikryl
efe94d6c08 Using actual types and functions instead of WinAPI and Unicode/Ansi macros
Source commit: b7fec4d069296b58bb43e7a4a97dd85d558212b7
2025-12-21 01:34:21 +01:00
Martin Prikryl
f2eed0002d Replacing CTimeSpan with VCL functions and removing some more unused MFC time code
Source commit: 6e54884137f0c5f45e32dcec5d756947a4f845d5
2025-12-21 01:25:39 +01:00
Martin Prikryl
9cf851dcfa Replacing MFC CFile::IsValid with FileExists
Source commit: 48c7984e36261a8cee5f6eb09c896a8bf4ae0caa
2025-12-20 12:29:55 +01:00
Martin Prikryl
63a9eb579a Getting rid of MFC string loading code
Source commit: 3c7399548535aeb9ebb738e2fdde52431d0ba83f
2025-12-19 07:35:02 +01:00
Martin Prikryl
092180d4a7 Getting rid of MFC Ansi-Unicode conversion code
Source commit: f290d70e75fd2de0ae4c45e8480e766c2a8af5d0
2025-12-19 01:20:41 +01:00
Martin Prikryl
996c687ddc Factoring out PORT/PASV parsing and formatting + As a result, directory listing falls back to the other active/passive mode, consistently with file transfers
Source commit: 13a0a73f7378b2aea644de0b8f71d7c8d240c368
2025-12-19 01:18:06 +01:00
Martin Prikryl
90a35fe550 Removing nonsense code
Source commit: e63f03cc795d2dc2af025cb566007b927b98d506
2025-12-18 01:30:48 +01:00
Martin Prikryl
e5efed8955 Refactoring old-style casts
Source commit: 3c37b3a958525c595ad44b081b2e0f3b288b8eb0
2025-12-18 01:20:33 +01:00
Martin Prikryl
ad7a0626fd Refactoring certificate parsing
Source commit: 30a4ee26414f88408675d63ffee2b57be6a6c156
2025-12-17 01:39:05 +01:00
Martin Prikryl
75343733c6 Factoring out socket address functions
Source commit: 1f9e960b8e5d762cf19fe0c07ed0ccb00f67553c
2025-12-11 15:08:47 +01:00
Martin Prikryl
bd0dd77ab7 Using SysErrorMessage
Source commit: 8077c7969e90f7848bf30eb18da4fd492e5f1a76
2025-12-11 14:43:24 +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
6963f08ffd Enabling all warnings in all projects and only selectively disabling those that are needed
with aim to eventually update the code to need as little warnings disabled as needed.

Some code updates (and even fixes) to avoid warning done already

Source commit: 5c45a6f56c52e7b0c5034ed9980cd65259a7372b
2025-12-04 01:16:16 +01:00
David Bures
f22f2758e4 send host into InitSSLConnection so it's used as SNI in data channel same way is in control channel, Filezilla3 uses it this way, and some servers need the info to be able to map control channel when going thru different front end servers when load balancing 2025-11-03 14:23:27 +01:00
Martin Prikryl
99b57046b3 Bug fix: After FTP data connection fails to open further use of the session is broken
Source commit: 8f36620525c1756e8e4593f5be689ed695580079
2025-10-07 15:37: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
1654eab67d Non-conflicting method name
GetCurrentTime is re-defined as GetTickCount in winbase.h
Using unique method name instead not to cause problems, when headers are included in different order

Source commit: cc34b034c1386125d55894b7f2ac1e4ca1c776bf
2025-08-28 01:00:33 +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
178d063da0 Issue 2395 – Incomplete FTP upload when the source stream/stdin reads less than requested
https://winscp.net/tracker/2395

Source commit: 2577e5f6685b0dc1d31130283bbe94e82514f71b
2025-08-02 01:23:25 +02:00
Martin Prikryl
88a03b9736 Removing redundancy in FTP upload code
Source commit: 212ac959f61d892841f843c0c4cc821b888fe080
2025-08-02 01:20:22 +02:00
Martin Prikryl
8c5837e5bc Removing parameter unused since ac251a73
Source commit: 89421b9dfbcae17e87f07ddbe798740411eb18a0
2025-08-02 01:11:39 +02:00
Martin Prikryl
066362a213 Removing unused FTP zlib code
Source commit: 4ea7071a5f9183b107d23c42caf36d96d266442b
2025-08-02 01:08:29 +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
a23e73c987 Further removal of unused MFC code
(Neither CTime nor CString throws any CException)

Source commit: d4432854a7b73218a52cd92a9542d7f18e02ea27
2025-07-29 13:21:42 +02:00
Martin Prikryl
fc1ad2eea0 Reimplementing CString using UnicodeString and replacing CStringA with RawByteString
Source commit: 5232a4e3833b8e9dac4ebaa3c12151ff981ac6cf
2025-07-29 01:00:19 +02:00
Martin Prikryl
0c1faca059 Removing lots of unused MFC code
(Initially started to get rid of some code that's incompatible with Clang)

Source commit: 287abe038bd5c75a2c44d0db91129c7e968385e8
2025-07-28 17:06:51 +02:00
Martin Prikryl
f39dfdd8a0 Comment on possibly better session caching API
Source commit: 0c133f95ea06feecbd5753f33607c7d90b79a3b1
2025-07-16 10:36:14 +02:00
Martin Prikryl
92ba1e3f0e 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
Source commit: eef61854e4463990c6e823a08451a9e229a8c54b
2025-03-14 16:17:09 +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
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
716ff88932 Merge branch 'master' into dev
# Conflicts:

#	source/WinSCP.cbproj

Source commit: 265884be60496f9ab401f9e5bf7ad642bec773bf
2024-09-10 14:16:09 +02:00