Commit Graph

6171 Commits

Author SHA1 Message Date
akallabeth
7b7bea276c
Merge pull request #10327 from mfleisz/fix/auth-last-error
core: Fix handling of logon errors during nla_client_begin
2024-07-01 17:16:38 +02:00
Martin Fleisz
d8cd7c2f38 core: Fix handling of logon errors during nla_client_begin
Under certain circumstances `InitializeSecurityContext` returns an error
if a wrong password was provided. This PR checks the returned status
code and correctly sets the last error code. This allows a client
application to ask the user again for credentials.

A scenario where this happens is when a user tries to connect with a wrong
password and both machines are joined to the same domain.
2024-07-01 14:54:53 +02:00
akallabeth
ab39072ce9
[core,tcp] fix memory leak 2024-07-01 11:07:39 +02:00
akallabeth
562fa8a03d
[core,tcp] Improve IPv4 or IPv6 connect
* Fix +ipv6 option, now fall back to IPv4 if no IPv6 entry found
* Add new option ForceIPvX to fail connect if no such entry is found
2024-06-28 09:07:33 +02:00
akallabeth
431a96fe85
[core,gateway] properly log location 2024-06-27 08:46:48 +02:00
akallabeth
1de8f5a7aa
[core,gateway] pass rdpContext
* pass rdpContext to freerdp_tls_new
* check freerdp_shall_disconnect_context in http_response_recv
2024-06-27 08:42:08 +02:00
akallabeth
559e770982
[gateway,http] implement proper timeouts
Implement request timeouts in http_response_recv, use TcpConnectTimeout
as default
2024-06-26 22:53:09 +02:00
akallabeth
3c4c827358
[winpr,timezone] Fix GetDynamicTimeZoneInformation
* Improve logging, use single function to dump data.
* Use GetDynamicTimeZoneInformation as man getter,
  GetTimeZoneInformation only retrieves a subset.
2024-06-26 20:59:43 +02:00
akallabeth
9b89d8fa23
[core,timezone] improve timezone logging
* Unify logging to single function
* Add helpers to format magic numbers as strings
2024-06-26 20:37:41 +02:00
akallabeth
b0f7ab7d16
[freerdp,cmake] fix linking of object library
do add to source files so that static linking does not look for a static
library once installed.
2024-06-25 15:44:57 +02:00
Martin Fleisz
a01639e3c4
Merge pull request #10304 from akallabeth/neon-sse-guard
Neon sse guard
2024-06-25 11:52:27 +02:00
akallabeth
7abf5eb3a7
[cmake,codec] fix WITH_OPUS
detect Opus in libfreerdp directly.
The target definition is there and if we run detection in a subdirectory
the required symbols are not visible
2024-06-25 11:30:42 +02:00
akallabeth
8020efcd0b
[primitives,codec] guard NEON code with platform
NEON optimized code might be used in multiarch/universal builds.
So not only guard with WITH_NEON but also with architecture defines from
winpr/platform.h
2024-06-25 10:00:41 +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
Martin Fleisz
628f045de6
Merge pull request #10303 from akallabeth/fix_clang_detect
[cmake] unify clang detection
2024-06-25 09:44:35 +02:00
akallabeth
370975cbd4
Merge pull request #10288 from akallabeth/http_read_timeout
[core,gateway] use TcpConnectTimeout for read as well
2024-06-25 09:17:06 +02:00
akallabeth
26e570e9fe
[cmake] unify clang detection
* Move Clang detection to own CMake file
* Check for Clang and AppleClang
* Use CMAKE_COMPILER_IS_CLANG to check for Clang in code
2024-06-25 09:09:50 +02:00
Armin Novak
0810e7d944 [core,settings] enable SupportDynamicTimeZone
FreeRDP based clients & servers support it. If a remote does not support
it it is not send/received.
2024-06-24 14:38:39 +03:00
Armin Novak
c4fe6e78e5
[core,tcp] return errno ETIMEDOUT on timeout
BIO_C_WAIT_READ and BIO_C_WAIT_WRITE now set errno = ETIMEDOUT
if a timeout occurred.
2024-06-24 10:45:12 +02:00
Armin Novak
8df1a9a52a
[core,tcp] replace macros with inline functions 2024-06-24 10:43:24 +02:00
akallabeth
66f31e5bb9
[core,gateway] use TcpConnectTimeout for read as well
http_response_recv might never receive an answer, so do wait for input
and fail if the timeout is exceeded.
2024-06-24 10:38:52 +02:00
akallabeth
e3809650bb
[core,keyboard] Prefer FreeRDP_KeyboardCodePage
if FreeRDP_KeyboardCodePage is set use the default keyboard layout for
the codepage instead of the autodetected one.
2024-06-20 10:27:50 +02:00
akallabeth
e03a6a269e
[locale] add functions for locale mapping
* function to map short language strings ("en", ...) to a codepage
* function to get a default keyboard layout for a codepage
* function to list supported codepages
2024-06-20 10:27:43 +02:00
akallabeth
95ed12530f
[core,nego] unify protocol to string
use a generic function to stringify SelectedProtocol and
RequestedProtocols variables.
2024-06-18 20:49:50 +02:00
akallabeth
889dff4f55
[primitives] log initialization 2024-06-18 08:52:28 +02:00
akallabeth
0633623b6d
Merge pull request #10281 from mfleisz/fix/cert-chain-pem
crypto: Fix handling of cert chain in get PEM function
2024-06-17 18:24:16 +02:00
akallabeth
d9473be307
[crypto,base64] force signed char
for lookup force signed char to avoid (unsigned)-1 casts
2024-06-17 17:02:41 +02:00
Martin Fleisz
7368c65240 crypto: Fix handling of cert chain in get PEM function 2024-06-17 14:48:15 +02:00
akallabeth
3cecd1de06
[primitives] refactor, split sse/neon/opencl 2024-06-17 13:15:14 +02:00
akallabeth
eedb5590b2
[primitives,copy] add fallback path
color format conversions that do not have an accelerated implementation
are now handled by generic pixel copy
2024-06-17 09:13:47 +02:00
akallabeth
bcd663b7d9
Merge pull request #10269 from akallabeth/image_copy_sse
Image copy sse
2024-06-12 16:45:57 +02:00
akallabeth
52b6381a73
[core,gateway] filter out empty IPs from JSON 2024-06-11 17:37:35 +02:00
akallabeth
82ce4f2228
[core,arm] Add all RDSTLS IP to TargetNetAddresses 2024-06-11 17:37:33 +02:00
akallabeth
3c70feb943
[core,rdstls] set last error on authentication response 2024-06-11 17:37:30 +02:00
akallabeth
550a3e40c7
[ci,ios] update defaults 2024-06-11 13:26:09 +02:00
akallabeth
311068e605
[primitives] add image copy primitive
* move freerdp_image_copy_no_overlap implementation to primitives
* add SSE4.1 and AVX2 optimizations
2024-06-11 13:26:06 +02:00
akallabeth
2ee987e665
[cmake,codec] refactor codec
* move sse and neon implementations to own subdirectories
* add stubs for missing optimizations (with log messages)
2024-06-11 12:16:20 +02:00
akallabeth
e8cca22d2a [cmake] refactor libfreerdp
* Move codec and primitives to own CMakeLists.txt
* Add freerdp_object_library_add
* add freerdp_compile_options_add
2024-06-11 09:44:05 +02:00
oleg0421
bad6cab2e4 RDPECAM client: h264 interface changes 2024-06-10 14:48:31 +02:00
akallabeth
a5bb0bf203
[primitives] add lShiftC_16s_inplace 2024-06-08 08:34:21 +02:00
akallabeth
dee9019e7c
[codec,progressive] use add_16s_inplace 2024-06-08 08:34:18 +02:00
akallabeth
cd72043811
[primitives,ipp] remove remaining IPP defines 2024-06-08 08:34:15 +02:00
akallabeth
f19098da83
[primitives,prim_add] add new add_16s_inplace 2024-06-08 08:34:11 +02:00
akallabeth
c780210624
[rfx,dwt] cleanup variables 2024-06-08 08:34:06 +02:00
akallabeth
87ee8f5b77
[crypto,base64] use lookup tables 2024-06-08 08:34:02 +02:00
akallabeth
a93658cd06
[crypto,base64] apply INLINE and WINPR_RESTRICT 2024-06-07 12:32:16 +02:00
akallabeth
7aa72a7507
[core,settings] unify configuration paths
* Add new function freerdp_settings_get_config_path to get current
  user configuration directory
