4347 Commits

Author SHA1 Message Date
Armin Novak
e87ef20f55 [winpr,crt] always convert to/from UTF-16LE 2025-08-20 09:15:56 +02:00
Armin Novak
124e2adafe [warnings] fix type mismatches 2025-08-18 14:32:29 +02:00
Armin Novak
81bc5d825c [winpr,library] implement GetModuleHandle[AW] 2025-08-18 08:33:13 +02:00
akallabeth
3f7f3a3bd8 [winpr,library] Fix LoadLibraryX and LoadLibraryW
Using a NULL library name should return a handle to the
library/executable itself.
2025-08-14 08:14:43 +02:00
akallabeth
65f18983ed [warnings] Fix format string errors
* Fix casts of format string arguments (%p requires void*)
* Fix format string to match type of arguments
2025-08-13 15:09:48 +02:00
akallabeth
c3e507a82e [winpr,wlog] Replace WLog_PrintMessage calls
Prefer WLog_PrintTextMessage to have proper format string checks in
place.
2025-08-13 15:08:01 +02:00
akallabeth
df89b04424 [winpr,wlog] Add specialized text log functions
The generic WLog_PrintMessage(VA) functions lack proper checks of the
supplied format strings.
Add WLog_PrintTextMessage(VA) functions that do compile time checks of
supplied format strings to uncover usage errors early and use them in
the logger macros.
2025-08-13 15:07:51 +02:00
akallabeth
03a3f90e4b [winpr,test] Fix missing cast in TestMarshalUnmarshal
The argument in the test has wrong type breaking package builds. Cast to
required argument type to fix.
2025-08-13 10:08:24 +02:00
akallabeth
6284bba9f0 [clang-tidy] fix various warnings
* silence tidy warnings for public API symbols (we can't fix these for
  compatibility reasons)
* fix issues with casting
2025-08-11 14:11:40 +02:00
akallabeth
5f5485f2d3 Merge pull request #11747 from akallabeth/proxy-rpath
[cmake] add installWithRPATH
2025-08-11 12:38:47 +02:00
akallabeth
97dd6d728c Merge pull request #11761 from pvachon/master
Clean up bugs exposed on systems with high core counts
2025-08-11 09:34:19 +02:00
Phil Vachon
e620bf6c53 Actually make the correct cast
The cast works best if you don't imply another conversion to a
temporary. Just return the value directly from the syscall/pthreads
call, while casting to a DWORD.
2025-08-10 15:09:29 -04:00
Phil Vachon
9e217fc3ac Explicitly cast away signs for thread IDs
Neither FreeBSD nor Linux specify a negative value for a thread ID, so
cast the sign away explicitly.
2025-08-10 13:01:54 -04:00
Phil Vachon
91f928e018 Switch macOS to use fallback for thread ID
macOS uses a 64-bit thread ID, so rather than truncate this in
GetCurrentThreadId, use pthread_self's result and mix it with the MSBs
of the pointer to reduce the probability of a collision.
2025-08-07 10:07:28 -04:00
Martin Fleisz
c178a54119 Merge pull request #11754 from mnauw/winpr_tz_init
[winpr,timezone] ensure thread-safe initialization
2025-08-07 08:50:13 +02:00
Phil Vachon
e1db51383b Use OS-provided thread ID primitives
Truncating 64-bit thread IDs to 32-bits can result in collisions on
systems with large numbers of CPUs. GetCurrentThreadId() does this, and
there are fairly easy to reproduce collisions on systems with ~128 CPU
cores.

The `GetCurrentThreadId` API should wrap an OS-specific way of providing
the current thread ID. Keep the XOR-folded pointer as a fallback for
OSes which aren't explicitly supported.

This fixes failures in TestSynchCritical that are readily reproducible
on such systems..

Tested on FreeBSD 14.3 and various Linux variants on x86_64.
2025-08-05 20:19:31 -04:00
Mark Nauwelaerts
bb3871741b [winpr,timezone] ensure thread-safe initialization 2025-07-31 19:03:30 +02:00
Martin Fleisz
5e54e0a69b Merge pull request #11734 from hardening/credentials
winpr: re-introduce the credentials module
2025-07-31 14:43:52 +02:00
akallabeth
12d0e491f6 [cmake] add installWithRPATH
this new CMake function installs a target to a destination and adds the
correct relative RPATH to some desired locations
2025-07-17 13:59:51 +02:00
David Fort
4f909a36a5 winpr: re-introduce the credentials module
The credential module from FreeRDP2 was removed, but sometime you still need to
have support for Cred[Marshal|Unmarshal]Credential especially when it's a
smartcard logon and that the cert sha1 is encoded using these functions.
2025-07-10 16:07:01 +02:00
Armin Novak
ff8c47b1fc [winpr,utils] do not log command line arguments
Only builds with -DWITH_DEBUG_UTILS_CMDLINE_DUMP=ON will dump the
command line argument that failed during parsing to the log.
2025-07-09 12:26:44 +02:00
Armin Novak
45b3cbf120 [winpr,utils] Add escaped quote support
In CommandLineParseCommaSeparatedValues[Ex] now escaped characters are
respected, so a single quote in a string does not break parsing.
2025-07-09 09:55:57 +02:00
David Fort
20686345da kerberos: do various tries for TGT retrieval in u2u
In a server-side user2user scenario, you can have either a configuration with
a service mapped to a user or something host based. So your keytab will contain
either a TERMSRV/<host>@<realm> entry that is able to retrieve a TGT, or the
machine account associated with <host>$@<realm>.

