Commit Graph

2695 Commits

Author SHA1 Message Date
Martin Fleisz ecb4712a10 channels: Check return value of EnumPrinters 2023-03-23 17:40:08 +01:00
akallabeth e28760f91e [cmake] fix OBJECT library link deps
Follow up to #8801, OBJECT libraries need to link dependencies with
PUBLIC so that the library using the OBJECT libraries can link against
these too
2023-03-16 10:58:01 +01:00
Marc-André Moreau 3cc12d5886 use cmake object libraries for built-in virtual channel plugins 2023-03-15 16:20:50 +01:00
Armin Novak b54d2c1db3 [channels] removed duplicate includes 2023-03-15 08:22:23 +01:00
akallabeth a5b42f0f84 [includes] untangled circular includes 2023-03-15 08:22:23 +01:00
akallabeth a360f1ca8c [build] fix a few compiler warnings 2023-03-13 13:04:45 +01:00
Armin Novak 1bf0bb1a26 [server] fixed build without CHANNEL_AUDIN_SERVER 2023-03-06 21:46:51 +01:00
Armin Novak 3d8cb485f4 [warnings] Fixed strict-prototypes warnings 2023-03-06 10:04:59 +01:00
Armin Novak 1b28bd0d36 [channels,cliprdr] use logger tag macros 2023-03-05 17:55:28 +01:00
Armin Novak 9c56ce1336 [channels,tsmf] drop gstreamer 0.1 support 2023-03-01 15:34:09 +01:00
akallabeth 273bb6a7a8 [build] use static libraries as intermediate 2023-03-01 08:18:34 +01:00
akallabeth b4e9c8b39f [build] removed complex libraries
* remove obsolete complex libraries helper
* fix static linking
2023-03-01 08:18:34 +01:00
akallabeth c054666311 [channels] simplified channel subsystem linking 2023-03-01 08:18:34 +01:00
akallabeth cf9777cd92 [channels] simplified server linking 2023-03-01 08:18:34 +01:00
akallabeth c3a82daad6 [channels] simplified client linking 2023-03-01 08:18:34 +01:00
akallabeth 0307482506 [channels,rdpsnd] add rdpsnd-common object lib 2023-03-01 08:18:34 +01:00
akallabeth aa2cb9aa5f Fixed #8686: Update h264 to use new FFMPEG API 2023-02-27 09:45:44 +01:00
Armin Novak 6256933e75 [channels,cliprdr] remove clipboard data hex dump
just too noisy for logging
2023-02-23 20:28:15 +01:00
Armin Novak 70f6c09ff4 [core] fix persistent bitmap cache setting
* Only activate if both, client and server support the capability
* Use settings getter to access setting
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 075506f6c8 [winpr,stream] use new Stream_CheckAndLogRequiredLength* 2023-01-25 14:27:32 +01:00
akallabeth 8ed37e68d2 [stream] use logging capacity checks 2023-01-25 14:27:32 +01:00
akallabeth 275741cc75 [core,utils] add drdynvc stringification functions 2023-01-12 22:54:25 +01:00
akallabeth 6d7c07076d [chanenls,drdynvc] use proper types instead of int 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
Armin Novak f1e7cc0d48 [rdpdr] unify header read/write 2023-01-10 11:49:38 +01:00
Armin Novak 920d5ee7a1 [rdpdr] improved version handling 2023-01-10 11:49:38 +01:00
Martin Fleisz 8d917698ea cliprdr: Fix sending of server-side PDUs
The old implementation used `Stream_GetLength` to obtain the amount of
data to send. However some PDUs (i.e. CLIPRDR_FILECONTENTS_REQUEST) are
overallocated as they contain optional data (clipDataId in this case).

We now use the position to determine the actual data written to the PDU
instead of the amount of bytes allocated, avoid sending garbage data to
the client.
2023-01-09 07:47:17 +01:00
Armin Novak 37454c7420 [utils] improve rdpdr packet dump 2022-12-22 15:09:03 +01:00
Armin Novak 833a1b2d24 [channel,rdpdr] use wLog* for server logging 2022-12-22 15:09:03 +01:00
Armin Novak d5c5473aa9 [channel,rdpdr] use wLog* for client logging 2022-12-22 15:09:03 +01:00
Armin Novak 318b55adc1 [rdpdr] filter empty device announce 2022-12-22 15:09:03 +01:00
akallabeth 29c92af194 [channels,rdpgfx] fixed logger setup 2022-12-18 15:14:30 +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 9d6a06a197 [channels,rdpdr] fix misleading log entries
* Use __FUNCTION__ instead of copying the name to the message
* Fix freerdp_rdpdr_dtyp_string argument to get correct name
2022-12-16 09:42:44 +01:00
Armin Novak 37d7b98449 [channels,rdpdr] refactoring server callbacks
* Add callbacks for all messages exchanged between client and server
  to allow server implementations to intercept them.