* Add CMake option WITH_FULL_CONFIG_PATH (default OFF): If defined, use
  <appdata>/Vendor/Product as config directory, otherwise use
  <appdata>/vendor (lowercase, only if vendor equal to product)
2024-06-06 11:31:22 +02:00
akallabeth
ab3ee12360
Merge pull request #10259 from akallabeth/rdstls-result-code
Rdstls result code
2024-06-05 23:39:30 +02:00
akallabeth
064a58912b
[gdi,gfx] fix gfx dump variables and format string 2024-06-05 23:15:22 +02:00
akallabeth
66e4188514
[core,rdstls] fix result code
the rdstls result codes are specific to rdstls and not shared with
NTSTATUS et al.
2024-06-05 23:13:57 +02:00
Armin Novak
7eeaabad8b
[core,childsession] initialize variables 2024-06-05 15:57:46 +02:00
Armin Novak
036228a294
[core,proxy] fix missing return check 2024-06-05 15:23:53 +02:00
Armin Novak
b9e434be48
[core,peer] check return of setsockopt 2024-06-05 15:23:53 +02:00
akallabeth
1a2374ea0b
Merge pull request #10247 from akallabeth/progressive-speedup
Progressive preallocate workers, inline functions
2024-06-05 11:09:55 +02:00
Armin Novak
8d783d5189
[covertity] fix various warnings 2024-06-05 09:19:59 +02:00
akallabeth
3c2702afd3
[codec,progressive] use preallocated workers
allocate PTP_WORK and PROGRESSIVE_TILE_PROCESS_WORK_PARAM in
PROGRESSIVE_BLOCK_REGION
2024-06-04 18:49:47 +02:00
akallabeth
c07ba558cb
[warnings] fix various compiler warnings 2024-06-04 13:23:24 +02:00
akallabeth
7854c969c1
Merge pull request #10235 from akallabeth/speedup
Speedup
2024-06-04 10:31:32 +02:00
akallabeth
96f68dca74
[codec,color] optimize image copy
provide optimized functions for alpha blending in different color formats
2024-06-04 09:27:20 +02:00
akallabeth
6ad17cac6e
[codec,progressive] restrict keyword 2024-06-03 17:55:35 +02:00
akallabeth
bfffe28de6
[test,codec] speed up copy test
* Reduce default resolution from fullHD to fullHD/10
* Add command line arguments to set width and height manually
2024-06-03 17:55:30 +02:00
akallabeth
ef91d12b3d
[codec,h264] add restrict keyword 2024-06-03 17:55:24 +02:00
akallabeth
4eca9ac7f8
[codec,dsp] restrict keyword 2024-06-03 17:55:22 +02:00
akallabeth
a9e3fb1b33
[codec,color] restrict keyword 2024-06-03 17:55:19 +02:00
akallabeth
fd592b9cf1
[codec,nsc] add INLINE and restrict keywords 2024-06-03 17:55:16 +02:00
akallabeth
49bce0436c
[codec,bulk] restrict keyword 2024-06-03 17:55:08 +02:00
akallabeth
ef5c710f85
[codec,clear] restrict keyword 2024-06-03 17:54:44 +02:00
akallabeth
f5ede1669e
[codec,bitmap] restrict keyword 2024-06-03 17:54:41 +02:00
akallabeth
25e7729cbc
[codec,interleaved] restrict keyword 2024-06-03 17:54:39 +02:00
akallabeth
f34189aaef
[codec,zgfx] restrict and inline keywords 2024-06-03 17:54:35 +02:00
akallabeth
6587ff50d2
[codec,xcrush] restrict keyword 2024-06-03 17:54:32 +02:00
akallabeth
b12e512e08
[codec,planar] restrict keyword 2024-06-03 17:54:29 +02:00
akallabeth
16955111b7
[test,gfx] add gfx dump option 2024-06-03 17:54:24 +02:00
akallabeth
4b93a9fffa
[codec,rfx] inline and restrict 2024-06-03 17:54:21 +02:00
akallabeth
f422ea2e56
[core,gcc] check for channelMaxCount violations 2024-06-03 16:53:31 +02:00
akallabeth
4899cf5c0f
[codec,yuv] use restrict keyword 2024-06-03 14:50:57 +02:00
akallabeth
a69dd9ad36
[sspi,krb] check for empty kdcUrl 2024-06-03 12:28:49 +02:00
Armin Novak
496dcff1cf
[core,codecs] fix API function names
* deprecate codecs_new and codecs_free
* add new freerdp_client_codecs_new and freerdp_client_codecs_free
2024-05-29 14:34:18 +02:00
akallabeth
07acfed668
[codec,color] add freerdp_image_copy test case 2024-05-27 10:00:12 +02:00
akallabeth
e9b5555652
[codec,color] inline functions used internally
for freerdp_image_copy inline all functions that are used to speed up
copying.
2024-05-27 09:52:09 +02:00
akallabeth
5fe0c5f9fc
[codec,color] check for image_copy widht or height 0 2024-05-25 09:17:13 +02:00
akallabeth
53d8e0f203
[crypto,tls] fix missing return 2024-05-25 09:17:06 +02:00
akallabeth
ef4e6ee2c9
[common,settings] add GfxSuspendFrameAck 2024-05-24 11:51:56 +02:00
akallabeth
e253d78053
Merge pull request #10208 from akallabeth/image_copy_improve
Image copy improve, bugfixes
2024-05-24 09:01:00 +02:00
akallabeth
776a7b727f
[core,gcc] clear multitransport
if the client does not send a multitransport capability clear the flags.
2024-05-23 14:48:41 +02:00
akallabeth
ef86df9a26
[crypto,tls] log BIO_do_handshake errors
add proper logging to make details of failures auditable
2024-05-23 14:48:39 +02:00
akallabeth
1b3f3a0408
[codec,color] expose freerdp_image_copy (no)overlap
expose functions for overlapping and non overlapping images to use
directly
2024-05-23 14:48:36 +02:00
akallabeth
1a58e74c17
[codec,color] freerdp_image_copy_no_overlap
use single memcopy if possible to speed up copy
2024-05-23 14:48:33 +02:00
akallabeth
afde527120
[gdi,gfx] unify updatesurfaces calls 2024-05-23 14:26:17 +02:00
David Fort
3147df8486 [core] fix clientInfo with both dynamicTimeZone and reconnect cookie
The ClientInfo packet was wrongly forged when we had dynamic timezone and a
reconnect cookie (reserved fields written twice).
2024-05-23 12:32:10 +02:00
akallabeth
5ca17aa8f3
[core,streamdump] use dynamic logger
* Decrease logging verbosity of streamdump
* Fix namespace of logger
* Use dynamic preallocated logger
2024-05-21 11:41:59 +02:00
akallabeth
8d5c5dc2ef
[core,caps] Allow invalid TS_GENERAL_CAPABILITYSET::protocolVersion
some FreeRDP versions did send an invalid value of 0x0000 instead of the
required 0x200. Log this kind of violation but continue.
2024-05-20 15:13:12 +02:00
akallabeth
470ef43da2
[core,streamdump] implement nodelay
allow records to be played without delay making them faster than
originally recorded
2024-05-17 10:36:22 +02:00
akallabeth
d545509f72
[settings] add TransportDumpReplayNodelay 2024-05-17 10:10:02 +02:00
akallabeth
3ced20ec5b
[core,streamdump] reset stream if packet discarded
* in stream_dump_replay_transport_read function discard previously
  read data if it was discarded.
