Commit Graph

90 Commits

Author SHA1 Message Date
Armin Novak
a4c6b36a19 [build] fix memory sanitizer stack frame warnings 2023-06-07 09:14:45 +02:00
Pascal Nowack
264d19765c core/server: Use correct size for DVC data PDUs
The VirtualChannelChunkSize setting refers to the VCChunkSize for static
channels and not to the maximum size for DVC data PDUs.
DVC data PDUs are according to [MS-RDPEDYC] always limited to 1600
Bytes.
2023-05-02 09:51:40 +02:00
akallabeth
ee07a13130 [cleanup] fix compiler warnings 2023-01-26 09:30:17 +01:00
Armin Novak
641022b795 [logging] remove __FUNCTION__ from actual message
prefer the log formatter to provide that information.
2023-01-25 16:26:39 +01:00
akallabeth
275741cc75 [core,utils] add drdynvc stringification functions 2023-01-12 22:54:25 +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
Armin Novak
0a8eaf753e Fixed -Wunused-but-set-variable 2022-11-21 10:12:31 +01:00
Armin Novak
dacebc62a3 Use Stream_CheckAndLogRequiredLength, fix WLog TAG
* Log stream length requirement violations
* Use proper defines for WLog tags
2022-11-21 09:57:27 +01:00
Armin Novak
b706676d1a [server] Store channel name for later use 2022-10-13 13:57:11 +02:00
akallabeth
40723606e4 Exposed WTSVirtualChannelManagerOpen 2022-06-23 14:19:50 +02:00
akallabeth
bc8b4ade1c reformatted 2022-06-23 08:48:39 +02:00
Pascal Nowack
bc111b04d3 core/server: Add APIs to get notified of DVC creation statuses
This allows server implementations to add handling for situations,
where the client side does not support them.
Particularly useful for the audio output channels (static channel as
fallback, when dynamic channel is not supported).
2022-06-08 09:30:30 +02:00
Richard Dymond
e1610a7524 Add WTSChannelGetOptions 2022-06-02 14:12:12 +02:00
akallabeth
340f9dd775 Fixed conditional warnings 2022-04-28 12:37:19 +02:00
akallabeth
ec699f6c75 scanbuild fixes 2022-04-28 12:37:19 +02:00
akallabeth
73cdcdfe09
Logging and parser fixes (#7796)
* Fixed remdesk settings pointer

* Fixed sign warnings in display_write_monitor_layout_pdu

* Use freerdp_abort_connect_context and freerdp_shall_disconnect_context

* Added and updates settings

* info assert/dynamic timezone

* mcs assert/log/flags

* Fixed and added assertions for wStream

* Unified stream length checks

* Added new function to check for lenght and log
* Replace all usages with this new function

* Cleaned up PER, added parser logging

* Cleaned up BER, added parser logging

* log messages

* Modified Stream_CheckAndLogRequiredLengthEx

* Allow custom format and options
* Add Stream_CheckAndLogRequiredLengthExVa for prepared va_list

* Improved Stream_CheckAndLogRequiredLength

* Now have log level adjustable
* Added function equivalents for existing logger
* Added a backtrace in case of a failure is detected

* Fixed public API input checks
2022-04-19 14:29:17 +02:00
akallabeth
14568872a9
Instance cleanup (#7738)
* Cleaned up freerdp::autodetect

* Deprecate freerdp::input

* Deprecated freerdp::update

* Deprecated freerdp::settings

* Deprecated freerdp::autodetect

* Removed rdpTransport::settings

* Deprecated freerdp_per::update|settings|autodetect

* Fixed mac client and server compilation

* Fixed windows compilation

* Added deprecation warnings

* Fixed initialization of structs.

* Fixed android build

* Fixed freerdp_client_context_new const correctness

* Fixed checks for android implementation

Replaced checks with assertions where appropriate

* Fixed checks for windows client

Replaced checks with assertions where appropriate

* Fixed proxy client pointer dereference
2022-03-23 13:18:35 +01:00
David Fort
6a3b5573ad drdynvc: add missing messages definitions 2022-03-07 14:30:52 +01:00
Armin Novak
4d03d7c0bf Freerdp remove #ifdef HAVE_CONFIG_H 2022-03-03 11:26:48 +01:00
Armin Novak
b2ad47a809 Reorganized FreeRDP headers 2022-03-03 11:26:48 +01:00
akallabeth
8cc6582044
Unify struct definitions (#7633)
* Unified enum/struct definitions, fixed include issues

* Fixed mac compilation issues

* Added missing include

* Fixed windows server build warnings

* Fixed VS2010 build issue

* Removed unnecessary library linking

* Fixed ThreadPool WinXP compatibility

* Fixed pr review remarks
2022-02-14 14:59:22 +01:00
Armin Novak
9c7ec3888a Added deprecation to *get_fds functions 2022-01-21 08:59:09 +01:00
Armin Novak
990400aedd Close SVC channels in WTSVirtualChannelClose 2021-10-18 12:49:38 +02:00
akallabeth
03a9ca80c8
Refactor proxy (#7312)
* Added hidden transport dump and replay options

* Added settings to enable transport dump and replay
* Added check in freerdp_connect to skip authentication on
  dump replay

* Fixed proxy issues

* Proper shutdown handling
* Uninitialized variables
* Skip proxy-client channels, initialize from peer channels and
  config
* Filter static channels like dynamic ones
* Added proxy module filtering from config data (channels, input, ...)

* Removed oboslete proxy decoding related files

* Added defines for RDPECAM channel

* Added proxy config options:

* VideoRedirection
* CameraRedirection

* Fixed duplicate channel free
2021-09-23 14:52:03 +02:00
akallabeth
3ce622b638 Fixed FreeRDP_WTS* failure handling 2021-09-20 10:59:59 +02:00
Armin Novak
054f0ea260 Use defines instad of channel names 2021-08-25 10:54:24 +02:00
akallabeth
617293e0d3
Cleanups (#7239)
* Use freerdp_settings_* for shadow and sample server

* Added freerdp_peer_set_local_and_hostname

* Code cleanups and WINPR_ASSERT

* Code cleanups

* Use CHANNEL_NAME_LEN where appropriate
* Use temporary variables in loop instead of direct array access
2021-08-24 14:09:40 +02:00
Armin Novak
c2bef2bfa9 Fixed return value checks for ArrayList_Append and HashTable_Insert 2021-06-16 11:46:42 +02:00
Armin Novak
d6c84c28fb Renamed ArrayList_Add to ArrayList_Append
* Do not break API silently
2021-06-16 11:46:42 +02:00
Armin Novak
a1c8e4cf85 Refactored ArrayList_Add to conform to other functions 2021-06-16 11:46:42 +02:00
Armin Novak
880c603c26 Renamed HashTable_Add to HashTable_Insert
* Since the changes break HashTable_Add rename it so that it will
  not fail silently
2021-06-16 11:46:42 +02:00
Vic Lee
8852d8631f server: ignore unknown channelId received from client. 2021-02-15 11:01:39 +01:00
Kobi Mizrachi
e0fa47f3b3 server: add WTSVirtualChannelManagerCheckFileDescriptorEx API 2020-10-06 13:17:38 +03:00
kubistika
508ba9201f core: server: add API to get peer accepted channel names 2020-09-21 14:16:22 +03:00
akallabeth
873ed92a84 Remove unnecessary cast. 2020-05-06 13:31:57 +02:00
Armin Novak
3ba66db99d Unify pReceiveChannelData and psPeerReceiveChannelData
Fix definitions of the two function pointers.
Use and definition did not match, fix that.
Will create warnings in external projects
2020-03-10 12:21:14 +01:00
Armin Novak
d5b5088eac Fixed misinterpretation of SendChannelData
SendChannelData was defined with a return value of type int, but
used as BOOL everywhere. Fix the definition to match use.
2020-03-10 12:21:14 +01:00
Armin Novak
d7ba252cd7 Fixed arguments for peer->ReceiveChannelData 2020-03-04 14:52:19 +01:00
Armin Novak
0f729d2b2c Fixed conversion and return checks.
* Fix some missing argument checks for function pointer implementations
* Fix broken return value check for client->SendChannelData
* Updated const correctness for function pointer implementations
2020-03-04 14:44:03 +01:00
Armin Novak
1b91c77350 Fixed shadow server with mstsc as client. 2020-03-03 12:27:19 +01:00
Armin Novak
be714d2a13 Fixed tpkt header length checks.
TPKT header length and consumption of data was not consistently
checked. This adds checks after each packet processed and fixes
any inconsistencies found.
2020-03-02 11:40:35 +01:00
Kobi Mizrachi
9417350d92 core: channels: add API to get channel name/id 2020-02-26 11:47:01 +01:00
Kobi Mizrachi
7a2eafbc3c core: server: fix a bad free in channel->queue cleanup 2020-02-10 14:29:30 +01:00
Armin Novak
89913624be FreeRDP_WTSVirtualChannelOpen unify channel new/free 2020-01-29 08:24:03 +01:00
Kobi Mizrachi
b393d59bcb server: make sure all messages in channel->queue are freed when queue is freed 2020-01-29 08:24:03 +01:00
Kobi Mizrachi
50d2789ebf server: fix leak in WTSCloseServer
make sure every pending message that wouldn't be handled because the
server is closing, will be free()ed as expected.
2020-01-13 13:41:44 +01:00
Kobi Mizrachi
edeb449185 core: server: add missing NULL check in FreeRDP_WTSVirtualChannelRead 2019-12-12 11:10:44 +01:00
Armin Novak
8665ac7e81 Fixed broken strnlen checks 2019-11-11 12:12:51 +01:00