Commit Graph

2339 Commits

Author SHA1 Message Date
Armin Novak
28bc636d53 Unified streamID read/write 2020-08-10 13:34:30 +02:00
Armin Novak
3ebc71abf3 Replace wHashTable with wArrayList in USB channel
The streamID is not guaranteed to be uniqe, so add all transfers
to a list and remove by checking pointers instead of the streamID
2020-08-10 13:34:30 +02:00
Armin Novak
ea8f93441d Added return checks for HashTable_Add 2020-08-10 13:34:30 +02:00
Armin Novak
57b405ca26 Fixed compilation warnings. 2020-08-10 12:14:11 +02:00
Alexandr
616af2d5b8
fixed build on freebsd (#6395)
* fixed build on freebsd
2020-07-27 11:36:24 +02:00
Zhu Qun-Ying
2ba7f9da1d cliprdr_common.c: fix memory leak in certain error condition 2020-07-25 16:55:34 +02:00
Zhu Qun-Ying
2a286fbf65 Fixed error msg typo in ciprdr_main.c 2020-07-25 16:55:21 +02:00
Marco van Wieringen
9db147c317 Add support for getmntent support on Illumos
This implements reading mount entries on Solarish operating systems like
OpenIndiana etc using the somewhat different getmntent support available
there.
2020-07-24 09:16:46 +02:00
akallabeth
4039370064 Fixed input sanitation in rdpgfx_recv_solid_fill_pdu
The input rectangle must be checked for plausibility.

Thanks to Sunglin and HuanGMz of the Knownsec 404 security team and pangzi of pwnzen
2020-07-20 14:11:36 +02:00
Kobi
5667c12be5
Merge pull request #6360 from kubistika/proxy_rail_handshake_ex_flags_sync
server: proxy: rail: handshake ex flags sync
2020-07-07 15:54:08 +03:00
Kobi Mizrachi
004c2f49e4 rail: server: add API to set railHandshakeExflags 2020-07-07 15:31:20 +03:00
Armin Novak
8cee10319a Fixed urbdrc device path 2020-07-07 10:43:08 +02:00
Armin Novak
6efc72707c Fixed bDeviceClass check in udev_init
Use the proper constant  0xef (Miscellaneous) instead of
0xfe (Application Specific)
See https://www.usb.org/defined-class-codes
2020-07-07 10:43:08 +02:00
akallabeth
bc7d423c6c Replaced malloc in urbdrc channel 2020-07-07 10:43:08 +02:00
akallabeth
804891c0e8 Fixed discrepancy in string descriptor default 2020-07-07 10:43:08 +02:00
akallabeth
37a5a7a157 Replaced memset in urbdrc 2020-07-07 10:43:08 +02:00
akallabeth
29e3b0ea51 Unified logging for urbdrc libusb wrapper 2020-07-07 10:43:08 +02:00
akallabeth
66e4eb628b Initialize variable in func_instance_id_generate 2020-07-07 10:43:08 +02:00
akallabeth
8ee0fafa09 Improved error log for string descriptor read issues 2020-07-07 10:43:08 +02:00
akallabeth
2a493a58a8 Reverted check for short usb descriptor 2020-07-07 10:43:08 +02:00
akallabeth
2d95224488 Added compile time urbdrc debug option 2020-07-07 10:43:08 +02:00
akallabeth
fc8c07435f Dump USB channel data with log-level trace 2020-07-07 10:43:08 +02:00
Kobi Mizrachi
ec06a98e84 rail: server: rename rail_send_pdu -> rail_server_send_pdu 2020-07-06 10:32:59 +03:00
Kobi Mizrachi
5438b94c97 rail_common.c: Fix rail_get_order_type_string 2020-07-06 08:46:14 +03:00
Kobi Mizrachi
c3b28e8bce rail: server: mark rail_send_pdu as static function 2020-07-06 08:27:13 +03:00
akallabeth
b971c5c97f Use CMake to detect availability of getlogin_r 2020-07-01 16:50:20 +02:00
akallabeth
caff01877d Fixed fallback to getlogin for android 2020-06-22 12:09:36 +02:00
akallabeth
1c6a6923f8 Fixed broken const variable. 2020-06-22 11:51:39 +02:00
akallabeth
c3a1ed780c Use localtime_s on windows 2020-06-22 11:51:38 +02:00
akallabeth
1a02af5a12 Fixed codition with side effects 2020-06-22 11:51:38 +02:00
akallabeth
36478d3d0b Replaced getlogin with getlogin_r 2020-06-22 11:51:38 +02:00
akallabeth
240fdd07b1 Replaced localtime with localtime_r 2020-06-22 11:51:38 +02:00
Bernhard Miklautz
1628939227 fix [client channels]: move exported API calls to client/common
The functions mappedGeometryRef and mappedGeometryUnref are API
functions ([1]) but were implemented in the geometry channel.
In case FreeRDP was built with BUILTIN_CHANNELS=OFF those functions
weren't available globally but used by the video channel.

Now the functions are fixed part of the freerdp-client library and
therefore available for all channels.

[1] exported in freerdp/client/geometry.h

Fixes #6236
2020-06-17 12:59:41 +02:00
Martin Fleisz
982bc682b5
Merge pull request #6256 from akallabeth/usb_cancel_fix
Do not remove transfer data on usb cancel transfer
2020-06-16 11:05:24 +02:00
Kobi
67d4560e86
Merge pull request #6259 from kubistika/drdynvc_hotfix
drdynvc: client: fix #6252 use-after-free
2020-06-04 21:29:19 +03:00
akallabeth
5c0ccb7575 Fixed formatting. 2020-06-04 07:55:12 +02:00
Ondrej Holy
c03f68059d smartcard: Teoretical fix of uninitialized values
This tries to fixes the following defects reported by covscan tool:
 - channels/smartcard/client/smartcard_operations.c:958: uninit_use_in_call: Using uninitialized value "ret.cReaders" when calling "smartcard_pack_locate_cards_return".
 - channels/smartcard/client/smartcard_operations.c:932: uninit_use_in_call: Using uninitialized value "ret.cReaders" when calling "smartcard_pack_locate_cards_return".

But I am not sure about it...
2020-06-04 07:55:12 +02:00
Ondrej Holy
7554154a04 smartcard: Fix usage of uninitialized values
This fixes the following defect reported by covscan tool:
 - channels/smartcard/client/smartcard_pack.c:942: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
 - channels/smartcard/client/smartcard_pack.c:894: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
 - channels/smartcard/client/smartcard_pack.c:475: uninit_use_in_call: Using uninitialized value "tmp" when calling "ConvertFromUnicode".
2020-06-04 07:55:12 +02:00
Kubistika
6ed765c960 drdynvc: client: fix #6252 use-after-free 2020-06-03 19:47:40 +03:00
Armin Novak
5ec66cc6c7 Fixed sign compare warnings with constants. 2020-06-03 09:53:18 +02:00
Armin Novak
ef4de12887 Fixed double free in urb_isoch_transfer_cb 2020-06-03 08:37:45 +02:00
Armin Novak
a5e2d62e48 Do not remove transfer data on usb cancel transfer 2020-06-03 08:24:17 +02:00
Patrick Chin
5f788c65f4 Fix memory leaks in client/encomsp_main.c and client/remdesk_main.c 2020-06-02 09:50:07 +02:00
Florian Staudacher
d1dc2fb03d report only actual bytes received, not allocated buffer size (interrupt produces data, timeout doesn't) 2020-06-02 09:21:30 +02:00
Florian Staudacher
03128d5154 only call 'libusb_set_interface_alt_setting' when value is changed 2020-05-29 10:48:23 +02:00
Armin Novak
539e3e9fc5 Fixed memory leak in rdpei 2020-05-25 08:43:03 +02:00
akallabeth
cac8c365f2 Reset pointer to NULL after free. 2020-05-20 15:10:08 +02:00
akallabeth
a1eb3e66b3 Clear dynamic channel lists on disconnect. 2020-05-20 15:10:08 +02:00
akallabeth
58ef235bc5 Removed unused variable warnings 2020-05-20 15:10:07 +02:00
akallabeth
9909ed57ae Fixed rails debug string warnings. 2020-05-20 15:10:07 +02:00
akallabeth
b584d07734 Fixed #6197: NULL check in urbdrc 2020-05-20 15:02:24 +02:00
Armin Novak
8cc950f2a5 Fixed #6195: Wrong length read/write in rdpei 2020-05-20 15:02:24 +02:00
akallabeth
abf7c29910 Extend lifetime of streampool in drdynvc
The stream pool can not be released until all streams have been
returned. This might happen as late as channel termination, so
change the lifetime scope accordingly.
2020-05-18 16:57:02 +02:00
Vladyslav Hordiienko
15245c2abd fix typo in GFX logs 2020-05-18 10:56:40 +02:00
akallabeth
6a811db69c Fixed drdynvc_send stream release 2020-05-13 17:11:17 +02:00
akallabeth
64ad42b95b Fixed DestroyListener arguments and call order 2020-05-13 17:11:17 +02:00
Martin Fleisz
c2f4b3b975
Merge pull request #6171 from akallabeth/printer_cups_ref_fix
Fixed #6157: Reset cups instance on disconnect.
2020-05-12 12:50:49 +02:00
akallabeth
c6e37dce79 Fixed #6162: Clipboard temporary path length limit
The limit of clipboard temporary paths is 260 '\0' terminated
wide characters. Fix the checks to enforce that properly.
2020-05-12 12:16:00 +02:00
akallabeth
2f5e5359f6 Destroy channel listeners on terminate 2020-05-12 11:40:42 +02:00
akallabeth
5b2a4434d8 drdynvc channel cleanup.
* Clean channel listeners on channel close
* Remove limit on listeners for channels
* Remove limit on channels
2020-05-12 11:40:42 +02:00
akallabeth
13906f3ec6 Fixed #6157: Reset cups instance on disconnect. 2020-05-12 08:46:06 +02:00
David Fort
46c4b7bdc2
Merge pull request #6166 from akallabeth/mac_sound_objc_link
Fixed #6163: Force linking to objective C runtime
2020-05-11 22:38:24 +02:00
akallabeth
eee1d7176b Fixed #6163: Force linking to objective C runtime
Sound channel requires the objective C runtime, force linking to
fix build issues on older mac os versions
2020-05-11 09:56:18 +02:00
akallabeth
feb7d4f362 Changed smartcard no reader log message level to info 2020-05-08 11:21:51 +02:00
akallabeth
c31eb24bae Fixed wrong error return from drdynvc_write_data
When the channel was closed a wrong error code was returned.
2020-05-08 11:21:51 +02:00
akallabeth
52dd312e11 Fixed various input buffer length checks in URBDRC
Thanks to hac425 CVE-2020-11039
2020-05-08 11:04:03 +02:00
akallabeth
af79aafbba Fixed int overflow in smartcard_ndr_read
Thanks to hac425
2020-05-08 11:04:03 +02:00
akallabeth
9f77fc3dd2 Fixed int overflow in msusb_mspipes_read
Thanks to hac425
2020-05-08 11:04:03 +02:00
akallabeth
8e9b0a625b Fixed int overflow in printer_write_setting
Thanks to hac425
2020-05-08 11:04:03 +02:00
akallabeth
06c32f1700 Fixed int overflow in PresentationContext_new
Thanks to hac425 CVE-2020-11038
2020-05-08 11:04:03 +02:00
akallabeth
2215fef975 Fixed oob read in rdpsnd_recv_wave2_pdu
Check format index before using it.
Thanks to hac425 CVE-2020-11041
2020-05-06 13:31:57 +02:00
akallabeth
cbee45aace Fixed clipboard 'called with invalid type' warning 2020-05-06 13:31:57 +02:00
akallabeth
8ec50b6cc1 Fix short format name configuration and format list return. 2020-05-06 13:31:57 +02:00
akallabeth
5305d62b72 Fix oob read in msusb_msconfig_read 2020-05-06 13:31:57 +02:00
akallabeth
6b485b146a Fixed oob read in irp_write and similar 2020-05-06 13:31:57 +02:00
akallabeth
795842f409 Fixed oob read in parallel_process_irp_create 2020-05-06 13:31:57 +02:00
akallabeth
6efa8290d8 Fixed oob read in parallel_process_irp_read 2020-05-06 13:31:57 +02:00
akallabeth
917daa8b56 Fixed oob read in parallel_process_irp_write 2020-05-06 13:31:57 +02:00
akallabeth
b230ac98e9 Fixed oob read in cliprdr_read_format_list 2020-05-06 13:31:57 +02:00
akallabeth
8e1a1b4075 Fixed cliprdr_server_receive_capabilities
Thanks to hac425 CVE-2020-11017, CVE-2020-11018
2020-05-06 13:31:57 +02:00
Bernhard Miklautz
fd5bdee8b3
Merge pull request #6147 from akallabeth/rdpsnd_thread
Use dedicated sound decoder thread.
2020-05-06 13:19:29 +02:00
akallabeth
f016f1ec09 Create data copy in case of dynamic sound channel. 2020-05-05 17:03:14 +02:00
Bernhard Miklautz
ecc9f12733
Merge pull request #6140 from akallabeth/smartcard_silence
Silence SCARD_E_TIMEOUT warnings
2020-05-05 15:41:04 +02:00
Bernhard Miklautz
3e89574205
Merge pull request #6124 from akallabeth/speedup
Unify inline and some warning fixes
2020-05-05 15:34:38 +02:00
akallabeth
af554b5a54 Use dedicated sound decoder thread. 2020-05-05 14:25:54 +02:00
Armin Novak
e80316cf9a Silence SCARD_E_TIMEOUT warnings
These occur quite often for status calls, so reduce log verbosity.
2020-05-04 17:32:55 +02:00
qarmin
fe8bad1698 Don't allow to overflow dev_array array 2020-05-01 20:34:59 +02:00
akallabeth
9d014fe1ea Fixed compiler warnings for usb channel 2020-04-27 08:19:42 +02:00
Lukas Fink
0c27cecea4 Fixes null dereference bug
Avoids a null function pointer dereference that happened, when
freerdp_urbdrc_client_subsystem_entry failed before invoking
udevman_load_interface.
2020-04-26 19:09:13 +02:00
Lukas Fink
0cbff94aa9 Implemented udevman->hotplug_vid_pids as wArrayList 2020-04-26 19:09:13 +02:00
Lukas Fink
060253c9fa Added ability to add usb devs via id and addr simultaneously
It is now possible to add usb devices both via vid+pid and via bus+addr
at the same time. To do this, the ids are directly
given to the corresponding command line options:
/usb🆔<vid+pids>,addr:<bus+addrs>
The dev option still works like before: /usb:id,dev:<vid+pids> or
/usb:addr,dev:<bus+addrs>
2020-04-26 19:09:13 +02:00
Lukas Fink
0a5d0312d5 Added hotplug to /usb:id,dev option
Devices specified with the /usb:id,dev command line option are now
detected by the hotplug callback.
2020-04-26 19:09:13 +02:00
Lukas Fink
3d3cec4dc4 Fixed /usb:dev command line option
The /usb:dev command line option failed silently, because it tried to add the
devices before urbdrc gets initialized. This commit adds a new function
to udevman, that gets called when the urbdrc addin is initialized.
Registering of the given devices is now performed there.
2020-04-26 19:09:13 +02:00
Alex Wilson
40f23e2728 SCardReadCache/SCardWriteCache should actually cache data
Currently since the hash/keyCompare/keyClone members on the
context->cache were never being set, we were using the
HashTable_Pointer* variants, meaning that lookup always
failed (since we never ask for the same *pointer* twice).

This also revealed that the logic for autoallocate on these ops
was a bit backwards, and some error codes and support for the
"freshness" counter were missing.

In Win10 (at least with some card minidrivers) the freshness
counter is load-bearing and smartcard login won't work without
implementing a very basic version of it.
2020-04-21 08:11:54 +02:00
akallabeth
c6666731d2 Removed casts in udevman_parse_device_id_addr 2020-04-21 08:05:06 +02:00
Lukas Fink
be884c2bf6 Refactored parsing of usb dev: command line option
Refactored urbdrc_udevman_register_devices with its helper functions,
because the old implementation was a bit quirky. Removed a unsafe
strcpy, that led to a buffer overflow when given misonstructed command
line options. Doing something like "/usb:id,dev🔢1234##abcd:abcd"
won't work anymore, too.
2020-04-21 08:05:06 +02:00
David Fort
7733fe7a8a
Merge pull request #6060 from akallabeth/warnings
Fix some compiler warnings
2020-04-16 10:54:43 +02:00
akallabeth
6b66aa71fb Fixi #6086: smartcard filter early abort.
Do not abort before incrementing read position.
2020-04-14 19:04:11 +02:00
Armin Novak
9a60d2feb0 Fixed cups httpConnectEncrypt deprecation warning. 2020-04-11 09:41:08 +02:00
jacobopantoja
0f8437d1d8 Restrict USBDK to Windows builds
This commit restricts ebdaea6f3b to just Win32 builds
2020-04-11 09:04:29 +02:00
akallabeth
aa39e08c29 Fixed URBDRC DEVICE_ADD_FLAG definitions 2020-04-10 14:16:19 +02:00
akallabeth
42d40261c5 Fixed return type for subsystem entry 2020-04-10 14:11:15 +02:00
akallabeth
de7ea07a3d Fixed URBDRC parsing error reported in #6024. 2020-04-09 18:00:51 +02:00
Alex Wilson
c6e675bfb7 Always copy null terminator when filtering smartcard list 2020-04-09 10:44:25 +02:00
Martin Fleisz
99786970a3
Merge pull request #5884 from akallabeth/smartcard_ndr_strict
Smartcard tighter input validation
2020-03-31 08:34:04 +02:00
akallabeth
2749de506c Added missing context and handle read. 2020-03-30 11:07:47 +02:00
Armin Novak
f360d445e2 Pack smartcard channel structs to 1 byte alignment 2020-03-27 18:24:25 +01:00
akallabeth
ac4ec690c9 Removed a few magic numbers. 2020-03-27 15:03:59 +01:00
akallabeth
80177efe69 Fixed typos, make status comparisons explicit. 2020-03-27 14:49:09 +01:00
Armin Novak
c406f7a972 Fixed misleading log message. 2020-03-10 14:05:10 +01:00
Armin Novak
b40762c542 Removed unused function 2020-03-10 14:04:53 +01:00
Armin Novak
cb9e7fda32 Removed unused function. 2020-03-10 14:04:53 +01:00
Armin Novak
c58db76e4c Fixed return check for usbdk backend. 2020-03-09 16:40:07 +01:00
Armin Novak
4692f00864 Removed unnecessary cast. 2020-03-09 16:40:07 +01:00
Kobi Mizrachi
929457db4c egfx: client: add missing NULL checks 2020-03-09 08:28:40 +01:00
Armin Novak
5690780bdd [RDPEGFX] checks for cache import, prevent 0 size allocations 2020-03-06 12:28:21 +01:00
Armin Novak
95522923ba Move libusb hotplug registration to polling thread.
* libusb polling thread now is responsible for hotplug registration
  and removal as well as cleanup.
* Only register hotplug callback on systems with support.
2020-03-06 12:07:22 +01:00
Armin Novak
ebdaea6f3b enable usbdk on windows. 2020-03-06 12:07:22 +01:00
Armin Novak
e867ad3c9d Fixed compilation issues against libusb on windows 2020-03-06 12:07:22 +01:00
Armin Novak
35d7e896ae Fix GFX cache eviction, use 1 based indexing. 2020-03-04 11:01:23 +01:00
Martin Fleisz
6942669f32
Merge pull request #5941 from akallabeth/clang_fixes
Fixed clang scanbuild warnings.
2020-03-04 09:34:51 +01:00
Martin Fleisz
174832150e
Merge pull request #5932 from nfedera/fix_gfx_bitmapcache_indexing
Fix RDPEGFX bitmap cache indexing
2020-03-04 09:31:52 +01:00
Armin Novak
1fd51d9183 Fixed clang scanbuild warnings. 2020-03-04 09:17:35 +01:00
Norbert Federa
17e0d25104 dynvc/client: fix and improve channel closing code
- fixed and consolitate the duplicated code for sending the
  CLOSE_REQUEST_PDU to the server into dvcman_close_channel
- call dvcman_close_channel if a dynamic channel plugin fails
  to process the received channel data
- rdpegfx: don't try to remove a non-existing cache entry,
  return an error instead which now will close the channel, as
  expected by Microsoft's windows protocols test suite
2020-03-04 08:03:56 +01:00
Armin Novak
34498d4064 URBDRC: Only mark closed if control is closed. 2020-03-03 11:15:34 +01:00
Armin Novak
30990089b8 Implemented del_device by vid/pid 2020-03-02 11:40:05 +01:00
Armin Novak
1b1ab01e43 Cleaned up USB redirection
* Removed obsolete searchman
* Unified device add and virtual channel add
* Unified device id generation
2020-03-02 11:40:05 +01:00
Armin Novak
acb77391a2 Fix #5910: USB hotplug added device wrong
When a USB device was added via hotplug add_device was called
with wrong arguments.
2020-03-02 11:40:05 +01:00
Norbert Federa
39e12990e8 rdpegfx: rename MaxCacheSlot to MaxCacheSlots
Although Microsoft uses 1-based numbering on the wire for indexing the
GFX bitmap cache entries, the code in FreeRDP uses 0-based numbering and
therefore the name MaxCacheSlots is less confusing.
2020-03-02 09:55:25 +01:00
Norbert Federa
f4d5ec776f rdpegfx: use 1-based indexing for bitmap cache
Weird but Microsoft uses 1-based indexing in the RDPGFX bitmap
cache PDU's.

This does not seem to be documented but can be deducted from the
RDP client test code in Microsoft's "Windows Protocol Test Suites"
GitHub repository and the observation that mstsc aborts with a
protocol error if the cacheSlot index value 0 is used in e.g. a
GFX surface to cache PDU.
2020-03-02 09:55:25 +01:00
Armin Novak
2968e41409 Fixed missing boundary checks in smartcard_array_dump 2020-03-02 09:01:39 +01:00
Martin Fleisz
3318d1574f Fix possible NULL pointer access crash 2020-02-28 12:53:39 +01:00
Armin Novak
4eb4f58fbb Updated CMake channel detection
* Now both, dynamic and static channel entries can be defined by
  a single channel.
* Added better logging to distinguish between static and dynamic
  channel messages.
2020-02-28 12:53:39 +01:00
Martin Fleisz
da354feed0 Add dynamic channel part for rdpsnd channel 2020-02-28 12:53:39 +01:00
Martin Fleisz
347055492e
Merge pull request #5920 from akallabeth/rdpsnd_crash_fix
Fix #5885: Check for division by zero
2020-02-28 11:50:40 +01:00
Armin Novak
5e4603d0b7 Fix #5885: Check for division by zero 2020-02-27 13:56:53 +01:00
Armin Novak
95bf87a063 Replaced CMake list find with loop to fix build issues. 2020-02-27 11:18:54 +01:00
Martin Fleisz
f484b20787
Merge pull request #5907 from akallabeth/cmake_channel_dependency_fix
Cmake channel dependency fix
2020-02-26 16:18:46 +01:00
Armin Novak
829497b313 Made CHANNEL_TSMF optional and deprecated. 2020-02-26 13:56:43 +01:00
Armin Novak
53c15e3e90 Deactivate USB redirection for IOS and ANDROID by default. 2020-02-26 13:53:25 +01:00
Armin Novak
d8c3ccb375 drdynvc: reorder filepaths when adding channels 2020-02-26 10:19:12 +01:00
Armin Novak
d633195879 Promoted usb, printer and smartcard dependencies to recommended 2020-02-25 17:36:17 +01:00
Armin Novak
00f5f014c6 Fixed CMake channel dependencies for variables. 2020-02-25 16:56:42 +01:00
Armin Novak
0154d3ceb8 audin pulse log states by name 2020-02-25 14:57:42 +01:00
Armin Novak
451c4ddee6 Passing on error code from irp_free 2020-02-21 11:31:21 +01:00
Armin Novak
30db616cec Added a free function to erase streams not processed.
When shutting down the streams still in the queue were not properly
freed.
2020-02-21 11:31:15 +01:00
Armin Novak
bef8dda5e1 Fixed data length for list reader group return. 2020-02-20 15:35:11 +01:00
Armin Novak
5ab0716d7b SCardListReadersW return length is in bytes, not char. 2020-02-20 15:24:03 +01:00
Armin Novak
fd89ff6913 Fixed some conversion warnings. 2020-02-20 14:40:19 +01:00
Armin Novak
9b5f1ab384 Beautify smartcard log. 2020-02-20 13:59:28 +01:00