* stream_dump_register_read_handlers needs to set
  freerdp_io_callback_set_event as otherwise we would block indefinitely
  waiting for the first data read to occur.
2024-05-17 10:04:07 +02:00
Ondrej Holy
9aca06e0b7
[core,gateway] always return in case of error
Currently, the `arm_handle_bad_request` function returns `FALSE` when the
`cJSON_ParseWithLength` function fails to parse the message, but only when
the `cJSON_GetErrorPtr` returns a valid pointer. It would be better to
return regardless of the `cJSON_GetErrorPtr` return value.
2024-05-16 11:56:03 +02:00
akallabeth
8bdf92ca52
[utils] link m library if required 2024-05-14 20:45:38 +02:00
akallabeth
aaded541d9
[core,client] replace cJSON with WinPR wrapper
use the new WinPR JSON wrapper API
2024-05-14 20:45:31 +02:00
akallabeth
1efefceb5c
[core,settings] refactor /network
* add CONNECTION_TYPE_INVALID
* default to CONNECTION_TYPE_AUTODETECT
* allow /network:invalid and /network:0 to disable
2024-05-14 11:18:29 +02:00
akallabeth
a1d8754f1f
[core,autodetect] abort on unexpected message. 2024-05-14 11:07:50 +02:00
Armin Novak
e272eb3966 [warnings] fix Wshadow warnings 2024-05-08 15:30:01 +02:00
Armin Novak
47ac961cb9 [core,settings] initialize DynamicDSTTimeZoneKeyName 2024-05-08 10:08:08 +02:00
akallabeth
ef83633c01 [codec,nsc] length checks in nsc_rle_decompress_data 2024-04-26 09:26:07 +02:00
akallabeth
d5f8b337c4 [codec,nsc] add restrict keyword 2024-04-26 09:26:07 +02:00
Armin Novak
e9bfd585ae [core,capabilities] ensure ImeFileName is '\0' terminated 2024-04-25 10:27:58 +02:00
Armin Novak
e37acf08b5 [core,redirection] free redirection::TargetNetAddresses
during some testcases the packet can be received on already allocated
TargetNetAddresses. So clean up the field before reusing it.
2024-04-25 10:27:58 +02:00
Armin Novak
c909253b11 [core,info] check '\0' termination after length check 2024-04-25 10:27:58 +02:00
Armin Novak
c2e899b6df [core,fuzzer] fix testcases
rdp_recv_save_session_info is a client side only function, remove from
server side tests
2024-04-24 15:55:30 +02:00
Armin Novak
b757276034 [core,redirection] fix reading of TargetNetAddressesCount
read to local variable first, check for validity and only after
allocation update the settings value.
2024-04-24 15:55:30 +02:00
Armin Novak
4ce4a6d3fb [codec,clear] check destination offsets
clear_decompress_subcodecs_data might have inavlid offsets, check if
they fit the destination buffers
2024-04-24 15:55:30 +02:00
akallabeth
3fe9363592 [core,capabilities] abort on invalid protocolVersion
* TS_GENERAL_CAPABILITYSET::protocolVersion must be
  TS_CAPS_PROTOCOLVERSION(0x200) see [MS-RDPBCGR] 2.2.7.1.1
  General Capability Set (TS_GENERAL_CAPABILITYSET)
