Commit Graph

5021 Commits

Author SHA1 Message Date
akallabeth
275741cc75 [core,utils] add drdynvc stringification functions 2023-01-12 22:54:25 +01:00
Armin Novak
8b9b2db44b [winpr] use winpr_fopen 2023-01-12 22:54:25 +01:00
akallabeth
82ba9ede9c [freerdp] use FREERDP_/UWAC_/RDTK_ prefix for conditional headers 2023-01-10 17:38:00 +01:00
akallabeth
2479ebd816 Fixed compiler warnings 2023-01-10 17:38:00 +01:00
Armin Novak
b0c924a98e [core,cache] fixed default pointer and bitmap new
do not overwrite pointer or bitmap data in New callback
2023-01-10 17:38:00 +01:00
Armin Novak
f1e7cc0d48 [rdpdr] unify header read/write 2023-01-10 11:49:38 +01:00
Armin Novak
58c4517700 [rdpdr] improved debug log 2023-01-10 11:49:38 +01:00
Armin Novak
15ebdd750f [gdi] use solid fill alpha if surface has alpha 2023-01-10 11:49:02 +01:00
Armin Novak
40a309a5b9 [codec] keep alpha plane
some codecs do not support an alpha channel. keep the destination alpha
value for these as the alpha data can be set using alpha codec
separately.
2023-01-10 11:49:02 +01:00
Armin Novak
78eb6ce3a8 [codec] add flag for freerdp_image_copy
Add FREERDP_KEEP_DST_ALPHA to copy and keep the destination alpha value
2023-01-10 11:49:02 +01:00
Pascal Nowack
8d02a07974 core/server: Ignore data PDUs for DVCs that were not opened successfully
When a FreeRDP-based server tried to open a DVC, but the client answered
the DVC create request with a negative CreationStatus in the DVC create
response PDU, the server can then assume that no actual PDUs can be
received for that channel.
However, as long as the channel handle exists, FreeRDP happily forwards
any potential PDU for that handle disregarding the CreationStatus.
This is problematic, since the channel handling usually runs in its own
thread and as a result, the channel may not be destructed yet, when
receiving such stray PDU.
The PDU may be processed, even though it is not expected to be.

A situation, where this becomes problematic is the AUDIO_PLAYBACK_DVC
channel.
It may be the case, that the client answered the DVC create request
with a negative result, the server may try to close the handle and open
the static channel (RDPSND) instead, but before the server can close the
channel handle, the client actually sends PDUs regarding the format
negotiation.
In this case, the server may unintentionally already set things up,
which was not desired (the DVC is about to be closed anyway).

While this specific situation is hypothetical, since it would depend on
a malicious client, it is still possible to happen, especially since the
server implementation does not invoke the format negotiation, but
FreeRDP does it automatically, as soon as the DVC create request is
sent.

Fix this issue by discarding any data PDUs (DYNVC_DATA_FIRST and
DYNVC_DATA) of channels, that were not opened successfully.
2022-12-31 10:14:17 +01:00
David Fort
9e3bc8e3af wtsapi: add new kind of query to retrieve the open status 2022-12-27 11:02:29 +01:00
David Fort
73495a1576 core: unify function behaviour of WTSVirtualChannelQuery
With all calls when WTSVirtualChannelQuery returns FALSE that means that
no ppBuffer was allocated, that was not the case with class=WTSVirtualChannelReady.
Most callers were not aware of that, leading to leaks for example when the channel is
not available client-side, the patch changes that so that you have to call call WTSFreeMemory
only if WTSVirtualChannelQuery returned TRUE.
2022-12-27 11:02:29 +01:00
David Fort
bee2873b52 core: in connection.c use constant instead of raw value 2022-12-23 08:42:45 +01:00
David Fort
07d9baad6d crypto: export getSslMethod utility function 2022-12-23 08:42:45 +01:00
Armin Novak
e2b5f41b2c [settings] regenerated getter with updated script 2022-12-22 18:50:05 +01:00
Armin Novak
37454c7420 [utils] improve rdpdr packet dump 2022-12-22 15:09:03 +01:00
Armin Novak
c11f47db89 [server,shadow] do treat deactivate/reactivate
if a resolution change is required, run postconnect just as if it was
successful.
2022-12-22 15:09:03 +01:00
Armin Novak
0e25f99602 Revert "[server,shadow] rdp_server_reactivate do not wait"
This reverts commit 34f44ce4a1.
2022-12-22 15:09:03 +01:00
David Fort
b283daafd7 tls: cleanup and add some methods to do handshakes asynchronously
This patch does a few cleanups to allow creating TLS and DTLS contexts.
It also introduces tls_accept_ex and tls_connect_ex that can start the SSL handshake,
and it can be finished by calling tls_handshake
2022-12-19 10:46:06 +01:00
Armin Novak
34f44ce4a1 [server,shadow] rdp_server_reactivate do not wait
in rdp_server_reactivate do not wait for the server to change state, let
the peer state machine handle that.
2022-12-19 10:38:18 +01:00
akallabeth
06c070fc4d [gfx] moved rdpgfx_get_codec_id_string to utils
the gfx related stringify helpers are nice to have outside the channel
too so that meaningful logmessages can be written.
2022-12-18 15:14:30 +01:00
akallabeth
59e644ea2e [core] add state_run_continue function
this function is a helper to evaluate a state_run_t for repeated state
transition
2022-12-18 15:14:30 +01:00
akallabeth
b5e2c2a81d [settings] added stringify function for RDPDR_RTYP_* 2022-12-15 14:57:29 +01:00
Armin Novak
a8d3693b27 [core,credssp] fix conversion from unicode
there was a mixup in the conversion and WCHAR was treated as utf8.
2022-12-15 14:57:29 +01:00
Martin Fleisz
103c0a983c core: Fix handling of alternate shell if set to an empty string
In case alternate shell was set to an empty string ("") the old code
would try to convert it to a WChar string. This resulted in a NULL
pointer being returned by `ConvertUtf8ToWCharAlloc` that was interpreted
as an error and the connection failed.
2022-12-15 11:56:05 +01:00
Bernhard Miklautz
e530999156 new [tls/server]: disable client side renegotiation 2022-12-15 11:06:19 +01:00
Armin Novak
74f273e593 [core,info] improve rdp_read_info_null_string
* Removed comments with invalid assumptions
* Added arguments to rdp_read_info_null_string to indicate if the string
  is expected to be '\0' terminated and what is actually read for error
  logs
