Commit Graph

1134 Commits

Author SHA1 Message Date
akallabeth 632e2180f7
[winpr,stream] rewrite stream read functions
Use a loop to shift in bytes to avoid casts.
2024-09-19 09:06:20 +02:00
Armin Novak 46457a5033
[winpr,stream] Add Stream_BufferAs macro
* Add Stream_BufferAs, Stream_ConstBufferAs, Stream_GetBufferAs and
  Stream_GetPointerAs to get a pointer to the stream pointer or buffer
  casted to a specific type.
* Use WINPR_STREAM_CAST in these new macros for proper cast according to
  C or C++
2024-09-19 09:06:13 +02:00
akallabeth 8b6091a007
[winpr,wtsapi] improve API usage
* Mark WTSVirtualChannelOpen and WTSVirtualChannelOpenEx with
  WINPR_ATTR_MALLOC to enforce compiler checks for resource cleanup
* Fix unused result warnings, use the result or cast to (void) where not
  requierd
2024-09-14 21:29:31 +02:00
akallabeth 65de25205b
[winpr,env] add missing WINPR_ATTR_MALLOC 2024-09-14 21:29:26 +02:00
akallabeth d5b41bb8a0
[warnings] fix casts
* Add macro WINPR_REINTERPRET_CAST to cast (checked) from type A to B
* Fix cast warnings
2024-09-14 08:24:51 +02:00
akallabeth 71080e61b0
[warnings] fix a bunch of them
* fix uninitialized variable warnings
 * modivy ndr_context_* functions to utilize WINPR_ATTR_MALLOC
 * build_krbtgt use winpr_asprintf
 * add proper Stream_Write_UINT64_BE
2024-09-14 08:24:28 +02:00
akallabeth d2641ea55f
[winpr,include] fix reserved-identifier warnings
* Remove symbols where possible
* Use #pragma where the symbols are implementing ISO or windows
  functions
2024-09-13 14:30:33 +02:00
akallabeth 7ef9345743
Merge pull request #10549 from hardening/rcg2
core, channels: client-side remote credential guard
2024-09-13 08:24:14 +02:00
akallabeth 163aec7e2b
[warnings] fix documentation command unknown 2024-09-12 21:21:41 +02:00
akallabeth fb5934007a
[doxygen] add basic documentation for new API
* Add basic documentation for new functions/structs/data types since
  3.0.0
2024-09-12 20:09:19 +02:00
akallabeth 98f22d49b9 [CMake] add public headers as INTERFACE target 2024-09-12 18:54:40 +02:00
akallabeth c84655cd62
[warnings] remove const params
Avoid const TYPE* const type declarations
2024-09-12 14:29:25 +02:00
akallabeth a1a1fc8658
[warnings] fix mismatches between declaration and implementation 2024-09-12 13:32:44 +02:00
akallabeth f74fd1ab0f
[warnings] silence unused macro warnings
* Add WINPR_PRAGMA_DIAG_IGNORED_UNUSED_MACRO
* Silence usages that
2024-09-12 13:30:08 +02:00
akallabeth f62325d443
[winpr] silence -Wreserved-identifier
* Add macro WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
* Silence use in wtypes.h.in to avoid false positives
2024-09-12 13:30:05 +02:00
akallabeth cc6850bf21
[warnings] fix format nonliteral
add pragma to suppress format nonliteral warnings where appropriate
2024-09-12 09:08:53 +02:00
akallabeth 8ba7b65725
[winpr,secapi] add invalid value to KERB_LOGON_SUBMIT_TYPE 2024-09-11 20:50:27 +02:00
akallabeth eb70b1756b
[winpr,wlog] fix GNU variadic macro 2024-09-11 20:50:17 +02:00
David Fort a4bd5ba886 core, channels: client-side remote credential guard
This patch implements the client-side part of the remote credential guard feature
as described in MS-RDPEAR. The 2 main changes are: shipping the TSRemoteGuardaCreds in
NLA, and implement the rdpear channel that allows LSASS to remote all the calls to
our client. For now it's UNIX only as the windows implementation would be implemented
in a completely different way.
To test, you may establish you ccache and then connect with (RCG enabled on the server):
	xfreerdp /remoteGuard /u:<user> /d:<domain> /v<server>