* Unify logging
* Add device tracking
2022-12-15 14:57:29 +01:00
akallabeth 3b5347e229 [channel,dvc] unify and log DVC callbacks
* Added a check function that logs errors if the required callbacks are
  not set.
* Encapsulate calling in (static) helper functions
2022-12-15 14:57:29 +01:00
akallabeth 1f16250a7b [channels,rdpsnd] prevend multiple OnOpen calls
due to the nature of the sound channel there are multiple listeners
waiting for the server to open the channel and most of them are called
by the server. Only open the channel once.
2022-12-15 14:57:29 +01:00
akallabeth a2329281a4 [channels,rdpdr] fix possible surface leak
* Ensure DeleteSurface is called before CreateSurface: Under certain
  conditions it is possible that there already exists a surface with the
  same id as the new CreateSurface PDU. Delete the already existing
  instance in that case before creating a new one.
* Simplify surface cleanup on shutdown: Use HashTable_Foreach
2022-12-15 14:57:29 +01:00
Armin Novak df4c076946 [channels,rdpdr] abort on invalid device request
If a request references a non existing device abort.
2022-12-15 14:57:29 +01:00
Armin Novak 186e97e0a8 [channels,rdpdr] better logging of device manager
if a device could not be found print a better log message
2022-12-15 14:57:29 +01:00
Armin Novak 231babef5e [channels,rdpdr] improve log message
try to stringify magic numbers in log message
2022-12-15 14:57:29 +01:00
akallabeth 4ab9fb4425 [channels,rdpsnd] Add PlayEx callback
This new callback is preferred over the older Play callback and provides
the AUDIO_FORMAT as additional argument.
2022-12-14 10:17:30 +01:00
akallabeth 8aa880c0ba [channels,rdpsnd] Callback on server format
When the server sends the format list to the client call a device
callback that provides the details to the audio backend.
2022-12-14 10:17:30 +01:00
akallabeth babc47e19c [channels,rdpsnd] fix rdpsnd channel cleanup
The rdpsnd channel needs to keep the resources allocated until the last
user (static, dynamic channel) is terminated.
2022-12-13 10:57:34 +01:00
akallabeth 7ab917dca8 Fixed Wsign-compare warnings 2022-12-09 15:58:26 +01:00
akallabeth 7e1065a9b9 Fixed Wshadow warnings 2022-12-09 15:58:26 +01:00
akallabeth aaae70ff05 Fixed missing const casts 2022-12-09 15:58:26 +01:00
Armin Novak c3e42de5b5 [drdynvc] assert and proper cleanup 2022-12-09 13:23:00 +01:00
akallabeth dfcd168af6 [channels,rdp2tcp] only reset event if signalled 2022-12-09 12:30:14 +01:00
Armin Novak 0f4be4befd [channels] fix addin queue free
Only clear messages with an ID of 0
2022-12-09 12:30:14 +01:00
Armin Novak 64c94e06f3 [channel,rdpsnd] fix queue cleanup
The argument is of type wMessage* and we only care for messages with an
ID of 0
2022-12-09 12:30:14 +01:00
Armin Novak b25234da66 [channels] Abort event wain on abortEvent 2022-12-09 12:30:14 +01:00
Armin Novak ec68b1f2a5 [channels,rdpdr] fix computer name sending
The name should be '\0' terminated.
2022-12-08 13:29:46 +01:00
Armin Novak 25b00bc483 [channel,urbdrc] fix type of usb hotplug callback
The libusb_hotplug_callback_fn uses LIBUSB_CALL call type
2022-12-07 11:32:59 +01:00
Armin Novak 1422136e81 [channel,cliprdr] append '\0' to format names 2022-12-03 10:53:18 +01:00
Armin Novak cfe09892be [channel,cliprdr] log debug information
Log cliprdr debug information without compile flags
2022-12-03 10:53:18 +01:00
Armin Novak e1eacad74c [scard] fixed memory leak
card_id_and_name_* return allocated values, free after use
2022-12-02 15:08:09 +01:00
Armin Novak a57c480b29 [channel,rdpdr] proper queue cleanup for rdpdr 2022-12-02 15:08:09 +01:00
Armin Novak bc3904ec65 [channel,smartcard] Fix message cleanup on shutdown 2022-12-02 15:08:09 +01:00
akallabeth 5799fb2018 Replace ConvertFromUnicode and ConvertToUnicode
* Use new ConvertUtf8ToWChar, ConvertUtf8NToWChar,
  ConvertUtf8ToWCharAlloc and ConvertUtf8NToWCharAlloc