2022-12-14 11:52:00 +01:00
Armin Novak
0a7d19ee7a [core,info] 0 check cbClientAddress and cbClientDir
if one of the above values is 0 do not add the size for the '\0'
2022-12-14 11:52:00 +01:00
Armin Novak
87ae9dec0d [core,info] ensure stream length
ensure the stream is large enough for all info packets
2022-12-14 11:52:00 +01:00
Armin Novak
8af5f15769 [core,info] enforce cbClientDir limits
the cbClientDir field limits defined in [MS-RDPBCGR] 2.2.1.11.1.1.1
Extended Info Packet (TS_EXTENDED_INFO_PACKET) are now properly enforced.
2022-12-14 10:30:36 +01:00
Armin Novak
0da0f5ca54 [core,info] enforce extended info limits
the cbClientAddress field limits defined in [MS-RDPBCGR]
2.2.1.11.1.1.1 Extended Info Packet (TS_EXTENDED_INFO_PACKET) are now
properly enforced.
2022-12-14 10:30:36 +01:00
David Fort
a1febe11f0 multi-transport: refactor multi-transport handling
Prepare the parts of the code that handle multi-transport to really establish
UDP connections and manage alternative transports.
2022-12-13 15:54:33 +01:00
David Fort
67e1c2dccd gcc: fix handling of multi-transport flags
Multi-transport flags must be merged between local and remote so that on both sides
we know the shared parameters. Also this patch sends multi-transport GCC block when
multi-transport is enabled.
2022-12-13 15:54:33 +01:00
akallabeth
d399c1c6fb [codec,xcrush] follow up to #8529
There was still an issue left, if diff == 0 then the loop counter did
never increment.
Skip this case now completely as the memory does not need to be copied
anyway.
2022-12-13 15:41:58 +01:00
Armin Novak
f5724c0c13 [core,input] Fixed API for KBD_FLAGS_DOWN use
KBD_FLAGS_DOWN indicates a key repeat, so it must be absent on first
keypress.
2022-12-13 14:37:05 +01:00
akallabeth
f67a7aa16a [build] added WITH_DEBUG_CODECS
A new build option to enable more verbose logging in some video codecs.
2022-12-13 13:38:25 +01:00
akallabeth
d27972518f [codec,interleaved] move length check out of loop 2022-12-13 13:38:25 +01:00
Armin Novak
6f6353d76f [codec,interleaved] add codec debug log 2022-12-13 13:38:25 +01:00
Armin Novak
1428b73490 [codec,interleaved] refactored run length reading 2022-12-13 13:38:25 +01:00
Armin Novak
0dc5c94476 [codec,interleaved] added string helper functions 2022-12-13 13:38:25 +01:00
Armin Novak
2648257caa [codec,interleaved] add proper debug logging
log reason for decoder to fail
2022-12-13 13:38:25 +01:00
Armin Novak
b14bdd4501 [gdi] Add failure logging in gdi_Bitmap_Decompress 2022-12-13 13:38:25 +01:00
Armin Novak
7c5e953a44 [gdi] log bitmap update failure reasons 2022-12-13 13:38:25 +01:00
akallabeth
549aad655a [codec,xcrush] fix possible div by zero
If source and destination buffers are equal the calculation of
'rest = num % div' is a division by zero. Avoid that by checking
explicitly for that condition.
2022-12-13 13:37:54 +01:00
akallabeth
adb3b22609 Revert "fix xcrush-divideByZero (when src ==dst)"
This reverts commit 85e830d16f.
2022-12-13 13:37:54 +01:00
Armin Novak
b41ef0cda7 [core,client] fixed connection timeout abort
the abort condidion was not properly triggered.
2022-12-12 18:08:42 +01:00
akallabeth
37ab25e19d Fixed all Wdocumentation warnings 2022-12-12 14:24:55 +01:00
Armin Novak
8200536285 [core,gcc] use mcs_get_settings, make const correct
Use a common helper function to get (const correct) settings from rdpMcs
2022-12-12 13:33:47 +01:00
Armin Novak
917e392f1e [client] fix connection active checks
* use freerdp_is_active_state for session active checks
* fix state transitions
2022-12-12 12:59:32 +01:00