That should log you in, and in the session you should not be asked for credentials when
doing mstsc /remoteGuard /v:<other server>.
2024-09-11 17:15:11 +02:00
akallabeth 9738fc40f3
Merge pull request #10548 from akallabeth/serial-port
[BSD] build-serial-port
2024-09-09 09:41:12 +02:00
akallabeth 749023bacb
Merge pull request #10555 from akallabeth/cast-fix-tls
[crypto,tls] simplify function pointer cast
2024-09-05 17:18:27 +02:00
akallabeth 6a1c3b4545
[function pointer] use macro for GetProcAddress
Cast all results of GetProcAddress with WINPR_FUNC_PTR_CAST
2024-09-04 21:31:48 +02:00
akallabeth 889ae65a1f
[warnings] add WINPR_CAST_CONST_PTR_AWAY
simple macro casting a const pointer to a non const one.
2024-09-04 20:55:17 +02:00
akallabeth 245afb706c
[function pointers] unify casts with macro 2024-09-04 20:06:45 +02:00
akallabeth a82821b756
[winpr,stream] fix return value
signed int functions should not return unsigned values
2024-09-04 13:17:50 +02:00
akallabeth d959121b2f
[winpr,stream] add returning stream read/peek
To make use easier add Stream functions that return the value read
instead of taking it as argument.
2024-09-04 13:17:43 +02:00
akallabeth 9c6126c470
[winpr,comm] build generic serial-port support
* Disable linux specific code if build on *BSD
* Build stub to just return NULL for unsupported platforms
2024-09-04 12:50:49 +02:00
akallabeth 9df86daf28
[winpr,comm] add missing includes 2024-09-04 10:14:07 +02:00
Armin Novak 7c537d681f [winpr,file] mark winpr_fopen with WINPR_ATTR_MALLOC
enable allocator/deallocator checks for FILE* created by this function
2024-09-02 14:39:53 +02:00
Armin Novak 4b62174c4f
[winpr,platform] fix unknown-warning-option 2024-09-02 14:13:10 +02:00
Armin Novak 11a9c010f9
[winpr] wtypes NOLINT
Silence linter for basic type definitions that use reserved identifiers
2024-09-02 13:56:07 +02:00
akallabeth 36fbed25c9
[winpr,include] define warning ignore macros
Define new macros to ignore specific compiler warnings:
* WINPR_PRAGMA_DIAG_IGNORED_OVERLENGTH_STRINGS
* WINPR_PRAGMA_DIAG_IGNORED_QUALIFIERS
2024-08-30 15:40:13 +02:00
akallabeth 7d3b2aebfd
[warnings] silence WINPR_FALLTHROGH 2024-08-30 15:40:03 +02:00
Armin Novak 3b1c1e0af1 [warnings] fix cppcoreguidelines-init-variables 2024-08-28 10:15:36 +02:00
Armin Novak 5bee88c4d0
[winpr,string] fix variable names in doxygen 2024-08-08 08:45:45 +02:00
akallabeth e34b8b5205
[winpr,utils] add WINPR_JSON_AddItemToArray 2024-07-19 15:52:20 +02:00
akallabeth 6c682c8418
[client,common] add option to set timezone
* /timezone now allows setting the timezone used from a windows timezone
  key name
* /list:timezones now lists all available windows timezone key names
2024-07-19 11:39:46 +02:00
akallabeth 896ea3c445
[primitives,codec] guard SSE code with platform
SSE optimized code might be used in multiarch/universal builds.
So not only guard with WITH_SSE2 but also with architecture defines from
winpr/platform.h
2024-06-25 09:56:52 +02:00
akallabeth 4f6422ba86 [winpr,platform] add WINPR_PRAGMA_UNROLL_LOOP
add a define for compiler specific pragmas to enforce loop unrolling
2024-06-11 09:28:13 +02:00
akallabeth 14ba7fb601 [winpr,sysinfo] update IsProcessorFeaturePresent
Update instruction set detection for newer stuff (SSE4, AVC2, ...)
2024-06-11 09:26:52 +02:00
akallabeth ef4c1766d2
[winpr,thread] implement SetThreadPriority 2024-05-24 15:44:17 +02:00
akallabeth 1b735a5c17
[winpr,utils] add JSON parser wrapper
as we now support cJSON and json-c we need to wrap the functions we use.
also allows drop in replacements for older cJSON versions lacking
certain functions.
2024-05-14 20:45:25 +02:00
akallabeth 52a884ed2e [winpr,timezone] refactor timezone mapping
* add option to use ICU as a fallback mapping (eliminate need for
  WindowsZones mapping list)
* extract timezone related settings from localtime_r and eliminate the
  need to parse the complex TimeZones table
* Add new TimeZoneNameMap to map IANA to windows names (Id, Standard,
  Daylight and Display names)
* Implement GetDynamicTimeZoneInformation
2024-05-08 10:08:08 +02:00
Ondrej Holy 73991c48ce [winpr,ncrypt] obtain module path from provider
Currently, the module path is hardcoded in the build_pkinit_args function.
Let's obtain the module path from provider as a preparation for the
follow-up changes.
2024-04-22 17:42:52 +02:00
akallabeth 2c7a5f7bee [winpr,env] WINPR_ATTR_MALLOC
mark the free functions for environment strings
2024-04-12 13:30:35 +02:00
akallabeth 68f0e0a325 [winpr] WINPR_ATTR_MALLOC HANDLE functions
mark functions creating handles with WINPR_ATTR_MALLOC to ensure
compiler checks for proper handle close
2024-04-12 12:41:42 +02:00
akallabeth d87d598305 [winpr] add WINPR_ALIGN64 defines
Add defines to aling struct members to 8 bytes
2024-03-12 14:24:36 +01:00
Kai Pastor f2f9c59b01 Disable WINPR_THREAD_POOL for mingw 7 2024-03-12 09:39:45 +01:00
Kai Pastor 47354c4519 Fix MSVC arm64 2024-03-12 08:40:42 +01:00
akallabeth 4732f379d4 [winpr,sysinfo] unify time function use
* Add new function winpr_GetTickCount64NS for high resolution tick
  count with (up to) nanosecond resolution
* Add new function winpr_GetUnixTimeNS for high resolution system time
  as nanoseconds since 1.1.1970
* Replace use of clock_gettime and gettimeofday in whole project with
  these new functions
* Add new macros WINPR_TIME_NS_TO_* and WINPR_TIME_NS_REM_* to convert
  the nano second count to less resolution or get the remainder in the
  desired resolution
2024-03-11 09:54:10 +01:00