* Use new ConvertWCharToUtf8, ConvertWCharNToUtf8,
  ConvertWCharToUtf8Alloc and ConvertWCharNToUtf8Alloc
* Use new Stream UTF16 to/from UTF8 read/write functions
* Use new settings UTF16 to/from UTF8 read/write functions
2022-11-28 10:42:36 +01:00
akallabeth a6593f2dc1 [rdpdr] fixed server side channel parsing 2022-11-22 15:30:31 +01:00
akallabeth febc4b3073 [gdi,gfx] Fixed possible memory leaks
* WINPR_ASSERT all callbacks required to be set
* Unify cache slot creation/destruction
* Destroy cache slot before setting it
2022-11-22 15:30:31 +01:00
akallabeth 7c224c2427 [drdynvc] fix cleanup in case of no thread
If drdynvc is used without an own thread the dynamic channels were not
properly cleaned up on disconnect.
2022-11-22 15:30:31 +01:00
Armin Novak 7c5652c15a Fixed -Wmissing-prototypes 2022-11-21 10:12:31 +01:00
Armin Novak 476bed5731 Fixed -Wconditional-uninitialized 2022-11-21 10:12:31 +01:00
Armin Novak 6ea2e99d51 Fixed -Wunreachable-code-break 2022-11-21 10:12:31 +01:00
Armin Novak 921315fdbf Fixed -Wmissing-variable-declarations 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
David PHAM-VAN f2e14d68eb Replace backslashes with underscores in printer names 2022-11-21 08:04:10 +01:00
akallabeth 0f60ac5988 Fixed path validation in drive channel
Check that canonical path is a subpath of the shared directory
2022-11-14 09:28:22 +01:00
akallabeth 96aef5f1af Fixed missing stream length check in drive_file_query_directory 2022-11-14 09:28:22 +01:00
akallabeth d9e687d7e1 Added missing length check in urb_control_transfer 2022-11-14 09:28:22 +01:00
akallabeth b366ff19a5 Fixed missing input buffer length check in urbdrc 2022-11-14 09:28:22 +01:00
akallabeth 49bd22aea7 Ensure urb_create_iocompletion uses size_t for calculation 2022-11-14 09:28:22 +01:00
akallabeth b54ca508ac Fixed division by zero in urbdrc 2022-11-14 09:28:22 +01:00
Armin Novak 60d2e525f5 [channel rdpdr] Clean up IRP on processing errors 2022-11-11 06:42:45 +01:00
Martin Fleisz b5e8b419b8 drive: Fix an issue when redirecting drives on Windows
CreateFile/GetFileInformationByHandle will fail if used with just a
drive letter i.e. C:/.