* Default value of FreeRDP_CapsProtocolVersion must be
  TS_CAPS_PROTOCOLVERSION(0x200)
2024-04-23 17:13:13 +02:00
Мартынов Максим Сергеевич
890d87f81a Fix protocolVersion capability reset 2024-04-23 16:03:30 +02:00
akallabeth
fc21b82880 [core,timezone] initialize ClientTimeZone early
Initialize ClientTimeZone in freerdp_settings_new to allow replacing the
default later on in command line parser or client connection callbacks
2024-04-23 09:54:52 +02:00
akallabeth
1d6460c5f7 [core,redirection] add sanity check for TargetNetAddress
Abort on implausible TargetNetAddressLength values. (check remaining
data length to determine that)
2024-04-23 09:40:36 +02:00
akallabeth
449e8b82f1 [core,capabilities] check TS_BITMAPCACHE_CAPABILITYSET_REV2
Check value of TS_BITMAPCACHE_CAPABILITYSET_REV2::numCellCaches for out
of range.
2024-04-23 09:40:36 +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
8b616f4fad [core,capabilities] ensure destination array exists
ensure the destination array in rdpSettings is large enough to hold the
copy.
2024-04-22 17:41:46 +02:00
akallabeth
703808591e [ci,fuzzer] split fastpath tests
use dedicated server and client context to test the functions
2024-04-22 11:02:04 +02:00
akallabeth
5b4e39fd7e [core,orders] shift unsigned value
The delta value read is signed, but the operations are done on an
unsigned.
2024-04-22 11:02:04 +02:00
akallabeth
cb15c1c78a [core,update] fix missing plausibility check
abort parsing of cache brush if not enough data is available.
2024-04-22 11:02:04 +02:00
akallabeth
626d10a94a [core,redirection] fix length of redirection strings
length field is in bytes, when converting from UCS-2 use size in WCHAR
2024-04-22 11:02:04 +02:00
akallabeth
a6320dc6b7 [ci,fuzzer] run read functions as client and server 2024-04-22 09:30:36 +02:00
akallabeth
71e463e31b [core,info] fix missing check in rdp_write_logon_info_v1 2024-04-21 14:28:24 +02:00
akallabeth
48013d75fc [core,test] add fuzzer for receive functions 2024-04-21 14:28:24 +02:00
akallabeth
a95426e7c4 [core,update] return if gdi is NULL 2024-04-21 14:28:24 +02:00
akallabeth
db09d1d7f8 [core,update] fix leak on error termination 2024-04-21 14:28:24 +02:00
akallabeth
7f9c5d84ad [core,peer] assert size of peer context 2024-04-21 14:28:24 +02:00
akallabeth
6430945ce0 [codec,color] fix out of bound read 2024-04-21 11:00:47 +02:00
akallabeth
5e5d27cf31 [codec,zgfx] allocate in segment steps
do not trust the uncompressedSize of a ZGFX_SEGMENTED_MULTIPART and
allocate the output buffer in steps after decoding a segment.
2024-04-20 21:20:44 +02:00
akallabeth
9314b5492b [codec,clear] use size_t types for sizes 2024-04-20 21:20:44 +02:00
akallabeth
0ca4973a67 [codec,clear] vBarShortEntry count check 2024-04-20 21:20:44 +02:00
akallabeth
b88c767603 [codec,color] use ssize_t/SSIZE_T for indices 2024-04-20 21:20:44 +02:00
akallabeth
1a755d898d [codec,interleaved] fix offset error 2024-04-20 21:20:44 +02:00
akallabeth
0b4db55707 [codec,nsc] check for valid ColorLossLevel 2024-04-20 21:20:44 +02:00
akallabeth
8779ebf8d4 [ci,oss-fuzz] run all codec tests 2024-04-19 11:26:47 +02:00
akallabeth
a1c373314e [codec,interleaved] fix bounds checks 2024-04-19 11:26:47 +02:00
akallabeth
b1f11bd8a4 [codec,progressive] move update to frame change 2024-04-19 09:49:02 +02:00
akallabeth
41dd15c5e8 [codec,progressive] revert 4e24b966c8
do not reset progressive surface numUpdatedTiles after
progressive_decompress pass. The updates might accumulate until the
frameId changes, only then reset.
2024-04-19 09:49:02 +02:00
akallabeth
71e78bedd7 [warnings] fixed sign and const
* fix various char/BYTE sign warnings
* fix various const warnings
* fix format string size_t
* remove unused CMake variables
2024-04-18 11:05:58 +02:00
Armin Novak
14286904e1 [tests] fix mismatched allocation function 2024-04-17 18:47:16 +02:00
Armin Novak
28e9094f08 [gcc] fix missing malloc warning macros
* Add missing WINPR_ATTR_MALLOC
* Add missing WINPR_PRAGMA_DIAG_IGNORED_MISMATCHED_DEALLOC
2024-04-17 18:47:16 +02:00
akallabeth
9d7c98f4d0 [codec,ncrush] fix index out of bound check 2024-04-16 21:20:04 +02:00
akallabeth
b7888e9b3b [codec,ncrush] fix bounds checks 2024-04-16 20:29:45 +02:00
akallabeth
f3b2aea781 [cmake] add fuzzer tests
tests imported from https://github.com/ergnoorr/fuzzrdp