This patch makes the kerberos SSPI first try to retrieved a TGT as if it was
a service mapped to a user. And if it doesn't work (or if the entry is missing),
it goes for a host based attempt.
2025-07-03 14:28:49 +02:00
David Fort
6e7f5c6355 negotiate: add user2user filtering
This patch adds the possibility to disable kerberos user2user in the SPnego SSPI
module, so you can set "!u2u" in the authPackageList to disable user2user kerberos.
It also does a few cleanups (FALSE instead of 0, and defaulting to no kerberos when
kerberos support is not compiled in).
2025-07-02 10:01:57 +02:00
akallabeth
f3e1f20018 [cmake] unify version creation
* move to common cmake/GetProjectVersion.cmake for both, WinPR and
  FreeRDP
* add preference for git tag or commit
* move options to this common file
2025-06-27 12:48:52 +02:00
akallabeth
813715d85e start dev cycle 3.16.1-dev0 2025-06-16 11:56:14 +02:00
akallabeth
fcdf4c6c7e release 3.16.0 2025-06-16 11:56:11 +02:00
akallabeth
ef6b4efdf4 [winpr,file] fix definition of winpr_CreateFile 2025-06-05 13:55:01 +02:00
Armin Novak
07e39ede20 [winpr,file] Add winpr_CreateFile wrapper
Allows creation of a file HANDLE from a utf-8 name
2025-06-05 11:58:47 +02:00
Armin Novak
b5b258c9f4 [winpr,path] fix NULL arguments for DeleteFile 2025-06-05 11:58:47 +02:00
Armin Novak
f1fa7b56c2 [winpr,file] add GetLogicalDriveStrings[A|W] 2025-06-05 11:58:47 +02:00
Armin Novak
bcbf72ea99 [winpr,path] fix windows unicode paths 2025-06-05 11:58:47 +02:00
akallabeth
78a8dbfcbb [winpr,file] handle FILE_ATTRIBUTE_NORMAL in SetFileAttributesA 2025-06-02 20:13:17 +02:00
akallabeth
fc5198e5a6 [winpr,file] improve errno to lasterror mapping 2025-05-27 16:27:46 +02:00
akallabeth
022871969c [winpr,timezone] use new JSON config reader 2025-05-26 19:36:40 +02:00
akallabeth
aadc257ecd [utils,json] add functions to read from file 2025-05-26 19:36:40 +02:00
akallabeth
85a261be77 Merge pull request #11631 from asterwyx/master
[stream] reset pool array size after clearing
2025-05-26 09:07:11 +02:00
akallabeth
d139c8799b [winpr,wtypes] align BOOL typedef with objc.h header 2025-05-26 08:56:44 +02:00
Yixue Wang
e444ce53d7 [stream] reset pool array size after clearing
StreamPool becomes inconsistent after clearing. This might be a
problem in some critical situation. Reset pool array size after
clearing.
2025-05-26 14:27:14 +08:00
akallabeth
34ab0b893d [warnings] fix clang-tidy warnings 2025-05-23 15:29:31 +02:00
akallabeth
135fdb0b9c [winpr,sspi] fix realm usage for Heimdal
Fix retrieval of realm name from krb5_principal::realm
* MIT krb5 uses type krb5_data
* Heimdal krb5 uses type Realm
2025-05-16 11:06:17 +02:00
akallabeth
c1be9cb001 [winpr,sspi] add kerberos string len checks 2025-05-15 21:39:30 +02:00
akallabeth
1ba91069ce [cmake,winpr] set policy CMP0177 2025-05-13 09:21:57 +02:00
akallabeth
330f9b1b20 [winpr,file] fix strcat warning 2025-05-09 10:26:22 +02:00
akallabeth
f3de09a03c [winpr,file] fix wrong status code 2025-05-09 09:09:50 +02:00
akallabeth
1aa4566cbd [winpr,file] add TestFileWriteFile testcase 2025-05-08 07:53:30 +02:00
ljh0121
2a7f7c0249 feat:add FileFlushFileBuffers 2025-05-08 11:21:26 +09:00
lazy5f
05326f15b6 [winpr,file] Fix assert fail always when removing flags 2025-04-29 07:58:34 +09:00
akallabeth
4840c9d4ae [winpr,stream] fill up empty stream
In Stream_Write_UTF16_String_From_UTF8 fill up WCHAR if requested even
for empty source strings
2025-04-28 17:09:12 +02:00
Mark Nauwelaerts
b7a2eecaa1 [winpr,sysinfo] use a single clock to provide System and Local time
... rather than a different one for second and sub-second part
2025-04-22 21:01:54 +02:00