This PR fixes that case by using GetFileAttributesExW as a fallback in
case CreateFileW fails.
2022-11-03 15:02:27 +01:00
akallabeth 43c5289928 Replaced memset/ZeroMemory with initializer
* Addes WINPR_ASSERT on many occations
* Replaced memset with array initializer
* Replaced ZeroMemory with array initializer
2022-10-14 12:11:01 +02:00
akallabeth 6a2626498b Disable channel builds if -DWITH_CHANNEL=OFF 2022-10-13 14:38:06 +02:00
Armin Novak 2acf21b592 Improved error checks in server side rdpdr 2022-10-13 13:57:11 +02:00
akallabeth 080e44fc96 Fixed extra-semi-stmt warnings 2022-10-11 13:28:30 +02:00
akallabeth 9d197b263c Fixed conditional-uninitialized warnings 2022-10-11 13:28:30 +02:00
akallabeth 26ac2f0b27
Additional checks (#8279)
* Fix length checks in parallel driver

The length requested was not checked against the length read from
the port.

* Fixed missing length check in video channel

Data received in video redirection channel was not checked for
proper length.

* Fixed video presentation reference counter

Video channel presentation reference counter was not updated with
Video_Frame_new. A failing H264 decoding step could trigger a reference
decrement and the presentation was freed by accident.
Also clean up the increment and decrement of presentation

* Fixed tsmf ffmpeg context extra data size checks

tsmf_ffmpeg_init_stream did not abort if the video format ExtraDataSize
was not sufficiently large to satisfy expectations.

* Fixed missing input data length check

tsmf_ifman_exchange_capability_request did not check if the input
data stream actually contained the amount of bytes requested to
copy.

* Fixed TSMF tsmf_ffmpeg_set_format length checks

ExtraDataSize of format was not checked for expected minimum length

* Fixed TSMF tsmf_read_format_type length checks

ExtraDataSize of format was not checked for expected minimum
length

* Fixed TSMF tsmf_gstreamer_set_format length checks

ExtraDataSize of format was not checked for expected minimum
length
2022-10-06 15:30:54 +02:00
akallabeth 1849632c43
Fixed format strings to match arguments (#8254)
* Fixed format strings to match arguments

Reviewed and replaced all %d specifiers to match proper type

* Added proxy dynamic channel command type to log messages.
2022-09-29 14:55:27 +02:00
akallabeth d2ab631c40
Test uri fix (#8232)
* Fixed TestUri unit test

* Make proper unit test out of the test function
* Add proper test cases

* Replace FindFirstFileA with FindFirstFileW for addins

This allows addin paths to contain unicode symbols.

* Fixed parse_uri_to_local_file definition

* Move to common clipboard.c file
* Move to header file so it can be included in test case

* Added WINPR_LOCAL for test builds

This macro exports internal functions in case of a unit test build
This way unit tests can access these without other workarounds.

* Fixed typo in function name is_dos_driver

* Cleaned up FindFirstFileW call

Use a wrapper function to convert to unicode and call the function

* Cleaned up BUILD_TESTING and EXPORT_ALL_SYMBOLS

* EXPORT_ALL_SYMBOLS now does as the name implies and exports all
  non static functions/variables from the library.
* BUILD_TESTING now only sets the defines for test code and
  activates EXPORT_ALL_SYMBOLS to allow tests to access internal
  code

* Fixed windows client warnings

* disable CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS
2022-09-26 11:22:02 +02:00
Armin Novak eaaeb62f05 Fixed -Wcomma warning 2022-09-20 15:52:14 +02:00
Simon Nivault 82b58325a3 Add switch to declare printer as default or not 2022-09-20 13:25:05 +02:00
Simon Nivault 8d97215881 Enable auto default printer detection only for enum printer 2022-09-20 13:25:05 +02:00
Armin Novak 320bda4a05 Fixed #8084: rdpei thread alive condition was FALSE 2022-09-13 09:16:55 +02:00
Armin Novak 6a1d44bb67 Added support for audin version 2 2022-09-12 10:03:31 +02:00
garbb 9a4a77b9a3 Update remdesk_main.c 2022-09-12 08:37:33 +02:00
garbb 64aa7e2635 Update remdesk_main.c 2022-09-12 08:37:33 +02:00
garbb df51e69a6a Update remdesk_main.c 2022-09-12 08:37:33 +02:00
garbb 77372a24f3 handle remote assistance connection request denied 2022-09-12 08:37:33 +02:00
Simon Nivault 06827774b6
Manage default printer for the win backend (#8177)
* printer_win: Retrieve default printer name

* printer_win: Declare the local default printer as default

* printer_cups: Retrieve default printer name

* printer_cups: Declare the local default printer as default
2022-09-09 09:13:37 +02:00
David Fort 103f13575c
drdynvc: code cleanup of the client dynamic channel (#8148)
This patch does various cleanups in the client dynamic channel. The main
goal of the cleanup was to add the sending of Close messages to the server
when a channel is locally closed. The refcounter is there to ensures that
the DVC_CHANNEL is not freed while some pieces of code are still holding a
reference on it.

I did some tests by using a custom server-side echo channel at
https://github.com/hardening/echoChannel, it allows to send a given amount of
packets and then close (to test server-side initiated closes). It compiles
with mingw (so under linux) and so it can be easily deployed (no deps).
2022-08-25 08:47:00 +02:00
David Fort 1f08cb9a7d
Drdynvc needs love (#8059)
* winpr: add lock operation on HashTables

* drdynvc: change the listeners array for a hashtable and other micro cleanups

* logonInfo: drop warning that is shown at every connection

Let's avoid this log, we can't do anything if at Microsoft they don't respect
their own specs.

* rdpei: fix terminate of rdpei

* drdynvc: implement the channel list with a hashtable by channelId
2022-07-26 12:53:41 +02:00
Martin Fleisz 152c96032d channel/printer: Fix return type for localtime_s on Windows 2022-07-21 15:59:43 +02:00
David Fort 3478051f15 dynamic channels: mutualize things for listeners and plugins
The same code is copied in all dynamic channels to create a plugin, have a listener,
and manage the channel lifecycle. This patch does a mutualization effort so that channels
only have to code things that are specific to them.
2022-07-07 12:21:23 +00:00