reported by Evgeny Legerov of Kaspersky Lab.
2024-04-16 13:06:22 +02:00
akallabeth
0a0df77c39 [build,ipp] drop support for IPP
Intel Performance Primitives do not have a test setup in FreeRDP and
most likely no longer compile.
2024-04-16 12:44:38 +02:00
akallabeth
ecfafe4ad0 [codec,interleaved] fix off by one length check 2024-04-16 11:25:27 +02:00
akallabeth
91a1535f88 [codec,ncrush] fix missing input length check 2024-04-16 11:25:27 +02:00
akallabeth
9da3f23698 [codec,planar] fix missing input length checks 2024-04-16 11:25:27 +02:00
akallabeth
1208f23bc9 [codec,clear] fix integer overflow
reorder check to prevent possible integer overflow
2024-04-16 11:25:27 +02:00
akallabeth
d58cbc96ac [codec,nsc] fix missing check
in nsc_rle_decode abort if there are more bytes to be read then there
are left.
2024-04-16 11:25:27 +02:00
Armin Novak
aa3d05f4f2 [coverity] 1543233 Unintended sign extension 2024-04-15 11:30:31 +02:00
Armin Novak
09f679da61 [coverity] 1543075 Explicit null dereferenced 2024-04-15 11:30:31 +02:00
akallabeth
0c9fb50170 [coverity] fix unchecked return 2024-04-12 13:30:35 +02:00
akallabeth
f264cc729c [coverity] 1543240 Dereference before null check 2024-04-12 12:41:42 +02:00
akallabeth
be4fb7f6dd [coverity] 1543187 Dereference before null check 2024-04-12 12:41:42 +02:00
akallabeth
600c7a8999 [coverity] 1543080 Dereference before null check 2024-04-12 12:41:42 +02:00
akallabeth
d18585b8cc [coverity] 1543058 Dereference before null check 2024-04-12 12:41:42 +02:00
akallabeth
f81ff8c495 [coverity] 1543141 Dereference null return value 2024-04-12 12:41:42 +02:00
akallabeth
7bf76ab67f [coverity] 1543039 Use of 32-bit time_t 2024-04-12 12:41:42 +02:00
akallabeth
f0cc78fe1a [coverity] 1047683 Unchecked return value from library 2024-04-12 12:41:42 +02:00
akallabeth
1466d70dbc [coverity] null checks 2024-04-12 09:45:09 +02:00
akallabeth
2477b37128 [warnings,types] fix BOOL assingments 2024-04-12 09:45:09 +02:00
akallabeth
5862537471 [coverity] 1543139 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
dc488c5e23 [coverity] 1543148 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
70eec6c18e [coverity] 1543279 Out-of-bounds read 2024-04-12 09:45:09 +02:00
akallabeth
501b86baf4 [coverity] 1543153 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
6241ce5674 [coverity] 1543052 Out-of-bounds read 2024-04-12 09:45:09 +02:00
akallabeth
285bea320d [coverity] 1543217 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
8d9244cb3d [coverity] 1543259 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
d3eb93f2ec [coverity] 1543248 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
cf5df96c14 [coverity] 1543228 Out-of-bounds read 2024-04-12 09:45:09 +02:00
akallabeth
da85ec371c [coverity] 1543065 Resource leak 2024-04-12 09:45:09 +02:00
akallabeth
18b4c59d17 [coverity] 1543107 Resource leak 2024-04-11 12:04:07 +02:00
akallabeth
2fefc29249 [coverity] 1543164 Free of address-of expression 2024-04-11 12:04:07 +02:00
akallabeth
1affbd0655 [coverity] 1543285 Resource leak 2024-04-11 12:04:07 +02:00
akallabeth
1e325dc2de [core,settings] add missing autoreconnect option
Split settings, there was a double use for AutoReconnectEnabled.
AutoReconnectEnabled is a setting responsible for client side
autoreconnection.
AutoReconnectPacketSupported is a flag set by the server to announce
support for AutoReconnectPacket allowing fast reconnect.
2024-04-11 11:19:18 +02:00
Ilya Shipitsin
1f3a49c57a libfreerdp/utils/http.c: fix resource leak
found by coverity

