Commit Graph

3454 Commits

Author SHA1 Message Date
akallabeth
0e6c921b20 [winpr,threadpool] default minimum thread count
Set a default minimum of 4 threads in a pool. Avoids issues with system
running with a single processor (might lead to deadlocks if the code
assumes > 1 thread handling stuff)
2025-09-12 08:39:25 +02:00
Armin Novak
113b73512c [CMake,winpr] add pkg-config dependencies
Depending on CMake variables add cmake required.private options
2025-09-11 07:17:33 +02:00
Armin Novak
f0eb42a2fc [winpr,sspi] log mechanisms not valid
Log SSPI mechanisms that are available but not usable due to
configuration.
2025-09-04 15:08:03 +02:00
Armin Novak
ff23fc53dd [winpr,path] fix missing length check 2025-09-04 10:36:08 +02:00
Armin Novak
c2fc455d8f [winpr,pool] limit threadpool to 16 threads by default
Initialize the threadpool to minimum of number of processors and 16 by
default.
2025-09-03 15:02:49 +02:00
akallabeth
14598e319f Merge pull request #11837 from TheBestTvarynka/fix/winpr-piv-cert-labels
fix(winpr): ncrypt_pkcs11: set correct PIV certificate labels
2025-09-02 21:51:18 +02:00
Pavlo Myroniuk
101f7ad1c8 fix(winpr): pin cert labels; 2025-09-02 16:12:04 +03:00
akallabeth
dd7d3841e9 [winpr,path] fix big endian issues with path 2025-09-02 09:19:28 +02:00
akallabeth
e2b6c0ca2a [winpr,file] fix TestFileFindFirstFile 2025-09-01 17:03:51 +02:00
akallabeth
6f9a15d7c8 [winpr,file] fix TestFileFindFirstFileW 2025-09-01 09:18:46 +02:00
akallabeth
3a34545a75 [sspi,negotiate] improve /auth-pkg-list parsing
* add 'none' keyword to allow disabling all methods, selectively
  enabling by adding
* improve option description
* fix reading of ini file settings
2025-08-29 12:18:20 +02:00
akallabeth
7e9149e6aa [winpr,sspi] fix Heimdal compatibility 2025-08-26 14:00:11 +02:00
Dan Horák
907ca47e40 [winpr,synch] increase timeout for TestSynchCritical
Increase the deadlock detection timeout in TestSynchCritical to accommodate
longer runtime on systems with large number of CPUs/threads. The usual test
run time when the threads are finishing correctly won't change.

Fixes: https://github.com/FreeRDP/FreeRDP/issues/11800
2025-08-22 19:22:48 +02:00
Armin Novak
058cfa972f [macros] #ifndef MAX
on some platforms the macro is part of the standard library, only define
if not already there.
2025-08-20 11:38:46 +02:00
Armin Novak
4fadd12047 fix clang-tidy warnings 2025-08-20 11:28:18 +02:00
Armin Novak
376a2c6e32 [winpr,credentials] prefer utf-8 over utf-16-LE
When implementing the wide character functions convert the string to
utf-8 before manipulation to avoid endianess issues.
2025-08-20 09:42:37 +02:00
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
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
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
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