128                if (winpr_asprintf(&headers, &size, post_header_fmt, path, hostname, blen) < 0)

CID 424888: (#1 of 1): Resource leak (RESOURCE_LEAK)
15. leaked_storage: Variable hostname going out of scope leaks the storage it points to.
129                        return FALSE;
130        }
2024-04-08 11:39:20 +02:00
akallabeth
0905796cd7 [core,gateway[ fix use after free 2024-04-06 09:17:17 +02:00
Ilya Shipitsin
25edec803b libfreerdp/crypto/certificate.c: handle malloc error 2024-04-06 07:11:14 +02:00
Armin Novak
8b2e13d989 [emu,scard] abort busy loop on session cancel 2024-04-05 13:06:57 +02:00
Ilya Shipitsin
309509808c libfreerdp/core/gateway/rdg.c: handle malloc failure 2024-04-05 09:59:12 +02:00
Armin Novak
1b7e0ffb97 [core,smartcard] allow userhint to match UPN
the username might match the UPN of the smartcard certificate. If not
fall back to compare to userHint
2024-04-04 14:05:39 +02:00
Armin Novak
e5799ec947 [locale,xkbfile] improve mapping
* Add missing keycodes to mapping
* Use sorted list to create mapping table
2024-04-03 08:22:25 +02:00
akallabeth
82dc655979 [core,gateway] improve warning for bad request
In case of E_PROXY_ORCHESTRATION_LB_SESSIONHOST_DEALLOCATED print a
warning with the message body or a generic fallback should that not be
provided.
2024-03-26 09:19:45 +01:00
akallabeth
31a131b9e4 [crypto,cert] follow up to #10002
Ensure we always compare the lowercase hostname when looking for a
stored certificate or calculating a hash.
2024-03-21 15:07:58 +01:00
akallabeth
f98d0dd60a [crypto,cert] allow NULL certificate
If a certificate can not be read and is NULL return NULL for all queries
on that NULL certificate. Fixes #10002
2024-03-21 14:26:37 +01:00
akallabeth
b596ad0d45 [common,settings] accept 'on|off' as bool settings 2024-03-21 14:26:14 +01:00
akallabeth
678ff144ab [cmake] unify windows resource file generation
* use a macro to add resource files for executables and shared libraries
* use that macro to declare targets
* use that macro to set library/binary versioning
* use that macro to set target output name
* use a macro to create manpages and names
2024-03-20 11:17:18 +01:00
akallabeth
f4b7c59915 [cmake] move platform defines to common include
* Move platform specific settings to a common CMake include
2024-03-20 09:11:08 +01:00
akallabeth
0106d34636 [core,gatewya] fix function argument type 2024-03-20 08:39:15 +01:00
akallabeth
67eb2fce54 [core,gateway] respect abortEvent
in RDG read functions check for rdpContext::abortEvent and terminate
blocking functions if set.
2024-03-20 08:39:15 +01:00
David Fort
64b42be79e [win32,chilsession] fix path computation in 32 bits
The path was not adjusted correctly (wrong WCHAR pointer computation).
2024-03-19 10:18:28 +01:00
Kai Pastor
c8c70ad730 Don't remove duplicate link libs 2024-03-19 08:33:54 +01:00
akallabeth
bcf189b6b3 [codec,rfx] explicitly cast return
cast to avoid compilation issues with incompatible-pointer-types
2024-03-18 13:27:32 +01:00
akallabeth
01aef769d6 [core,license] fix incompatible WCHAR pointer 2024-03-18 13:27:32 +01:00
akallabeth
3bba61bdf4 [utils,encoded_types] fix read/write, add limits
* fix read and write limits of four byte signed integers
* add definitions for value range MIN and MAX
2024-03-18 08:41:17 +01:00
akallabeth
d919a9e8e7 [utils,test] add TestEncodedTypes 2024-03-18 08:41:17 +01:00
akallabeth
c591c2cd26 [pkg-config] add private optional link libraries 2024-03-14 10:35:03 +01:00
Kai Pastor
9a00f1ed4d Add Requires.private for libcjson and zlib 2024-03-14 10:13:14 +01:00
Kai Pastor
d6fcacd47a Add find_dependency for link lib targets 2024-03-14 10:13:14 +01:00
akallabeth
70a8b185be [core,gateway] log http response status & reason
only log headers with debug level and body with trace level.
normal operation does not require this information and will flood the
console.
2024-03-12 17:07:37 +01:00
akallabeth
e31acc048e [core,client] prevent double channel close
reset clientDataCount on close.
2024-03-12 14:24:36 +01:00
akallabeth
2dd80b1e80 [utils] implement write 4byte types
* freerdp_write_four_byte_signed_integer
* freerdp_write_four_byte_float
2024-03-11 13:22:12 +01:00
akallabeth
fd46a43934 [core,update] reset invalid regions after BeginPaint
Do not touch invalid regions before BeginPaint was called. This fixes
issue #9953 as the sdl client is waiting in BeginPaint for the screen
updates of EndPaint to be actually drawn.
2024-03-11 12:15:52 +01:00
David Fort
a4cc020b75 [win32,childsession] Fix invalid pipe path with 32 bits builds
When compiled as x86 (32 bits) the path returned by WinStationCreateChildSessionTransport
is sometime missing the beginning of the pipe path.
2024-03-11 11:24:24 +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
David Fort
b5713c46a7 [win32] various fix for childSession
WAIT_TIMEOUT was not correctly handled in non blocking mode. Also there was a
segfault when freeing the transport (double free).
2024-03-09 11:29:08 +01:00
akallabeth
37792c0a37 [ci,primitives] enable NEON on iOS builds
* Enable WITH_NEON=ON for iOS builds
* Fix a undeclared variable issue with NEON builds
2024-03-08 14:10:53 +01:00
akallabeth
ef8c9e48e8 [core,utils] unify channel reloading
Add the wrapper function utils_reload_channels that unifies the channel
cleanup and channel initialization sequence required on connect,
redirect and gateway policy apply
2024-03-07 16:18:41 +01:00
akallabeth
93eb4df524 [core,gateway] implement RDG and TSG policy
* use dynamic logger in RDG
* honor [MS-TSGU] 2.2.9.2.1.5.2 TSG_REDIRECTION_FLAGS
* honor [MS-TSGU] 2.2.10.16 HTTP_TUNNEL_AUTH_RESPONSE
  HTTP_TUNNEL_AUTH_RESPONSE_FIELD_REDIR_FLAGS flag
* add setting GatewayIgnoreRedirectionPolicy to ignore the gateway
  policy if desired
2024-03-07 16:18:41 +01:00
akallabeth
6a7c375831 [crypto,cert] add better logging of certificate read
add missing log entries for possible failures due to invalid data
received. This allows better debugging if a server sends garbage or the
crypto routines have direct RSA routine access disabled.
2024-03-07 14:59:32 +01:00
akallabeth
3b108f1839 [core,proxy] ignore empty variable
fixes #9928: ignore a defined but empty proxy environment variable
2024-03-04 14:28:38 +01:00
David Fort
aebe9742e0 [client,win32] Child session fixes
It seems like WaitFor[Single|Multiple]Object calls aren't reliable on pipes, especially
on the pipe opened for childSession access. The object can be marked as signaled even if
no data is available, making the connection laggy and unresponsive (nearly unusable in some
cases).
This patch works around that by using ReadFileEx() with overlapped instead of simple
ReadFile() and use asynchronous reads.
2024-03-01 09:46:53 +01:00
akallabeth
9a7d30d174 [clang,tidy] fix a few warnings 2024-02-27 14:15:43 +01:00
amazingfate
e21afefb86 fix build with openssl < 1.1.1 2024-02-23 12:45:36 +01:00
akallabeth
4b2d877bf3 [core,transport] document and fix transport_attach
* [transport_default_attach] Only attach provided socket once the
  function can no longer fail
* [transport_attach] document behaviour
2024-02-23 11:02:06 +01:00
Rubycat
3c2c6cc1d5 don't close freerdp_peer underlying socket twice
freerdp_peer->Disconnect calls BIO_free which then calls close on the
underlying file descriptor.

Then when freerdp_peer_free is called, the file descriptor is closed
again.

This is problematic if the file descriptor is recycled in between:

thread 1: freerdp_peer_new(42);
thread 1: freerdp_peer->Disconnect() closes 42
thread 2: opens a file with fd 42
thread 1: freerdp_peer_free closes 42
thread 2: uses closed file descriptor 42
2024-02-23 11:02:06 +01:00
akallabeth
05175d70f0 [tests,gdi] skip failing test cases 2024-02-22 12:31:50 +01:00
akallabeth
acedd305d3 fixed unused-but-set-variable warnings 2024-02-22 12:31:50 +01:00
akallabeth
05e555feb7 fixed unused-variable warnings 2024-02-22 12:31:50 +01:00
akallabeth
43eae6029f [clang-tidy] fix various review warnings 2024-02-22 12:31:50 +01:00
akallabeth
42cfe9bf1a [cmake,test] deactivate TestGdiLine
The test is broken (and has been for a long time), deactivate it.
2024-02-22 12:31:50 +01:00
akallabeth
d7ebec5a65 [tidy] move loop variable declaration to loop 2024-02-22 12:31:50 +01:00
akallabeth
d76fcd2364 [primitives,opencl] fix alpha handling 2024-02-19 12:29:37 +01:00
akallabeth
1a42cf4f26 [tests,primitives] make error message more verbose 2024-02-19 12:29:37 +01:00
akallabeth
e8194a8fa3 [primitives,opencl] fix warnings 2024-02-19 12:29:37 +01:00
akallabeth
b894199f72 [winpr,collections] add generic string clone functions
The ArrayList, HashTable, ... New functions require
void* (*fkt)(const void* ptr) type functions. Provide a generic wrapper
for CHAR and WCHAR strdup to eliminate warnings. Also export a
corresponding free function to avoid issues with runtime
differences.
2024-02-15 11:49:16 +01:00
akallabeth
d0dc657412 [build] delete unused static functions 2024-02-15 11:49:16 +01:00
akallabeth
0e44b2c674 [clang-tidy] clang-analyzer-unix.Malloc 2024-02-15 11:49:16 +01:00
akallabeth
b8598728a6 [clang-tidy] clang-analyzer-core.uninitialized.Assign 2024-02-15 11:49:16 +01:00
akallabeth
81d2c1f057 [clang-tidy] clang-analyzer-core.NullDereference 2024-02-15 11:49:16 +01:00
akallabeth
f69e1fe697 [clang-tidy] readability-duplicate-include 2024-02-15 11:49:16 +01:00
akallabeth
0ba995655d [clang-tidy] cppcoreguidelines-init-variables 2024-02-15 11:49:16 +01:00
akallabeth
207def5c56 [clang-tidy] readability-isolate-declaration 2024-02-15 11:49:16 +01:00
Martin Fleisz
2e5d4fbe06 gateway: Do not fail if unprocessed padding bytes are detected
Sometimes the RPC PDUs have unprocessed data (padding bytes) at their
end. In that case do not fail but just log a warning with the correct
amount of remaining bytes.
2024-02-14 16:25:41 +01:00
akallabeth
db8682648b Revert "[codec] encode messages considering endianness"
This reverts commit 6ba4aad9ab.
2024-02-09 10:29:08 +01:00
akallabeth
9a51830434 [codec,jpeg] use winpr image for jpeg 2024-02-07 10:04:08 +01:00
David Benjamin
72bc3578a0 clang-format 2024-02-07 07:53:37 +01:00
David Benjamin
7548be62c3 Support RSA-PSS certificates in x509_utils_get_signature_alg
RSA-PSS in X.509 is truly horrible, and OpenSSL does not expose very good APIs
to extract this, even though the library does handle it internally. Instead, we
must tediously unwrap RFC 4055's unnecessarily complicated encoding of
RFC 8017's unnecessarily flexible RSA-PSS definition.
2024-02-07 07:53:37 +01:00
David Benjamin
f987e304ee Add some tests for x509_utils_get_signature_alg
Temporarily disable the RSA-PSS tests for now, but this is enough for a
regression test for the previous issue.
2024-02-07 07:53:37 +01:00
David Benjamin
bee7f94e93 [crypto,x509] fix tls-server-end-point signature algorithm selection
This reverts commit 00baf58a71. That
change appears to have been incorrect. It's described as simplying
retrieving the "default signature digest", but it actually changed the
function's behavior entirely. The function wasn't retrieving defaults
previously.

A certificate contains, among other things, a public key and a
signature. The public key is the public key of the subject. However, the
signature was generated by the issuer. That is, if I get a certificate
from a CA, the public key will be my public key and the signature will
be my CA's signature over the certificate contents.

Now, the original code returned the digest used in the certificate's
signature. That is, it tells you which signature algorithm did my *CA*
use to sign my certificate.

The new code extracts the certificate's public key (my public key, not
the CA's). This doesn't necessarily tell you the signature algorithm, so
it then asks OpenSSL what the "default" signature algorithm would it use
with the key. This notion of "default" is ad-hoc and has changed over
time with OpenSSL releases. It doesn't correspond to any particular
protocol semantics. It's not necessarily the signature algorithm of the
certificate.

Now, looking at where this function is used, it's called by
freerdp_certificate_get_signature_alg, which is called by
tls_get_channel_binding to compute the tls-server-end-point channel
binding. That code cites RFC 5929, which discusses picking the hash
algorithm based on the certificate's signatureAlgorithm:

https://www.rfc-editor.org/rfc/rfc5929#section-4.1

That is, the old version of the code was correct and the
"simplification" broke it. Revert this and restore the original version.

I suspect this went unnoticed because, almost all the time, both the old
and new code picked SHA-256 and it was fine. But if the certificate was,
say, signed with SHA-384, the new code would compute the wrong channel
binding.
2024-02-07 07:53:37 +01:00
akallabeth
2fffcd64b9 [winpr] use winpr_strerror instead of strerror
use the wrapper from WinPR to use the best implementation available.
2024-02-06 15:45:47 +01:00
akallabeth
ba8cf8cf21 [build] fix Wmismatched-deallocator warnings
With custom malloc function attributes the fail path in the _New
functions produces warnings due to allocator mismatches. Silence them.
2024-02-05 08:16:55 +01:00
Isaac Klein
763462d0a9 include null byte in Authorization Request PDU
The RDS AAD Auth PDUs have no packet headers to indicate length.
Instead, these packets are zero-terminated strings. Somehow, Windows
accepts Authentication Request PDUs without a terminating null byte
during regular connections, but not through WVD websocket gateways.
2024-02-04 13:00:48 +01:00
akallabeth
bb42d425ed [gcc,clang] add support for attribute(malloc)
Mark all malloc like functions and add their appropriate free function
to let the compiler complain on mismatches
2024-02-02 15:10:40 +01:00
Vic Lee
5559e59f40 [channels] Add synchronous static channel setting. 2024-02-01 15:06:23 +01:00
akallabeth
e067e9dc6d [core,peer] fix typo 2024-01-29 11:52:22 +01:00
akallabeth
2cd64ba424 [cmake] fallback cJSON detection 2024-01-29 09:34:59 +01:00
akallabeth
cefe847683 [core,gateway] use FREERDP_USER_AGENT define
Define FREERDP_USER_AGENT in version.h to be used by gateway http user
agent
2024-01-29 08:46:29 +01:00
Vic Lee
f2794daf38 [core,transport] make blocking mode available to transport IO interface. 2024-01-22 12:57:01 +01:00