diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/ChangeLog freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/ChangeLog --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/ChangeLog 2018-11-12 13:46:01.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/ChangeLog 2018-11-12 13:46:01.000000000 +0000 @@ -1,3 +1,1376 @@ +2019-02-01 08:37:24 +0100 akallabeth (2693389a1) + + * Merge pull request #5236 from chipitsine/master + +2019-02-01 03:50:51 +0500 Ilya Shipitsin (d1939cfc4) + + * client/Wayland/wlf_cliprdr.c: resolve possible null pointer + dereference found by cppcheck + +2019-01-30 18:22:45 +0100 David Fort (85161c718) + + * Merge pull request #5223 from akallabeth/scanbuild_null_fixes + +2019-01-30 16:26:41 +0100 Bernhard Miklautz (acebd43ac) + + * Merge pull request #5147 from jphein/master + +2019-01-28 10:56:48 +0100 Armin Novak (2dab77810) + + * Fixed NULL dereferences and uninitialized values + +2019-01-28 10:56:23 +0100 Armin Novak (ef1728faf) + + * Fixed NULL dereferences and uninitialized values + +2019-01-28 10:55:56 +0100 Armin Novak (2a582ed19) + + * Fixed NULL dereferences and uninitialized values + +2019-01-28 10:55:24 +0100 Armin Novak (fe9dcfacc) + + * Fixed NULL dereferences and uninitialized values + +2019-01-30 00:08:55 +0100 David Fort (138a83b47) + + * Merge pull request #5227 from akallabeth/compiler_warnings_fixes + +2019-01-29 17:46:47 +0100 Armin Novak (9033df501) + + * Fixed compiler warnings for TRIO_CONST and limited data type. + +2019-01-29 17:48:05 +0100 Armin Novak (79416f5d3) + + * Fixed missing initializers + +2019-01-29 17:24:29 +0100 Armin Novak (87c7ddeda) + + * Asserting arg->Value to silence clang analyzer NULL argument + checks. + +2019-01-29 17:16:46 +0100 Armin Novak (2e5fd8d16) + + * Fixed clang analyzer false positive memory leaks. + +2019-01-29 17:06:08 +0100 Armin Novak (d5720b799) + + * Fixed clang scanbuild false positive memory leak. + +2019-01-29 16:53:30 +0100 Armin Novak (0dae6933c) + + * Fixed uninitialized return value. + +2019-01-29 16:22:46 +0100 Armin Novak (6a1ff5c48) + + * Fixed compiler warnings #5210 + +2019-01-29 16:15:33 +0100 Armin Novak (5c930dc4a) + + * Fixed compiler warnings #5210 + +2019-01-29 16:15:23 +0100 Armin Novak (51039f653) + + * Fixed compiler warnings #5210 + +2019-01-29 16:14:55 +0100 Armin Novak (9d680904c) + + * Fixed compiler warnings #5210 + +2019-01-29 16:14:29 +0100 Armin Novak (03ec36440) + + * Fixed compiler warnings #5210 + +2019-01-29 15:18:53 +0100 David Fort (70805402b) + + * Merge pull request #5140 from akallabeth/print_custom_component + +2019-01-29 15:11:38 +0100 David Fort (72ad4af35) + + * Merge pull request #5221 from akallabeth/wayland_mouse_cursor + +2019-01-29 14:21:58 +0100 Armin Novak (dd9814df8) + + * Fixed review remarks. + +2019-01-29 13:34:27 +0100 Armin Novak (32d539b70) + + * Removed debug messages. + +2019-01-29 11:07:44 +0100 Armin Novak (f64db12a2) + + * Fixed uninitialized value. + +2019-01-29 10:47:36 +0100 akallabeth (4b95bcfa6) + + * Merge pull request #5224 from hardening/serverStatusInfo + +2019-01-29 10:46:21 +0100 akallabeth (0a8ebcfca) + + * Merge pull request #5187 from astrand/mingw-part1 + +2019-01-29 10:33:06 +0100 David Fort (53c74bead) + + * rdp: add a callback for ServerStatusInfo + +2019-01-28 15:46:12 +0100 Armin Novak (99c92308a) + + * Fixed wayland library detection. + +2019-01-28 15:29:30 +0100 Armin Novak (2418c43ca) + + * Fixed pointer image update. + +2019-01-25 15:46:55 +0100 Armin Novak (52ef8079e) + + * Added O_TMPFILE support for uwac tempfile generation. + +2019-01-25 15:38:56 +0100 Armin Novak (34adfd571) + + * Added UWAC_EVENT_OUTPUT_GEOMETRY event + +2019-01-25 13:05:51 +0100 Armin Novak (23fa6b918) + + * Added mouse cursor callback stubs. + +2019-01-25 16:59:33 +0100 David Fort (05d9d8979) + + * Merge pull request #5149 from akallabeth/cert_deny + +2019-01-25 12:33:18 +0100 MartinHaimberger (0f68ed390) + + * Merge pull request #5150 from akallabeth/gw_consent_callback + +2019-01-25 12:19:56 +0100 akallabeth (7d226ca59) + + * Merge pull request #5218 from ckelsel/master + +2019-01-25 11:42:38 +0100 David Fort (343bc8c6e) + + * Merge pull request #5213 from akallabeth/wayland_and_warning_fixes + +2019-01-25 17:54:25 +0800 xie.kunming (b8c64b6bf) + + * May crash if GetCommandLineW failed + +2019-01-25 10:50:07 +0100 Armin Novak (b1e6e232e) + + * Fixed buffer submit and callback cleanup. + +2019-01-24 15:10:08 +0100 Armin Novak (823411c2f) + + * Fixed wayland buffer updates + +2019-01-24 13:15:40 +0100 Armin Novak (0fd27e0e3) + + * Fixed wayland clipboard registration, retry if seat is detected + before. + +2019-01-25 10:01:30 +0100 akallabeth (8ed0b9292) + + * Merge pull request #5216 from ckelsel/master + +2019-01-25 16:45:52 +0800 xie.kunming (84493d003) + + * If uElapse is less than USER_TIMER_MINIMUM (0x0000000A), the + timeout is set to USER_TIMER_MINIMUM. + +2019-01-24 12:01:40 +0100 Armin Novak (86e20d764) + + * Removed buffer damage tracking in client, let UWAC handle that. + +2019-01-24 11:19:20 +0100 Armin Novak (0cf898e72) + + * Fixed warnings found by compiler and static analysis. + +2019-01-24 11:14:06 +0100 Armin Novak (728cdfd68) + + * Fixed warnings found by compiler and static analysis. + +2019-01-24 11:03:36 +0100 Armin Novak (7b92b91d9) + + * Fixed warnings found by compiler and static analysis. + +2019-01-24 11:00:48 +0100 Armin Novak (ac12adda9) + + * Fixed warnings found by compiler and static analysis. + +2019-01-24 10:33:59 +0100 Armin Novak (4ba73e0c7) + + * Fixed warnings found by compiler and static analysis. + +2019-01-24 11:53:37 +0100 akallabeth (58f616b68) + + * Merge pull request #5212 from hardening/ddm_fix + +2019-01-24 10:30:04 +0100 David Fort (713e9cd5a) + + * uwac: fix initialization of data_device_manager + +2019-01-23 17:15:59 +0100 David Fort (281c85598) + + * Merge pull request #5160 from akallabeth/wayland_clipboard + +2019-01-23 16:22:29 +0100 Armin Novak (087390b30) + + * Refactored client clipboard function callbacks for const data + pointers. + +2019-01-23 16:22:04 +0100 Armin Novak (65812bdbc) + + * Clipboard data pointer arguments are now const. + +2019-01-23 16:01:36 +0100 Armin Novak (891d9760d) + + * Ignore clipboard events if channel not loaded. + +2019-01-22 11:04:50 +0100 Armin Novak (c8e85338b) + + * Fixed missing return. + +2019-01-22 10:56:10 +0100 Armin Novak (d5b355840) + + * Added log messages for unusual error events. + +2019-01-22 10:52:24 +0100 Armin Novak (ceeccd34e) + + * Added assert + +2019-01-22 10:50:34 +0100 Armin Novak (68b5d47d9) + + * Removed internal checks. + +2019-01-22 10:48:32 +0100 Armin Novak (9eb897ea6) + + * Fixed a log message. + +2019-01-22 10:47:26 +0100 Armin Novak (9cdddb772) + + * Fixed some log messages / missing asserts. + +2019-01-16 15:01:49 +0100 Armin Novak (1cec0e034) + + * Fixed NULL dereference. + +2018-12-19 16:18:13 +0100 Armin Novak (ca2e8e4bc) + + * Implemented wayland clipboard. + +2018-12-19 16:17:59 +0100 Armin Novak (0cba9edc9) + + * Implemented UWAC clipboard handling. + +2019-01-23 15:41:42 +0100 David Fort (2843f1ad6) + + * Merge pull request #5159 from akallabeth/wayland_display + +2019-01-23 14:30:31 +0100 David Fort (b18ba3326) + + * Merge pull request #5192 from akallabeth/dynamic_openh264 + +2019-01-23 10:02:07 +0100 David Fort (4c465e7f1) + + * Merge pull request #5209 from + akallabeth/wayland_protocol_update_and_keyboard_inhibit + +2019-01-22 18:09:53 +0100 Armin Novak (9a0c8a5c5) + + * Removed unused label. + +2019-01-22 11:06:11 +0100 Armin Novak (97dfa0757) + + * Fixed duplicated check. + +2018-12-18 12:30:31 +0100 Armin Novak (42ad7a884) + + * Implemented wayland display resize channel. + +2019-01-22 17:20:19 +0100 Armin Novak (3cd3490fd) + + * Fixed initialization of window decorations. + +2019-01-22 16:13:08 +0100 Armin Novak (5c422b7c9) + + * Added KDE server side window decoration interface as fallback. + +2019-01-22 17:04:37 +0100 Martin Fleisz (b6f2a3f43) + + * Merge pull request #5201 from akallabeth/wayland_refresh_fix + +2019-01-22 16:55:46 +0100 Armin Novak (f2fd78512) + + * Fixed comment. + +2019-01-22 16:43:32 +0100 Martin Fleisz (2095fc3eb) + + * Merge pull request #5156 from akallabeth/flatpak_support + +2019-01-22 16:27:57 +0100 akallabeth (4cbd5e166) + + * Merge pull request #5202 from hardening/server_side_license1 + +2019-01-22 15:45:15 +0100 Armin Novak (afd4baf4d) + + * Added wayland server side decorations. + +2019-01-22 15:18:59 +0100 Armin Novak (84d4ff0f0) + + * Updated flatpak build + +2019-01-22 13:46:46 +0100 Armin Novak (81f1fb934) + + * Implemented keyboard shortcut inhibit support. + +2019-01-22 13:09:59 +0100 Armin Novak (0ef64f8a8) + + * Updated fullscreen shell to current protocol level. + +2019-01-22 13:05:46 +0100 Armin Novak (7f158b97b) + + * Update to xdg-shell stable. + +2019-01-22 10:29:08 +0100 Armin Novak (5ef6b7197) + + * Implemented DesktopResize callback for wayland client. + +2018-11-01 11:02:54 +0100 David Fort (f4b7a27c2) + + * license: implement server-side management + +2019-01-18 18:04:23 +0100 David Fort (ad75ae512) + + * Merge pull request #5200 from akallabeth/os2_fixes + +2019-01-18 14:39:14 +0100 Armin Novak (a5cee1751) + + * Resubmit buffer if necessary. + +2019-01-18 14:38:51 +0100 Armin Novak (0b17406ee) + + * Unified buffer update and screen refresh on focus + +2019-01-18 13:13:41 +0100 Armin Novak (4f1462b73) + + * Added fix for OS2 paths. + +2019-01-18 13:04:34 +0100 Armin Novak (c8587cea8) + + * Fixed WINDOW_ORDER_INFO copy. + +2019-01-18 13:03:36 +0100 Armin Novak (f65b94ed8) + + * Yield in connection wait loops to reduce processor use. + +2019-01-18 13:02:30 +0100 Armin Novak (b08505cbe) + + * Fixed return check in SwitchToThread + +2019-01-18 11:18:34 +0100 Martin Fleisz (cf6348939) + + * Merge pull request #5199 from llyzs/freerdp_rdpsnd_winmm + +2019-01-18 17:48:06 +0800 Vic Lee (e2df67ab3) + + * rdpsnd/winmm: remove an unnecessary blocking event. + +2019-01-18 09:11:48 +0100 Martin Fleisz (6dc179ce4) + + * Merge pull request #5197 from akallabeth/leak_fix_lodepng + +2019-01-17 14:46:55 +0100 Martin Fleisz (b131d8d52) + + * Merge pull request #5191 from akallabeth/mac_mouse_support + +2019-01-17 13:44:04 +0100 Armin Novak (4f99c2946) + + * Unified mouse coordinate scaling. + +2019-01-16 15:23:12 +0100 Armin Novak (4d4f3617b) + + * Fixed memory leak in lodepng. + +2019-01-16 14:13:27 +0100 akallabeth (0e5fe9e11) + + * Merge pull request #5196 from bmiklautz/winprhash + +2019-01-16 12:05:47 +0100 Bernhard Miklautz (3498e7694) + + * fix [winpr/hash]: initialize ssl + +2019-01-15 09:49:48 +0100 Armin Novak (8c41bd21e) + + * Added version check for dynamic OpenH264 use. + +2019-01-14 23:25:26 +0100 David Fort (ac0c91300) + + * Merge pull request #5194 from akallabeth/drive_file_size_fix2 + +2019-01-14 14:54:33 +0100 Armin Novak (805741bdf) + + * Fixed #5185 broken file size initialization. + +2019-01-11 11:40:31 +0100 Armin Novak (1c855068a) + + * Using runtime linking for OpenH264. + +2019-01-10 11:09:57 +0100 Armin Novak (a3cfef4e0) + + * Implemented full mouse support for mac client. + +2019-01-09 11:13:38 +0100 Peter Åstrand (astrand) (a7f4b90f3) + + * Pointer arithmetics require lvalue + +2019-01-09 10:04:38 +0100 Peter Åstrand (astrand) (32ba90ec0) + + * Avoid building POSIX clipboard if WIN32 + +2019-01-09 10:01:44 +0100 Peter Åstrand (astrand) (ea35e2387) + + * Check MSVC_RUNTIME only if MSVC is defined + +2019-01-09 09:54:31 +0100 Peter Åstrand (astrand) (6619de070) + + * freerdp_client_set_window_size should not be static + +2019-01-09 09:52:27 +0100 Peter Åstrand (astrand) (fcf59b9c4) + + * Add msimg32 library through CMake + +2019-01-09 09:36:28 +0100 Peter Åstrand (astrand) (30cd1ba1a) + + * Use lowercase for includes and libs + +2019-01-09 09:30:31 +0100 Peter Åstrand (astrand) (9c19c7361) + + * Support Unix Makefiles + +2019-01-08 13:42:42 +0100 David Fort (6be3ba4df) + + * Merge pull request #5186 from akallabeth/test_leak_fix + +2019-01-08 11:20:00 +0100 Armin Novak (6a175d588) + + * Fixed #5167: Memory leak in unit test. + +2019-01-08 10:18:06 +0100 Martin Fleisz (7bc69cd61) + + * Merge pull request #5155 from akallabeth/ext_debug_functions + +2019-01-08 09:45:25 +0100 Martin Fleisz (f8a200462) + + * Merge pull request #5178 from fodinabor/rds-connectionstring + +2019-01-08 09:13:52 +0100 akallabeth (56a01469f) + + * Merge pull request #5184 from chipitsine/master + +2019-01-08 08:06:28 +0100 Martin Fleisz (b0b0d5ede) + + * Merge pull request #5183 from akallabeth/libressl_version_fix + +2019-01-07 23:01:31 +0500 Ilya Shipitsin (f422fe63c) + + * identical code for both branches, found by coverity + +2019-01-07 22:55:08 +0500 Ilya Shipitsin (4403448a7) + + * client/Windows/wf_cliprdr.c: remove redundant check found by + cppcheck + +2019-01-07 15:21:46 +0100 Martin Fleisz (aa442de05) + + * Merge pull request #5174 from chipitsine/master + +2019-01-07 15:21:03 +0100 Martin Fleisz (abd5cf51f) + + * Merge pull request #5180 from chipitsine/coverity + +2019-01-07 14:18:14 +0100 Armin Novak (0c83efa75) + + * Fix #5170: Disable custom TLS alert for libressl > 2.8.3 + +2019-01-07 13:00:48 +0100 Joachim Meyer (c8358fdda) + + * Reject assistance input if not a RA invitation or connection string + 2. + +2019-01-07 10:47:48 +0100 David Fort (6cc13303b) + + * Merge pull request #5182 from akallabeth/mouse_hwheel_direction_fix + +2019-01-07 10:38:55 +0100 Joachim Meyer (7efbae282) + + * Set the username setting again, if it exists. + +2019-01-07 10:02:04 +0100 Armin Novak (b2ef3e69c) + + * Fixed Wayland horizontal mouse wheel direction. + +2019-01-07 10:01:46 +0100 Armin Novak (2dcc2614d) + + * Fixed X11 horizontal mouse wheel direction. + +2019-01-07 08:39:08 +0100 Martin Fleisz (e034d3552) + + * Merge pull request #5173 from hendwolt/master + +2019-01-04 20:56:57 +0500 Ilya Shipitsin (05462d27f) + + * remove identical code, found by coverity + +2019-01-04 20:55:28 +0500 Ilya Shipitsin (e14ba2018) + + * remove identical code, found by coverity + +2019-01-03 20:58:40 +0100 Joachim Meyer (8d50c4ce2) + + * Add support for standard Remote Assistance Connection String 2 + without the extensions of the invitation file format. + +2019-01-02 21:20:39 +0000 Bernhard Miklautz (bab79a995) + + * Merge pull request #5176 from chipitsine/ninja_gitignore + +2019-01-02 21:22:51 +0500 Ilya Shipitsin (43a16a3e5) + + * add ninja to gitignore + +2019-01-02 20:35:24 +0500 Ilya Shipitsin (bdc039e71) + + * resolve several issues found by cppcheck + +2019-01-02 12:51:40 +0100 akallabeth (442ba916b) + + * Merge pull request #5166 from informatimago/detect-kerberos-version + +2019-01-02 11:34:27 +0100 David Fort (4d086c0e4) + + * Merge pull request #5175 from simon04/patch-1 + +2019-01-02 08:18:07 +0100 Simon Legner (ff375d238) + + * fix(crypto/tls): typo + +2018-12-29 09:16:05 +0100 Hendrik Woltersdorf (f561ef957) + + * enable fonts smoothing per default + +2018-12-24 11:17:16 +0100 David Fort (15fd55ded) + + * Merge pull request #5168 from ckelsel/master + +2018-12-24 14:52:59 +0800 kunming.xie (3ef6dd2f7) + + * fix button_set_locked no return statement + +2018-12-21 11:59:04 +0100 Pascal J. Bourguignon (7d07bce64) + + * cmake: made FindGSSAPI.cmake able to detect kerberos versions such + as: "Kerberos 5 release 1.18-prerelease". + +2018-12-18 15:38:41 +0100 David Fort (5b24dc1ac) + + * Merge pull request #5158 from akallabeth/wayland_mouse + +2018-12-17 10:36:55 +0100 Armin Novak (8bf601902) + + * Feature #4841: Added flatpak manifest. + +2018-12-18 13:30:13 +0100 Armin Novak (1984f73db) + + * Implemented horizontal mouse wheel for wayland. + +2018-12-18 13:43:17 +0100 Armin Novak (f647e5cc3) + + * Implemented mouse buttons 4 and 5 for wayland. + +2018-12-17 09:09:02 +0100 Armin Novak (5dea64a46) + + * Added backtrace function working on allocated logger. + +2018-12-14 14:13:38 +0100 David Fort (faff639ad) + + * Merge pull request #5148 from akallabeth/cert_accepted_fail + +2018-12-14 10:17:52 +0100 Armin Novak (b60045af2) + + * New option to disable user certificate dialog + +2018-12-14 09:52:25 +0100 Armin Novak (6906efa35) + + * Fixed return value for already accepted certificate. + +2018-12-14 08:13:42 +0000 Bernhard Miklautz (da819bf77) + + * Merge pull request #5146 from oshogbo/master + +2018-12-13 14:02:38 -0800 Jeffrey Hein (d316e7fa1) + + * Clarified defaults of /floatbar flag + +2018-12-13 14:16:50 +0100 Mariusz Zaborski (4974af1f7) + + * There is only one primary monitor do not look for more. + +2018-12-13 13:48:44 +0100 akallabeth (6c6f08482) + + * Merge pull request #5145 from bmiklautz/sshagent_server + +2018-12-13 10:21:11 +0100 David Fort (b619ba542) + + * Merge pull request #5144 from ondrejholy/coverity2 + +2018-12-13 10:17:46 +0100 Bernhard Miklautz (9f6abd270) + + * fix [channels]: remove sshagent server side + +2018-12-13 09:47:26 +0100 Ondrej Holy (24cdcbccc) + + * uwac: Do not return destroyed UwacSeat + +2018-12-12 21:25:14 +0100 David Fort (3d4b195c4) + + * Merge pull request #5143 from jphein/master + +2018-12-12 11:29:58 -0800 Jeffrey Hein (1e84f00ef) + + * Added help description for /drive:hotplug,* + +2018-12-12 15:40:50 +0100 Armin Novak (34c9404c9) + + * Added OpenSSL include path globally. + +2018-12-12 15:36:39 +0100 akallabeth (b8cfa0f02) + + * Merge pull request #5142 from astrand/master + +2018-12-12 14:42:50 +0100 Armin Novak (31d5a3b0c) + + * Don't reset configuration and driver name when supplied via command + line. + +2018-12-12 14:10:46 +0100 Armin Novak (d13bd66f5) + + * Implemented printer name based backend to remember settings. + +2018-12-12 12:08:34 +0000 Bernhard Miklautz (7be596a5f) + + * Merge pull request #5133 from akallabeth/enable_fonts_by_default + +2018-12-12 11:43:03 +0100 Peter Åstrand (astrand) (9aced5945) + + * Define scancodes for virtual keys, used by VNC servers + +2018-12-12 10:06:41 +0100 Armin Novak (192680a00) + + * Added callback to handle printer custom components in printer + backend. + +2018-12-11 15:24:24 +0100 Armin Novak (8ddabd265) + + * Fix #1195: Implement callback for Gateway Messages + +2018-12-11 14:40:58 +0100 Martin Fleisz (4dac07667) + + * Merge pull request #5134 from oshogbo/master + +2018-12-11 13:34:31 +0100 Mariusz Zaborski (269002f0a) + + * Respect settings while sending the input capabilities. + +2018-12-11 13:02:26 +0100 Armin Novak (717b0eac9) + + * Enable smooth fonts by default. + +2018-12-11 10:30:39 +0100 Martin Fleisz (5bff8bf69) + + * Merge pull request #5125 from + akallabeth/clipboard_string_length_fix + +2018-12-11 09:12:24 +0000 Bernhard Miklautz (2fe1c786c) + + * Merge pull request #5075 from akallabeth/clipboard_channel_cleanup + +2018-12-11 08:53:39 +0000 Bernhard Miklautz (6f6c8473a) + + * Merge pull request #5126 from akallabeth/x11_button_mapping + +2018-12-11 09:32:11 +0100 Armin Novak (0fa9f0656) + + * Modified flag checks to avoid invalid flag sets. + +2018-12-11 09:19:46 +0100 Martin Fleisz (29e2e2221) + + * Merge pull request #5083 from akallabeth/mac_client_fixes + +2018-12-10 18:03:53 +0100 Bernhard Miklautz (b3ff75b59) + + * fix [client/Mac]: UI API needs to be called in main thread + +2018-12-10 17:07:16 +0000 Bernhard Miklautz (531b1b63e) + + * Merge pull request #5128 from akallabeth/rail_crashes + +2018-12-10 15:41:20 +0100 Armin Novak (2ce04069c) + + * Fixed crashes in rail mode after merge of floatbar fixes. + +2018-12-10 14:25:07 +0100 Armin Novak (710292754) + + * X11 extended button remapping support. + +2018-12-10 14:45:10 +0100 Martin Fleisz (b82c4f779) + + * Merge pull request #5020 from akallabeth/floatbar_fixes + +2018-12-10 14:31:38 +0100 Armin Novak (15011b478) + + * Fixed variable hiding by not redeclaring it in subscope. + +2018-12-10 14:02:57 +0100 Armin Novak (66e71ef96) + + * Added missing define for _wcsnlen for windows. + +2018-12-10 13:41:06 +0100 David Fort (9940c0002) + + * Merge pull request #5123 from akallabeth/rail_hash_function + +2018-12-10 12:23:13 +0000 Bernhard Miklautz (27ca916cf) + + * Merge pull request #5124 from akallabeth/cert_accept_fix + +2018-12-10 12:41:04 +0100 Armin Novak (d198f7308) + + * Fix #5121: Determine actual string length for input data + +2018-12-10 12:39:32 +0100 Armin Novak (1e644fc37) + + * Added _wcsnlen function for WCHAR string length. + +2018-12-10 12:03:55 +0100 Armin Novak (d2ac7acdd) + + * Fixed certificate accept + +2018-12-10 11:58:43 +0100 Martin Fleisz (97c5210db) + + * Merge pull request #5096 from akallabeth/dsp_channel_mix + +2018-12-10 11:16:43 +0100 Armin Novak (0d3192b9f) + + * Fixed rail window key hash function to work with UINT32 + +2018-12-10 10:26:52 +0100 akallabeth (2927114e7) + + * Merge pull request #5117 from hardening/rail_hash + +2018-12-07 10:33:07 +0100 David Fort (88e361fa0) + + * rails: allow a window with id == 0 + +2018-12-07 15:45:05 +0100 Armin Novak (9166df355) + + * Fixed windows floatbar title. + +2018-12-07 15:45:59 +0100 Martin Fleisz (fc12b9336) + + * Merge pull request #5109 from akallabeth/gw_logging + +2018-11-21 09:54:09 +0100 Armin Novak (4fd8987f5) + + * Unified windows client window title settings. + +2018-11-21 09:49:50 +0100 Armin Novak (594d10620) + + * Fixed #5040: Unified xfreerdp window title setting. + +2018-11-16 10:33:29 +0100 Armin Novak (6a9fa3dcb) + + * Refactored floatbar, extended command line settings. + +2016-06-22 14:58:39 -0400 Don Caton (68c34d5ab) + + * Windows client: Suppress minimize and restore buttons in float bar + when toggle-fullscreen is false, added window title to + float bar, improved overall appearance with gradients, + shadow and transparent icons. + +2016-06-14 14:15:08 -0400 Don Caton (352a65b49) + + * Updated .gitignore to exclude Visual Studio 2015 db files + +2018-11-15 17:58:00 +0100 Armin Novak (ac702e073) + + * Updated settings.h + +2018-11-15 17:53:28 +0100 Armin Novak (e7724cb8c) + + * Fixed a compiler warning for iterator type + +2018-11-15 17:35:52 +0100 Armin Novak (5343f6931) + + * Fixed monitor width and height checks. + +2018-11-15 14:42:31 +0100 Armin Novak (56156d217) + + * Floatbar self contained. + +2018-12-06 10:07:15 +0100 Armin Novak (aa12026ef) + + * Added additional gateway error logging. + +2018-12-07 13:03:46 +0000 Bernhard Miklautz (6c88c2173) + + * Merge pull request #5099 from akallabeth/floatbar_close_window + +2018-12-07 12:30:55 +0000 Bernhard Miklautz (62515cfd4) + + * Merge pull request #5118 from akallabeth/pem_warn_fix + +2018-12-07 12:36:18 +0100 Armin Novak (d05217454) + + * Fix #5115: Cast PEM data from BYTE* to char* to silence warnings. + +2018-12-07 11:30:58 +0100 David Fort (696fa22fb) + + * Merge pull request #5116 from akallabeth/drive_ts_fix + +2018-12-07 11:28:22 +0100 Martin Fleisz (d0688f058) + + * Merge pull request #5102 from akallabeth/rail_cleanups + +2018-12-07 10:59:52 +0100 Armin Novak (fdf9ca327) + + * Fixed #5113: The timestamps for FileFullDirectoryInformation were + inverted. + +2018-11-30 11:35:40 +0100 Armin Novak (ace9bfffd) + + * Moved to extended certificate verification API + +2018-11-29 18:35:20 +0100 Armin Novak (ec8cc65a1) + + * Fixed compile issue + +2018-11-29 18:13:31 +0100 Armin Novak (730b6f02c) + + * Fixed glitches with certificate dialog. + +2018-11-29 17:23:09 +0100 Armin Novak (ec34657ff) + + * Added certificate dialog. + +2018-11-29 16:29:07 +0100 Armin Novak (4dd6e7577) + + * Added client callbacks. + +2018-11-29 15:50:43 +0100 Armin Novak (e3c85eb3d) + + * removed strcpy + +2018-11-29 15:46:37 +0100 Armin Novak (c8938c357) + + * Updated mac build. + +2018-12-06 10:08:17 +0100 Martin Fleisz (8c7f8eb39) + + * Merge pull request #5085 from akallabeth/cert_callbacks_update + +2018-12-06 09:39:50 +0100 Armin Novak (0aaf14bed) + + * Fixe accidental removal of certificate_data_replace + +2018-12-05 16:27:05 +0100 Martin Fleisz (f678a91d6) + + * Merge pull request #5106 from hardening/wayland_seat7 + +2018-12-05 15:21:00 +0100 David Fort (b9ceb1305) + + * uwac: handle wl_seat with version >= 7 + +2018-12-05 15:20:11 +0100 David Fort (42c083eae) + + * script: add a usefull script to create code snippets from + specification blobs + +2018-12-05 11:24:51 +0100 akallabeth (5e0fef582) + + * Merge pull request #5104 from hardening/license_2k3 + +2018-12-05 11:20:34 +0100 Martin Fleisz (7db6ac063) + + * Merge pull request #5036 from akallabeth/auth_fixes + +2018-12-05 11:19:53 +0100 Martin Fleisz (bb187d8ea) + + * Merge pull request #5103 from akallabeth/android_timezone + +2018-12-05 10:57:43 +0100 Martin Fleisz (30b31b7fb) + + * Merge pull request #5062 from + akallabeth/init_freerdp_image_copy_from_pointer_data + +2018-11-20 18:01:13 +0100 Armin Novak (e49adfc51) + + * Updated error info from spec. + +2018-11-20 17:27:47 +0100 Armin Novak (8110c391b) + + * Fixed requested protocol define names according to spec. + +2018-11-20 17:03:50 +0100 Armin Novak (b1d2a4767) + + * Fixed warnings in nego. + +2018-11-20 16:48:59 +0100 Armin Novak (82863a851) + + * Refactored NLA to be self contained. + +2018-11-20 16:40:42 +0100 Armin Novak (80d246283) + + * Hide redirection implementation details. + +2018-11-20 16:38:06 +0100 Armin Novak (5ca8eca18) + + * Made nego self contained. + +2018-12-05 10:50:47 +0100 David Fort (635b17d0a) + + * license: fix licencing against windows 2003 server + +2018-12-05 10:20:21 +0100 Armin Novak (3d487d071) + + * Fixed #5093: Try to read timezone from java TimeZone first + +2018-12-05 09:13:04 +0100 Armin Novak (f5e449a4f) + + * Cleaned up xf_rail_server_handshake + +2018-12-05 08:58:08 +0100 akallabeth (1b4ee6594) + + * Merge pull request #5100 from wintersandroid/master + +2018-12-04 22:42:25 +0100 David Fort (46ffa611c) + + * Merge pull request #5097 from hualet/master + +2018-12-05 07:56:05 +1300 Mathew Winters (bd7ff9b10) + + * Add jni interface for get_last_error_string + +2018-12-04 16:56:22 +0100 Armin Novak (0c13c3199) + + * Follow up to #4959: Lock gdi_UpdateSurfaces like xf_UpdateSurfaces + +2018-12-04 16:42:28 +0100 Armin Novak (d260d4e29) + + * Fixed #5098: Abort connection and let the application clean up + resources before exit. + +2018-12-04 16:40:44 +0100 Martin Fleisz (df6d045f4) + + * Merge pull request #5087 from hardening/remotefx_chunks + +2018-12-04 14:38:11 +0100 David Fort (a1c203322) + + * Merge pull request #5094 from akallabeth/suppress_output_setting + +2018-12-04 14:29:59 +0100 Martin Fleisz (5510f9304) + + * Merge pull request #4959 from akallabeth/gfx_lock_fix + +2018-12-04 20:28:32 +0800 Hualet Wang (e33efccf4) + + * Fixed RAIL window can't show again once hidden + +2018-12-04 11:38:02 +0100 Armin Novak (e46575671) + + * Fix #5019: Added channel up/downmixing code for mono/stereo. + +2018-11-30 11:37:23 +0100 David Fort (579a13b05) + + * remotefx: don't require data messages to come all in one chunk + +2018-12-04 10:31:01 +0100 Martin Fleisz (4108fc51a) + + * Merge pull request #5077 from akallabeth/win_client_fixes + +2018-11-30 11:41:51 +0100 Armin Novak (b27470405) + + * Duplicate PEM when accepted. + +2018-11-30 11:04:20 +0100 Armin Novak (e04c319d2) + + * Added new default certificate callbacks with extended information. + +2018-11-30 10:36:15 +0100 Armin Novak (a8823fdf9) + + * Cleaned up certificate verification code. + +2018-11-30 10:25:06 +0100 Armin Novak (7ab07ab98) + + * Added certificate callbacks with source indications. + +2018-11-30 09:55:10 +0100 Armin Novak (dd3276d66) + + * Prefer VerifyX509Certificate and fixed const arguments + +2018-12-03 16:15:51 +0100 Armin Novak (1398fa5b2) + + * Fixed missing NULL check for thread handle. + +2018-11-28 16:09:38 +0100 Armin Novak (0831c34fc) + + * Fix #4730: Add git revision, architecture and minimum os support to + file properties. + +2018-11-28 14:44:26 +0100 Armin Novak (c5512de26) + + * Fix #4999: Increase reference count + +2018-11-28 13:12:28 +0100 Armin Novak (53b018bfe) + + * Fix callback function return types. + +2018-11-28 13:12:04 +0100 Armin Novak (22be8f21a) + + * Fix length type, use size_t + +2018-11-29 18:42:32 +0000 Alessandro Muggianu (9b1c9da6a) + + * Make "suppress output" setting available on command line + +2018-12-04 08:23:14 +0000 Bernhard Miklautz (1e27c3d19) + + * Merge pull request #5091 from akallabeth/ios_compiles_again + +2018-12-03 17:23:55 +0100 Armin Novak (d27cd1b19) + + * Fixed unit tests, use uniqe file names + +2018-12-03 17:06:43 +0100 Armin Novak (6a75bc806) + + * Updated OpenSSL version for iOS + +2018-12-03 16:54:56 +0100 Armin Novak (4c3626340) + + * Set minimum deployment target to 10.0 + +2018-12-03 14:45:16 +0100 Martin Fleisz (47066c25e) + + * Merge pull request #5082 from akallabeth/win_env_fix + +2018-11-29 16:24:28 +0100 David Fort (7ad24b606) + + * Merge pull request #5080 from akallabeth/scanbuild-ex-warn + +2018-11-29 13:44:21 +0100 Armin Novak (edd6d49f2) + + * Fix #4909: Do not initialize HOME environment variable as it is no + longer used. + +2018-11-29 13:22:23 +0100 David Fort (06e2651b4) + + * Merge pull request #5081 from akallabeth/kerberos_config_option + +2018-11-29 13:00:22 +0100 Armin Novak (b8b308af7) + + * Add WITH_GSSAPI config option, defaults to OFF + +2018-11-29 12:14:20 +0100 Armin Novak (aeeaba5bc) + + * Fixed a memory leak. + +2018-11-29 11:07:46 +0100 Armin Novak (d975fd045) + + * Fixed zero sized allocation. + +2018-11-29 11:06:41 +0100 Armin Novak (7ec9e942f) + + * Fixed zero sized allocation. + +2018-11-29 11:05:13 +0100 Armin Novak (16a761319) + + * Fixed zero sized allocation. + +2018-11-29 11:10:14 +0000 Bernhard Miklautz (1a33b3383) + + * Merge pull request #5070 from akallabeth/gw_fixes_redirection + +2018-10-23 11:52:06 +0200 Armin Novak (2e019b2fd) + + * Implemented GFX locking and enforce return value checks. + +2018-11-29 10:57:46 +0100 Armin Novak (c97d4eec6) + + * Fixed uninitialized value. + +2018-11-29 09:50:12 +0000 Bernhard Miklautz (62d982b62) + + * Merge pull request #5073 from akallabeth/trust_settings + +2018-11-29 10:02:28 +0100 David Fort (7478a938a) + + * Merge pull request #5074 from akallabeth/ycbcr_padding_fix + +2018-11-28 17:46:18 +0100 David Fort (e7a44bc43) + + * Merge pull request #5057 from + akallabeth/order_settings_init_generic + +2018-11-28 09:32:28 +0100 Armin Novak (f3e1ffb12) + + * Fix #4764: Second try, use X509_STORE_CTX_set_purpose + +2018-11-28 11:40:15 +0100 Armin Novak (81a0cd701) + + * Fixed clipboard channel cleanup. + +2018-11-28 11:05:45 +0100 Armin Novak (98bc4358e) + + * Fixed padding of general_yCbCrToRGB_16s8u_P3AC4R* functions. + +2018-11-26 14:11:29 +0100 Armin Novak (263cc7458) + + * Fixed buffer reset in fields_present_to_string + +2018-11-26 13:01:00 +0000 Bernhard Miklautz (657087e3a) + + * Merge pull request #5066 from akallabeth/ssl_verify_fix + +2018-11-26 11:10:59 +0000 Bernhard Miklautz (52d1b35a6) + + * Merge pull request #5046 from akallabeth/silence_wlog + +2018-11-26 11:03:42 +0000 Bernhard Miklautz (e06ed191a) + + * Merge pull request #5067 from akallabeth/gfx_log_fix + +2018-11-26 08:12:51 +0100 Armin Novak (77744200a) + + * Fix #4768: Set SSL verify purpose to ANY + +2018-11-26 10:57:20 +0000 Bernhard Miklautz (0b8010f8d) + + * Merge pull request #5065 from akallabeth/tcp_connect_multi_fix + +2018-11-26 11:33:23 +0100 Armin Novak (d06c3980a) + + * Fixed error log for avc420_decompress failures. + +2018-11-23 09:16:23 +0100 Armin Novak (0d8a1e108) + + * Fix #5061: Initialize output buffer transparent. + +2018-11-23 10:49:00 +0100 MartinHaimberger (8ae6b463e) + + * Merge pull request #5064 from akallabeth/rdg_length_check_fix + +2018-11-23 10:32:52 +0100 Armin Novak (5623a4761) + + * Fixed a possible NULL dereference. + +2018-11-22 16:54:42 +0100 Armin Novak (7d89ea22d) + + * Unified initialization of OrderSupport + +2018-11-23 10:03:56 +0100 Martin Fleisz (394bc6286) + + * Merge pull request #5035 from akallabeth/better_cmdline_format + +2018-11-23 09:48:08 +0100 Martin Fleisz (9684a06f8) + + * Merge pull request #5053 from akallabeth/sample_client_update + +2018-11-23 09:45:09 +0100 Armin Novak (391528f40) + + * Fixed a broken length check in rdg_process_packet + +2018-11-22 22:22:57 +0000 Bernhard Miklautz (4c4e5b887) + + * Merge pull request #5060 from akallabeth/small_fixes + +2018-11-22 19:10:05 +0100 akallabeth (effa8b856) + + * Fix #5049: Libressl declares OPENSSL_VERSION_NUMBER too high + +2018-11-22 19:08:25 +0100 akallabeth (d0d414dfa) + + * Fix #5059: Changed return type of peer_free to void. + +2018-11-22 17:53:00 +0100 David Fort (edcff62ff) + + * Merge pull request #5058 from akallabeth/wtsapi_warning_fix + +2018-11-22 17:28:31 +0100 Armin Novak (96fe23193) + + * Initialize WtsApi32_WtsApiFunctionTable NULL + +2018-11-22 16:28:30 +0100 Armin Novak (e6e87eb3b) + + * Unified strto[u]l in cmdline.c + +2018-11-20 14:11:10 +0100 Armin Novak (2f8737d97) + + * Improved formatting of terminal help messages. + +2018-11-22 15:50:52 +0100 David Fort (8d62ced6a) + + * Merge pull request #5056 from akallabeth/direct_fb_remove + +2018-11-22 15:10:58 +0100 Martin Fleisz (6c97d318e) + + * Merge pull request #5022 from akallabeth/gw_rdg_error_mapping + +2018-11-22 14:37:10 +0100 Armin Novak (fff22f027) + + * Removed DirectFB client as it is unmaintained + +2018-11-22 14:29:22 +0100 Armin Novak (3110b5f5c) + + * Simplified string empty check. + +2018-11-22 14:03:01 +0100 Martin Fleisz (3610ab0ac) + + * Merge pull request #5054 from akallabeth/spelling_fix + +2018-11-22 12:06:30 +0100 Armin Novak (a471fc593) + + * Spelling fix in log message. + +2018-11-22 11:47:58 +0100 Martin Fleisz (1331d0b77) + + * Merge pull request #4998 from akallabeth/assistance_v2 + +2018-11-22 11:21:57 +0100 Armin Novak (7ba34962e) + + * Removed duplcate NULL checks. + +2018-11-22 11:19:12 +0100 Armin Novak (f79eeb744) + + * Fixed NULL access checks. + +2018-11-22 11:17:13 +0100 Armin Novak (f904d8463) + + * Fixed freerdp_assistance_parse_address_list + +2018-11-22 11:16:43 +0100 Armin Novak (3f655db3c) + + * Fixed test_msrsc_incident_file_type1 return checks. + +2018-11-21 15:03:30 +0100 Armin Novak (59e9abc73) + + * Fixed memory leak in reallocate. + +2018-11-12 13:40:40 +0100 Armin Novak (c8908c8be) + + * Updated windows shadow server assistance usage. + +2018-11-12 12:37:33 +0100 Armin Novak (8df39fdad) + + * Use blocking sockets in freerdp_tcp_connect_multi + +2018-11-12 11:16:24 +0100 Armin Novak (1ed436c8f) + + * Fixed socket cleanup in connect multi. + +2018-11-12 10:34:21 +0100 Armin Novak (a531930f3) + + * Disable NLA for remote assistance. + +2018-11-12 10:33:46 +0100 Armin Novak (6c02a1c7d) + + * Fixed version check for remote assistance channel. + +2018-11-12 09:19:38 +0100 Armin Novak (484ceaed3) + + * Fixed assistance unit test. + +2018-11-09 15:21:13 +0100 Armin Novak (4b3f4cc2f) + + * Fixed event check in freerdp_tcp_connect_multi + +2018-11-09 15:20:37 +0100 Armin Novak (e1555662d) + + * Set username from assistance file. + +2018-11-09 14:42:10 +0100 Armin Novak (35c1eac6e) + + * Unified address parsing for assistance files. + +2018-11-08 09:27:57 +0100 Armin Novak (6de2129a9) + + * assistance v2 support + +2018-11-22 10:45:12 +0100 Martin Fleisz (a1712a6c9) + + * Merge pull request #5051 from akallabeth/libressl_fix + +2018-11-22 10:22:40 +0100 Armin Novak (6ab3d3e8f) + + * Fix #5052: Updated client sample + +2018-11-22 09:23:46 +0100 Armin Novak (649f49fa6) + + * Fix #5049: LibreSSL does not have SSL_CTX_set_security_level + +2018-11-21 16:03:18 +0100 David Fort (5e7ac925f) + + * Merge pull request #5045 from akallabeth/license_double_free_fix + +2018-11-21 16:02:47 +0100 Martin Fleisz (947aa8003) + + * Merge pull request #5016 from akallabeth/windows_server_build_fix + +2018-11-21 15:36:31 +0100 Armin Novak (17bbe7a23) + + * Do not compile extended authentication debugging by default. + +2018-11-21 15:03:42 +0100 Armin Novak (feb993b94) + + * Fixed double free in license_free_binary_blob + +2018-11-21 15:06:58 +0100 MartinHaimberger (66733e9c3) + + * Merge pull request #5041 from akallabeth/compile_fix + +2018-11-21 14:32:07 +0100 Armin Novak (cdf1ee61f) + + * Proper field to string debug functions for each response in RDG + +2018-11-21 11:49:45 +0100 akallabeth (1cc739f10) + + * Merge pull request #5039 from mcsong/master + +2018-11-21 09:55:38 +0100 Armin Novak (a97bf2110) + + * Fixed broken DEBUG_RDP log message. + +2018-11-21 09:18:38 +0100 Armin Novak (d8d30a055) + + * Fix #5037: Fix calls to ntlm_print_av_pair_list + +2018-11-20 13:11:14 -0800 mcsong (34e8b9271) + + * Fixed recreate activity issue when a bluetooth device connected or + disconnected + +2018-11-20 12:57:07 -0800 mcsong (1d7fd201b) + + * Fixed recreate activity issue when a bluetooth device connected or + disconnected. + +2018-11-20 12:14:28 +0100 akallabeth (3cea4bfb5) + + * Merge pull request #5008 from wintersandroid/master + +2018-11-20 12:05:47 +0100 akallabeth (bfbe0cb3d) + + * Merge pull request #5033 from bmiklautz/dev5 + +2018-11-20 11:49:34 +0100 Bernhard Miklautz (58091dc13) + + * new: development cycle dev5 + 2018-11-20 11:43:51 +0100 akallabeth (e21b72c95) * Merge pull request #5032 from bmiklautz/rc4 @@ -98,6 +1471,10 @@ * Merge pull request #5025 from DustPuppyNet/openssl_1_1_1 +2018-11-19 08:27:36 +1300 Mathew Winters (eceb107dd) + + * Revert store password variable + 2018-11-18 14:09:37 +0000 Christian Gall (fffe4f077) * * remove obsolete SSLv23_client_method in tls_connect() * set min @@ -112,6 +1489,14 @@ * call xf_SetWindowTitle before XMapWindow, so window manager can act on window name +2018-11-16 15:48:10 +0100 Armin Novak (7839091f8) + + * Skip redirection resolve test if we're connecting via gateway. + +2018-11-16 15:41:19 +0100 Armin Novak (870b7025b) + + * Improved error mapping and tightened checks in rdg_process_packet + 2018-11-15 17:52:43 +0100 Armin Novak (d2e1248b0) * Fixed profiler API @@ -153,6 +1538,14 @@ * Merge pull request #5012 from akallabeth/rail_app_icons +2018-11-14 15:13:11 +0100 Armin Novak (26b83ea74) + + * Reenabled and fixed windows server compile. + +2018-11-14 14:59:58 +0100 Armin Novak (a2cd93418) + + * Fixed windows build warnings. + 2018-11-15 08:43:54 +0100 akallabeth (cf2c8ef6a) * Merge pull request #5015 from chipitsine/cleanup @@ -165,6 +1558,10 @@ * remove not needed check +2018-11-15 08:29:51 +1300 Mathew Winters (0e88eb5a9) + + * Fixes as per merge request + 2018-11-14 13:45:31 +0100 akallabeth (268a2c0cf) * Merge pull request #4979 from hardening/CAL @@ -276,6 +1673,10 @@ * Updated RDP_VERSION definitions. +2018-11-14 15:25:38 +1300 Mathew Winters (f91a4d0b6) + + * Resolve thread not exiting when remote lost or disconnected. + 2018-11-13 14:39:39 +0100 akallabeth (ca6d1d591) * Merge pull request #5005 from bmiklautz/nightly_build @@ -365,6 +1766,14 @@ * Fixed #2039: Check for overflow in calculations. +2018-11-09 15:20:52 +1300 Mathew (2ff19597d) + + * fix scripts to build with ndk r15c, cache dependancies so we are + not hitting github often update android dependancies to + latest and compile. ./android-build-freerdp.sh --ndk + ~/Programming/android-ndk-r15c --relWithDebug --jpeg Still + an error compiling openh264 + 2018-11-08 17:41:56 +0100 Armin Novak (cf8bc72dc) * Fixed profiler naming in tests. diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/audin/client/opensles/audin_opensl_es.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/audin/client/opensles/audin_opensl_es.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/audin/client/opensles/audin_opensl_es.c 2018-10-08 10:56:09.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/audin/client/opensles/audin_opensl_es.c 2019-01-02 15:35:24.000000000 +0000 @@ -93,11 +93,6 @@ WLog_Print(opensles->log, WLOG_DEBUG, "device=%p", (void*) device); - /* The function may have been called out of order, - * ignore duplicate requests. */ - if (!opensles) - return CHANNEL_RC_OK; - free(opensles->device_name); free(opensles); return CHANNEL_RC_OK; @@ -154,11 +149,6 @@ (void*) device, (void*) format, FramesPerPacket); assert(format); - /* The function may have been called out of order, ignore - * requests before the device is available. */ - if (!opensles) - return CHANNEL_RC_OK; - opensles->format = *format; switch (format->wFormatTag) diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/audin/client/oss/audin_oss.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/audin/client/oss/audin_oss.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/audin/client/oss/audin_oss.c 2018-10-25 11:08:16.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/audin/client/oss/audin_oss.c 2019-01-28 09:56:23.000000000 +0000 @@ -279,7 +279,7 @@ err_out: - if (error && oss->rdpcontext) + if (error && oss && oss->rdpcontext) setChannelError(oss->rdpcontext, error, "audin_oss_thread_func reported an error"); diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/audin/client/winmm/audin_winmm.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/audin/client/winmm/audin_winmm.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/audin/client/winmm/audin_winmm.c 2018-07-30 09:22:11.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/audin/client/winmm/audin_winmm.c 2019-01-09 08:36:28.000000000 +0000 @@ -27,8 +27,8 @@ #include #include -#include -#include +#include +#include #include #include diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/cliprdr/client/cliprdr_main.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/cliprdr/client/cliprdr_main.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/cliprdr/client/cliprdr_main.c 2018-08-24 07:54:25.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/cliprdr/client/cliprdr_main.c 2019-01-23 15:22:04.000000000 +0000 @@ -216,7 +216,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_process_clip_caps(cliprdrPlugin* cliprdr, wStream* s, - UINT16 length, UINT16 flags) + UINT32 length, UINT16 flags) { UINT16 index; UINT16 lengthCapability; @@ -257,7 +257,6 @@ default: WLog_ERR(TAG, "unknown cliprdr capability set: %"PRIu16"", capabilitySetType); return CHANNEL_RC_BAD_PROC; - break; } } @@ -270,7 +269,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_process_monitor_ready(cliprdrPlugin* cliprdr, wStream* s, - UINT16 length, UINT16 flags) + UINT32 length, UINT16 flags) { CLIPRDR_MONITOR_READY monitorReady; CliprdrClientContext* context = cliprdr_get_client_interface(cliprdr); @@ -587,10 +586,10 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_capabilities(CliprdrClientContext* context, - CLIPRDR_CAPABILITIES* capabilities) + const CLIPRDR_CAPABILITIES* capabilities) { wStream* s; - CLIPRDR_GENERAL_CAPABILITY_SET* generalCapabilitySet; + const CLIPRDR_GENERAL_CAPABILITY_SET* generalCapabilitySet; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; s = cliprdr_packet_new(CB_CLIP_CAPS, 0, 4 + CB_CAPSTYPE_GENERAL_LEN); @@ -602,7 +601,7 @@ Stream_Write_UINT16(s, 1); /* cCapabilitiesSets */ Stream_Write_UINT16(s, 0); /* pad1 */ - generalCapabilitySet = (CLIPRDR_GENERAL_CAPABILITY_SET*)capabilities->capabilitySets; + generalCapabilitySet = (const CLIPRDR_GENERAL_CAPABILITY_SET*)capabilities->capabilitySets; Stream_Write_UINT16(s, generalCapabilitySet->capabilitySetType); /* capabilitySetType */ Stream_Write_UINT16(s, generalCapabilitySet->capabilitySetLength); /* lengthCapability */ Stream_Write_UINT32(s, generalCapabilitySet->version); /* version */ @@ -617,7 +616,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_temp_directory(CliprdrClientContext* context, - CLIPRDR_TEMP_DIRECTORY* tempDirectory) + const CLIPRDR_TEMP_DIRECTORY* tempDirectory) { int length; wStream* s; @@ -639,8 +638,8 @@ if (length > 520) length = 520; - Stream_Write(s, wszTempDir, length * 2); - Stream_Zero(s, (520 - length) * 2); + Stream_Write(s, wszTempDir, (size_t)length * 2); + Stream_Zero(s, (520 - (size_t)length) * 2); free(wszTempDir); WLog_Print(cliprdr->log, WLOG_DEBUG, "TempDirectory: %s", tempDirectory->szTempDir); @@ -653,15 +652,15 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_format_list(CliprdrClientContext* context, - CLIPRDR_FORMAT_LIST* formatList) + const CLIPRDR_FORMAT_LIST* formatList) { wStream* s; UINT32 index; - int length = 0; + UINT32 length = 0; int cchWideChar; LPWSTR lpWideCharStr; - int formatNameSize; - int formatNameLength; + size_t formatNameSize; + size_t formatNameLength; char* szFormatName; WCHAR* wszFormatName; BOOL asciiNames = FALSE; @@ -703,8 +702,14 @@ wszFormatName = NULL; if (szFormatName) - formatNameSize = ConvertToUnicode(CP_UTF8, 0, szFormatName, -1, &wszFormatName, - 0); + { + int rc = ConvertToUnicode(CP_UTF8, 0, szFormatName, -1, &wszFormatName, 0); + + if (rc < 0) + return ERROR_INTERNAL_ERROR; + + formatNameSize = (size_t)rc; + } if (formatNameSize > 15) formatNameSize = 15; @@ -726,8 +731,14 @@ formatNameSize = 2; if (format->formatName) - formatNameSize = MultiByteToWideChar(CP_UTF8, 0, format->formatName, -1, NULL, - 0) * 2; + { + int rc = MultiByteToWideChar(CP_UTF8, 0, format->formatName, -1, NULL, 0); + + if (rc < 0) + return ERROR_INTERNAL_ERROR; + + formatNameSize = (size_t)rc * 2; + } length += formatNameSize; } @@ -771,14 +782,12 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_format_list_response(CliprdrClientContext* context, - CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse) + const CLIPRDR_FORMAT_LIST_RESPONSE* formatListResponse) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; - formatListResponse->msgType = CB_FORMAT_LIST_RESPONSE; - formatListResponse->dataLen = 0; - s = cliprdr_packet_new(formatListResponse->msgType, - formatListResponse->msgFlags, formatListResponse->dataLen); + s = cliprdr_packet_new(CB_FORMAT_LIST_RESPONSE, + formatListResponse->msgFlags, 0); if (!s) { @@ -796,7 +805,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_lock_clipboard_data(CliprdrClientContext* context, - CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData) + const CLIPRDR_LOCK_CLIPBOARD_DATA* lockClipboardData) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; @@ -821,7 +830,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_unlock_clipboard_data(CliprdrClientContext* context, - CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData) + const CLIPRDR_UNLOCK_CLIPBOARD_DATA* unlockClipboardData) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; @@ -846,15 +855,12 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_format_data_request(CliprdrClientContext* context, - CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest) + const CLIPRDR_FORMAT_DATA_REQUEST* formatDataRequest) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; - formatDataRequest->msgType = CB_FORMAT_DATA_REQUEST; - formatDataRequest->msgFlags = 0; - formatDataRequest->dataLen = 4; - s = cliprdr_packet_new(formatDataRequest->msgType, formatDataRequest->msgFlags, - formatDataRequest->dataLen); + + s = cliprdr_packet_new(CB_FORMAT_DATA_REQUEST, 0, 4); if (!s) { @@ -873,12 +879,12 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_format_data_response(CliprdrClientContext* context, - CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse) + const CLIPRDR_FORMAT_DATA_RESPONSE* formatDataResponse) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; - formatDataResponse->msgType = CB_FORMAT_DATA_RESPONSE; - s = cliprdr_packet_new(formatDataResponse->msgType, + + s = cliprdr_packet_new(CB_FORMAT_DATA_RESPONSE, formatDataResponse->msgFlags, formatDataResponse->dataLen); if (!s) @@ -899,7 +905,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_file_contents_request(CliprdrClientContext* context, - CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest) + const CLIPRDR_FILE_CONTENTS_REQUEST* fileContentsRequest) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; @@ -933,7 +939,7 @@ * @return 0 on success, otherwise a Win32 error code */ static UINT cliprdr_client_file_contents_response(CliprdrClientContext* context, - CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse) + const CLIPRDR_FILE_CONTENTS_RESPONSE* fileContentsResponse) { wStream* s; cliprdrPlugin* cliprdr = (cliprdrPlugin*) context->handle; @@ -989,7 +995,7 @@ return CHANNEL_RC_NO_MEMORY; } - if (!Stream_EnsureRemainingCapacity(data_in, (int) dataLength)) + if (!Stream_EnsureRemainingCapacity(data_in, dataLength)) { Stream_Free(cliprdr->data_in, TRUE); cliprdr->data_in = NULL; @@ -1100,6 +1106,17 @@ return error; } +static void cliprdr_free_msg(void* obj) +{ + wMessage* msg = (wMessage*)obj; + + if (msg) + { + wStream* s = (wStream*)msg->wParam; + Stream_Free(s, TRUE); + } +} + /** * Function description * @@ -1109,6 +1126,7 @@ LPVOID pData, UINT32 dataLength) { UINT32 status; + wObject obj = { 0 }; status = cliprdr->channelEntryPoints.pVirtualChannelOpenEx(cliprdr->InitHandle, &cliprdr->OpenHandle, cliprdr->channelDef.name, cliprdr_virtual_channel_open_event_ex); @@ -1120,7 +1138,8 @@ return status; } - cliprdr->queue = MessageQueue_New(NULL); + obj.fnObjectFree = cliprdr_free_msg; + cliprdr->queue = MessageQueue_New(&obj); if (!cliprdr->queue) { diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/drdynvc/client/drdynvc_main.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/drdynvc/client/drdynvc_main.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/drdynvc/client/drdynvc_main.c 2018-10-03 13:16:59.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/drdynvc/client/drdynvc_main.c 2019-01-02 15:35:24.000000000 +0000 @@ -1447,12 +1447,12 @@ { UINT status; - if (drdynvc->OpenHandle == 0) - return CHANNEL_RC_OK; - if (!drdynvc) return CHANNEL_RC_BAD_CHANNEL_HANDLE; + if (drdynvc->OpenHandle == 0) + return CHANNEL_RC_OK; + if (!MessageQueue_PostQuit(drdynvc->queue, 0)) { status = GetLastError(); diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/drive/client/drive_file.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/drive/client/drive_file.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/drive/client/drive_file.c 2018-09-24 14:00:27.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/drive/client/drive_file.c 2019-01-24 09:33:59.000000000 +0000 @@ -54,8 +54,7 @@ static void drive_file_fix_path(WCHAR* path) { size_t i; - size_t length; - length = (int) _wcslen(path); + size_t length = _wcslen(path); for (i = 0; i < length; i++) { @@ -80,10 +79,10 @@ } static WCHAR* drive_file_combine_fullpath(const WCHAR* base_path, const WCHAR* path, - UINT32 PathLength) + size_t PathLength) { WCHAR* fullpath; - UINT32 base_path_length; + size_t base_path_length; if (!base_path || !path) return NULL; @@ -107,11 +106,10 @@ { WIN32_FIND_DATAW findFileData; BOOL ret = TRUE; - INT len; HANDLE dir; WCHAR* fullpath; WCHAR* path_slash; - UINT32 base_path_length; + size_t base_path_length; if (!path) return FALSE; @@ -140,7 +138,7 @@ do { - len = _wcslen(findFileData.cFileName); + size_t len = _wcslen(findFileData.cFileName); if ((len == 1 && findFileData.cFileName[0] == L'.') || (len == 2 && findFileData.cFileName[0] == L'.' && findFileData.cFileName[1] == L'.')) @@ -335,7 +333,7 @@ file->file_handle = INVALID_HANDLE_VALUE; file->find_handle = INVALID_HANDLE_VALUE; file->id = id; - file->basepath = (WCHAR*) base_path; + file->basepath = base_path; file->FileAttributes = FileAttributes; file->DesiredAccess = DesiredAccess; file->CreateDisposition = CreateDisposition; @@ -397,7 +395,10 @@ if (!file) return FALSE; - loffset.QuadPart = Offset; + if (Offset > INT64_MAX) + return FALSE; + + loffset.QuadPart = (LONGLONG)Offset; return SetFilePointerEx(file->file_handle, loffset, NULL, FILE_BEGIN); } @@ -615,6 +616,8 @@ return FALSE; } + liSize.QuadPart = size; + if (!SetFilePointerEx(file->file_handle, liSize, NULL, FILE_BEGIN)) { WLog_ERR(TAG, "Unable to truncate %s to %d (%"PRId32")", file->fullpath, size, GetLastError()); @@ -755,7 +758,10 @@ if (!Stream_EnsureRemainingCapacity(output, 4 + 64 + length)) goto out_fail; - Stream_Write_UINT32(output, 64 + length); /* Length */ + if (length > UINT32_MAX - 64) + goto out_fail; + + Stream_Write_UINT32(output, (UINT32)(64 + length)); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ Stream_Write_UINT32(output, 0); /* FileIndex */ Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */ @@ -771,7 +777,7 @@ Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */ Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */ Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */ - Stream_Write_UINT32(output, length); /* FileNameLength */ + Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */ Stream_Write(output, file->find_data.cFileName, length); break; @@ -781,23 +787,26 @@ if (!Stream_EnsureRemainingCapacity(output, 4 + 68 + length)) goto out_fail; - Stream_Write_UINT32(output, 68 + length); /* Length */ + if (length > UINT32_MAX - 68) + goto out_fail; + + Stream_Write_UINT32(output, (UINT32)(68 + length)); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ Stream_Write_UINT32(output, 0); /* FileIndex */ - Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */ Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */ - Stream_Write_UINT32(output, file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */ + Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwHighDateTime); /* CreationTime */ Stream_Write_UINT32(output, file->find_data.ftLastAccessTime.dwLowDateTime); /* LastAccessTime */ - Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */ + Stream_Write_UINT32(output, file->find_data.ftLastAccessTime.dwHighDateTime); /* LastAccessTime */ Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* LastWriteTime */ - Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */ + Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* LastWriteTime */ Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwLowDateTime); /* ChangeTime */ + Stream_Write_UINT32(output, file->find_data.ftLastWriteTime.dwHighDateTime); /* ChangeTime */ Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* EndOfFile */ Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* EndOfFile */ Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */ Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */ Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */ - Stream_Write_UINT32(output, length); /* FileNameLength */ + Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */ Stream_Write_UINT32(output, 0); /* EaSize */ Stream_Write(output, file->find_data.cFileName, length); break; @@ -808,7 +817,10 @@ if (!Stream_EnsureRemainingCapacity(output, 4 + 93 + length)) goto out_fail; - Stream_Write_UINT32(output, 93 + length); /* Length */ + if (length > UINT32_MAX - 93) + goto out_fail; + + Stream_Write_UINT32(output, (UINT32)(93 + length)); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ Stream_Write_UINT32(output, 0); /* FileIndex */ Stream_Write_UINT32(output, file->find_data.ftCreationTime.dwLowDateTime); /* CreationTime */ @@ -824,7 +836,7 @@ Stream_Write_UINT32(output, file->find_data.nFileSizeLow); /* AllocationSize */ Stream_Write_UINT32(output, file->find_data.nFileSizeHigh); /* AllocationSize */ Stream_Write_UINT32(output, file->find_data.dwFileAttributes); /* FileAttributes */ - Stream_Write_UINT32(output, length); /* FileNameLength */ + Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */ Stream_Write_UINT32(output, 0); /* EaSize */ Stream_Write_UINT8(output, 0); /* ShortNameLength */ /* Reserved(1), MUST NOT be added! */ @@ -838,14 +850,18 @@ if (!Stream_EnsureRemainingCapacity(output, 4 + 12 + length)) goto out_fail; - Stream_Write_UINT32(output, 12 + length); /* Length */ + if (length > UINT32_MAX - 12) + goto out_fail; + + Stream_Write_UINT32(output, (UINT32)(12 + length)); /* Length */ Stream_Write_UINT32(output, 0); /* NextEntryOffset */ Stream_Write_UINT32(output, 0); /* FileIndex */ - Stream_Write_UINT32(output, length); /* FileNameLength */ + Stream_Write_UINT32(output, (UINT32)length); /* FileNameLength */ Stream_Write(output, file->find_data.cFileName, length); break; default: + WLog_ERR(TAG, "unhandled FsInformationClass %"PRIu32, FsInformationClass); /* Unhandled FsInformationClass */ goto out_fail; } diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/drive/client/drive_file.h freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/drive/client/drive_file.h --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/drive/client/drive_file.h 2017-07-17 10:31:13.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/drive/client/drive_file.h 2019-01-24 09:33:59.000000000 +0000 @@ -40,7 +40,7 @@ HANDLE file_handle; HANDLE find_handle; WIN32_FIND_DATAW find_data; - WCHAR* basepath; + const WCHAR* basepath; WCHAR* fullpath; WCHAR* filename; BOOL delete_pending; diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/printer/client/printer_cups.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/printer/client/printer_cups.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/printer/client/printer_cups.c 2017-05-30 08:46:43.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/printer/client/printer_cups.c 2018-12-12 14:40:50.000000000 +0000 @@ -84,7 +84,7 @@ * * @return 0 on success, otherwise a Win32 error code */ -static UINT printer_cups_write_printjob(rdpPrintJob* printjob, BYTE* data, int size) +static UINT printer_cups_write_printjob(rdpPrintJob* printjob, const BYTE* data, size_t size) { rdpCupsPrintJob* cups_printjob = (rdpCupsPrintJob*) printjob; diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/printer/client/printer_main.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/printer/client/printer_main.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/printer/client/printer_main.c 2018-09-18 12:45:25.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/printer/client/printer_main.c 2019-01-29 16:16:46.000000000 +0000 @@ -35,8 +35,10 @@ #include #include #include +#include #include +#include #include "../printer.h" @@ -71,6 +73,364 @@ char port[64]; }; +typedef enum +{ + PRN_CONF_PORT = 0, + PRN_CONF_PNP = 1, + PRN_CONF_DRIVER = 2, + PRN_CONF_DATA = 3 +} +prn_conf_t; + +static const char* filemap[] = +{ + "PortDosName", + "PnPName", + "DriverName", + "CachedPrinterConfigData" +}; + +static char* get_printer_config_path(const rdpSettings* settings, const WCHAR* name, size_t length) +{ + char* dir = GetCombinedPath(settings->ConfigPath, "printers"); + char* bname = crypto_base64_encode((const BYTE*) name, (int)length); + char* config = GetCombinedPath(dir, bname); + + if (config && !PathFileExistsA(config)) + { + if (!PathMakePathA(config, NULL)) + { + free(config); + config = NULL; + } + } + + free(dir); + free(bname); + return config; +} + +static BOOL printer_write_setting(const char* path, prn_conf_t type, const void* data, + size_t length) +{ + DWORD written = 0; + BOOL rc = FALSE; + HANDLE file; + size_t b64len; + char* base64 = NULL; + const char* name = filemap[type]; + char* abs = GetCombinedPath(path, name); + + if (!abs) + return FALSE; + + file = CreateFileA(abs, GENERIC_WRITE, 0, + NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + free(abs); + + if (file == INVALID_HANDLE_VALUE) + return FALSE; + + if (length > 0) + { + base64 = crypto_base64_encode(data, length); + + if (!base64) + goto fail; + + b64len = strlen(base64); + rc = WriteFile(file, base64, b64len, &written, NULL); + + if (b64len != written) + rc = FALSE; + } + else + rc = TRUE; + +fail: + CloseHandle(file); + free(base64); + return rc; +} + +static BOOL printer_config_valid(const char* path) +{ + if (!path) + return FALSE; + + if (!PathFileExistsA(path)) + return FALSE; + + return TRUE; +} + +static BOOL printer_read_setting(const char* path, prn_conf_t type, void** data, size_t* length) +{ + DWORD lowSize, highSize; + DWORD read = 0; + BOOL rc = FALSE; + HANDLE file; + BYTE* fdata = NULL; + const char* name = filemap[type]; + char* abs = GetCombinedPath(path, name); + + if (!abs) + return FALSE; + + file = CreateFileA(abs, GENERIC_READ, 0, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + free(abs); + + if (file == INVALID_HANDLE_VALUE) + return FALSE; + + lowSize = GetFileSize(file, &highSize); + + if ((lowSize == INVALID_FILE_SIZE) || (highSize != 0)) + goto fail; + + if (lowSize != 0) + { + fdata = malloc(lowSize); + + if (!fdata) + goto fail; + + rc = ReadFile(file, fdata, lowSize, &read, NULL); + + if (lowSize != read) + rc = FALSE; + } + +fail: + CloseHandle(file); + + if (rc) + { + int blen = 0; + crypto_base64_decode(fdata, lowSize, data, &blen); + + if (*data) + *length = blen; + else + { + rc = FALSE; + *length = 0; + } + } + else + { + *length = 0; + *data = NULL; + } + + free(fdata); + return rc; +} + +static BOOL printer_save_to_config(const rdpSettings* settings, + const char* PortDosName, size_t PortDosNameLen, + const WCHAR* PnPName, size_t PnPNameLen, + const WCHAR* DriverName, size_t DriverNameLen, + const WCHAR* PrinterName, size_t PrintNameLen, + const BYTE* CachedPrinterConfigData, size_t CacheFieldsLen) +{ + BOOL rc = FALSE; + char* path = get_printer_config_path(settings, PrinterName, PrintNameLen); + + if (!path) + goto fail; + + if (!printer_write_setting(path, PRN_CONF_PORT, PortDosName, PortDosNameLen)) + goto fail; + + if (!printer_write_setting(path, PRN_CONF_PNP, PnPName, PnPNameLen)) + goto fail; + + if (!printer_write_setting(path, PRN_CONF_DRIVER, DriverName, DriverNameLen)) + goto fail; + + if (!printer_write_setting(path, PRN_CONF_DATA, CachedPrinterConfigData, CacheFieldsLen)) + goto fail; + +fail: + free(path); + return rc; +} + +static BOOL printer_update_to_config(const rdpSettings* settings, const WCHAR* name, size_t length, + const BYTE* data, size_t datalen) +{ + BOOL rc = FALSE; + char* path = get_printer_config_path(settings, name, length); + rc = printer_write_setting(path, PRN_CONF_DATA, data, datalen); + free(path); + return rc; +} + +static BOOL printer_remove_config(const rdpSettings* settings, const WCHAR* name, size_t length) +{ + BOOL rc = FALSE; + char* path = get_printer_config_path(settings, name, length); + + if (!printer_config_valid(path)) + goto fail; + + rc = RemoveDirectoryA(path); +fail: + free(path); + return rc; +} + +static BOOL printer_move_config(const rdpSettings* settings, const WCHAR* oldName, size_t oldLength, + const WCHAR* newName, size_t newLength) +{ + BOOL rc = FALSE; + char* oldPath = get_printer_config_path(settings, oldName, oldLength); + char* newPath = get_printer_config_path(settings, newName, newLength); + + if (printer_config_valid(oldPath)) + rc = MoveFileA(oldPath, newPath); + + free(oldPath); + free(newPath); + return rc; +} + +static BOOL printer_load_from_config(const rdpSettings* settings, rdpPrinter* printer, + PRINTER_DEVICE* printer_dev) +{ + BOOL res = FALSE; + WCHAR* wname = NULL; + size_t wlen; + char* path = NULL; + int rc; + UINT32 flags = 0; + WCHAR* DriverName = NULL; + size_t DriverNameLen = 0; + WCHAR* PnPName = NULL; + size_t PnPNameLen = 0; + BYTE* CachedPrinterConfigData = NULL; + size_t CachedFieldsLen = 0; + size_t PrinterNameLen = 0; + + if (!settings || !printer) + return FALSE; + + rc = ConvertToUnicode(CP_UTF8, 0, printer->name, -1, &wname, 0); + + if (rc <= 0) + goto fail; + + wlen = _wcslen(wname) + 1; + path = get_printer_config_path(settings, wname, wlen * sizeof(WCHAR)); + PrinterNameLen = (wlen + 1) * sizeof(WCHAR); + + if (!path) + goto fail; + + if (printer->is_default) + flags |= RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER; + + if (!printer_read_setting(path, PRN_CONF_PNP, &PnPName, &PnPNameLen)) + { + } + + if (!printer_read_setting(path, PRN_CONF_DRIVER, &DriverName, &DriverNameLen)) + { + DriverNameLen = ConvertToUnicode(CP_UTF8, 0, printer->driver, -1, &DriverName, + 0) * 2 + 1; + } + + if (!printer_read_setting(path, PRN_CONF_DATA, &CachedPrinterConfigData, &CachedFieldsLen)) + { + } + + Stream_SetPosition(printer_dev->device.data, 0); + + if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, 24)) + goto fail; + + Stream_Write_UINT32(printer_dev->device.data, flags); + Stream_Write_UINT32(printer_dev->device.data, 0); /* CodePage, reserved */ + Stream_Write_UINT32(printer_dev->device.data, PnPNameLen); /* PnPNameLen */ + Stream_Write_UINT32(printer_dev->device.data, DriverNameLen); + Stream_Write_UINT32(printer_dev->device.data, PrinterNameLen); + Stream_Write_UINT32(printer_dev->device.data, CachedFieldsLen); + + if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, PnPNameLen)) + goto fail; + + if (PnPNameLen > 0) + Stream_Write(printer_dev->device.data, PnPName, PnPNameLen); + + if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, DriverNameLen)) + goto fail; + + Stream_Write(printer_dev->device.data, DriverName, DriverNameLen); + + if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, PrinterNameLen)) + goto fail; + + Stream_Write(printer_dev->device.data, wname, PrinterNameLen); + + if (!Stream_EnsureRemainingCapacity(printer_dev->device.data, CachedFieldsLen)) + goto fail; + + Stream_Write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen); + res = TRUE; +fail: + free(path); + free(wname); + free(PnPName); + free(DriverName); + free(CachedPrinterConfigData); + return res; +} + +static BOOL printer_save_default_config(const rdpSettings* settings, rdpPrinter* printer) +{ + BOOL res = FALSE; + WCHAR* wname = NULL; + WCHAR* driver = NULL; + size_t wlen, dlen; + char* path = NULL; + int rc; + + if (!settings || !printer) + return FALSE; + + rc = ConvertToUnicode(CP_UTF8, 0, printer->name, -1, &wname, 0); + + if (rc <= 0) + goto fail; + + rc = ConvertToUnicode(CP_UTF8, 0, printer->driver, -1, &driver, 0); + + if (rc <= 0) + goto fail; + + wlen = _wcslen(wname) + 1; + dlen = _wcslen(driver) + 1; + path = get_printer_config_path(settings, wname, wlen * sizeof(WCHAR)); + + if (!path) + goto fail; + + if (dlen > 1) + { + if (!printer_write_setting(path, PRN_CONF_DRIVER, driver, dlen * sizeof(WCHAR))) + goto fail; + } + + res = TRUE; +fail: + free(path); + free(wname); + free(driver); + return res; +} + /** * Function description * @@ -293,6 +653,182 @@ return CHANNEL_RC_OK; } +static UINT printer_custom_component(DEVICE* device, UINT16 component, UINT16 packetId, wStream* s) +{ + UINT32 eventID; + PRINTER_DEVICE* printer_dev = (PRINTER_DEVICE*) device; + const rdpSettings* settings = printer_dev->rdpcontext->settings; + + if (component != RDPDR_CTYP_PRN) + return ERROR_INVALID_DATA; + + if (Stream_GetRemainingLength(s) < 4) + return ERROR_INVALID_DATA; + + Stream_Read_UINT32(s, eventID); + + switch (packetId) + { + case PAKID_PRN_CACHE_DATA: + switch (eventID) + { + case RDPDR_ADD_PRINTER_EVENT: + { + char PortDosName[8]; + UINT32 PnPNameLen, DriverNameLen, PrintNameLen, CacheFieldsLen; + const WCHAR* PnPName, *DriverName, *PrinterName; + const BYTE* CachedPrinterConfigData; + + if (Stream_GetRemainingLength(s) < 24) + return ERROR_INVALID_DATA; + + Stream_Read(s, PortDosName, sizeof(PortDosName)); + Stream_Read_UINT32(s, PnPNameLen); + Stream_Read_UINT32(s, DriverNameLen); + Stream_Read_UINT32(s, PrintNameLen); + Stream_Read_UINT32(s, CacheFieldsLen); + + if (Stream_GetRemainingLength(s) < PnPNameLen) + return ERROR_INVALID_DATA; + + PnPName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, PnPNameLen); + + if (Stream_GetRemainingLength(s) < DriverNameLen) + return ERROR_INVALID_DATA; + + DriverName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, DriverNameLen); + + if (Stream_GetRemainingLength(s) < PrintNameLen) + return ERROR_INVALID_DATA; + + PrinterName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, PrintNameLen); + + if (Stream_GetRemainingLength(s) < CacheFieldsLen) + return ERROR_INVALID_DATA; + + CachedPrinterConfigData = Stream_Pointer(s); + Stream_Seek(s, CacheFieldsLen); + + if (!printer_save_to_config(settings, + PortDosName, sizeof(PortDosName), + PnPName, PnPNameLen, + DriverName, DriverNameLen, + PrinterName, PrintNameLen, + CachedPrinterConfigData, CacheFieldsLen)) + return ERROR_INTERNAL_ERROR; + } + break; + + case RDPDR_UPDATE_PRINTER_EVENT: + { + UINT32 PrinterNameLen, ConfigDataLen; + const WCHAR* PrinterName; + const BYTE* ConfigData; + + if (Stream_GetRemainingLength(s) < 8) + return ERROR_INVALID_DATA; + + Stream_Read_UINT32(s, PrinterNameLen); + Stream_Read_UINT32(s, ConfigDataLen); + + if (Stream_GetRemainingLength(s) < PrinterNameLen) + return ERROR_INVALID_DATA; + + PrinterName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, PrinterNameLen); + + if (Stream_GetRemainingLength(s) < ConfigDataLen) + return ERROR_INVALID_DATA; + + ConfigData = Stream_Pointer(s); + Stream_Seek(s, ConfigDataLen); + + if (!printer_update_to_config(settings, PrinterName, PrinterNameLen, ConfigData, ConfigDataLen)) + return ERROR_INTERNAL_ERROR; + } + break; + + case RDPDR_DELETE_PRINTER_EVENT: + { + UINT32 PrinterNameLen; + const WCHAR* PrinterName; + + if (Stream_GetRemainingLength(s) < 4) + return ERROR_INVALID_DATA; + + Stream_Read_UINT32(s, PrinterNameLen); + + if (Stream_GetRemainingLength(s) < PrinterNameLen) + return ERROR_INVALID_DATA; + + PrinterName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, PrinterNameLen); + printer_remove_config(settings, PrinterName, PrinterNameLen); + } + break; + + case RDPDR_RENAME_PRINTER_EVENT: + { + UINT32 OldPrinterNameLen, NewPrinterNameLen; + const WCHAR* OldPrinterName; + const WCHAR* NewPrinterName; + + if (Stream_GetRemainingLength(s) < 8) + return ERROR_INVALID_DATA; + + Stream_Read_UINT32(s, OldPrinterNameLen); + Stream_Read_UINT32(s, NewPrinterNameLen); + + if (Stream_GetRemainingLength(s) < OldPrinterNameLen) + return ERROR_INVALID_DATA; + + OldPrinterName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, OldPrinterNameLen); + + if (Stream_GetRemainingLength(s) < NewPrinterNameLen) + return ERROR_INVALID_DATA; + + NewPrinterName = (const WCHAR*)Stream_Pointer(s); + Stream_Seek(s, NewPrinterNameLen); + + if (!printer_move_config(settings, OldPrinterName, OldPrinterNameLen, NewPrinterName, + NewPrinterNameLen)) + return ERROR_INTERNAL_ERROR; + } + break; + + default: + WLog_ERR(TAG, "Unknown cache data eventID: 0x%08"PRIX32"", eventID); + return ERROR_INVALID_DATA; + } + + break; + + case PAKID_PRN_USING_XPS: + { + UINT32 flags; + + if (Stream_GetRemainingLength(s) < 4) + return ERROR_INVALID_DATA; + + Stream_Read_UINT32(s, flags); + WLog_ERR(TAG, + "Ignoring unhandled message PAKID_PRN_USING_XPS [printerID=%08"PRIx32", flags=%08"PRIx32"]", + eventID, flags); + } + break; + + default: + WLog_ERR(TAG, "Unknown printing component packetID: 0x%04"PRIX16"", packetId); + return ERROR_INVALID_DATA; + } + + return CHANNEL_RC_OK; +} + /** * Function description * @@ -309,7 +845,13 @@ { error = GetLastError(); WLog_ERR(TAG, "WaitForSingleObject failed with error %"PRIu32"", error); + + /* The analyzer is confused by this premature return value. + * Since this case can not be handled gracefully silence the + * analyzer here. */ +#ifndef __clang_analyzer__ return error; +#endif } while ((irp = (IRP*) InterlockedPopEntrySList(printer_dev->pIrpList)) != NULL) @@ -336,15 +878,8 @@ UINT printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer) { - UINT32 Flags; - int DriverNameLen; - WCHAR* DriverName = NULL; - int PrintNameLen; - WCHAR* PrintName = NULL; - UINT32 CachedFieldsLen; - BYTE* CachedPrinterConfigData; PRINTER_DEVICE* printer_dev; - UINT error; + UINT error = ERROR_INTERNAL_ERROR; printer_dev = (PRINTER_DEVICE*) calloc(1, sizeof(PRINTER_DEVICE)); if (!printer_dev) @@ -353,55 +888,19 @@ return CHANNEL_RC_NO_MEMORY; } + printer_dev->device.data = Stream_New(NULL, 1024); + + if (!printer_dev->device.data) + goto error_out; + sprintf_s(printer_dev->port, sizeof(printer_dev->port), "PRN%d", printer->id); printer_dev->device.type = RDPDR_DTYP_PRINT; printer_dev->device.name = printer_dev->port; printer_dev->device.IRPRequest = printer_irp_request; + printer_dev->device.CustomComponentRequest = printer_custom_component; printer_dev->device.Free = printer_free; printer_dev->rdpcontext = pEntryPoints->rdpcontext; printer_dev->printer = printer; - CachedFieldsLen = 0; - CachedPrinterConfigData = NULL; - Flags = 0; - - if (printer->is_default) - Flags |= RDPDR_PRINTER_ANNOUNCE_FLAG_DEFAULTPRINTER; - - DriverNameLen = ConvertToUnicode(CP_UTF8, 0, printer->driver, -1, &DriverName, - 0) * 2; - PrintNameLen = ConvertToUnicode(CP_UTF8, 0, printer->name, -1, &PrintName, - 0) * 2; - printer_dev->device.data = Stream_New(NULL, - 28 + DriverNameLen + PrintNameLen + CachedFieldsLen); - - if (!printer_dev->device.data) - { - WLog_ERR(TAG, "calloc failed!"); - error = CHANNEL_RC_NO_MEMORY; - free(DriverName); - free(PrintName); - goto error_out; - } - - Stream_Write_UINT32(printer_dev->device.data, Flags); - Stream_Write_UINT32(printer_dev->device.data, 0); /* CodePage, reserved */ - Stream_Write_UINT32(printer_dev->device.data, 0); /* PnPNameLen */ - Stream_Write_UINT32(printer_dev->device.data, DriverNameLen + 2); - Stream_Write_UINT32(printer_dev->device.data, PrintNameLen + 2); - Stream_Write_UINT32(printer_dev->device.data, CachedFieldsLen); - Stream_Write(printer_dev->device.data, DriverName, DriverNameLen); - Stream_Write_UINT16(printer_dev->device.data, 0); - Stream_Write(printer_dev->device.data, PrintName, PrintNameLen); - Stream_Write_UINT16(printer_dev->device.data, 0); - - if (CachedFieldsLen > 0) - { - Stream_Write(printer_dev->device.data, CachedPrinterConfigData, - CachedFieldsLen); - } - - free(DriverName); - free(PrintName); printer_dev->pIrpList = (WINPR_PSLIST_HEADER) _aligned_malloc(sizeof( WINPR_SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT); @@ -412,6 +911,9 @@ goto error_out; } + if (!printer_load_from_config(pEntryPoints->rdpcontext->settings, printer, printer_dev)) + goto error_out; + InitializeSListHead(printer_dev->pIrpList); if (!(printer_dev->event = CreateEvent(NULL, TRUE, FALSE, NULL))) @@ -497,6 +999,9 @@ return CHANNEL_RC_INITIALIZATION_ERROR; } + if (!printer_save_default_config(pEntryPoints->rdpcontext->settings, printer)) + return CHANNEL_RC_INITIALIZATION_ERROR; + if ((error = printer_register(pEntryPoints, printer))) { WLog_ERR(TAG, "printer_register failed with error %"PRIu32"!", error); diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/printer/client/printer_main.h freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/printer/client/printer_main.h --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/printer/client/printer_main.h 2017-06-06 12:01:41.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/printer/client/printer_main.h 2018-12-12 14:40:50.000000000 +0000 @@ -54,7 +54,7 @@ pcFreePrinter Free; }; -typedef UINT (*pcWritePrintJob) (rdpPrintJob* printjob, BYTE* data, int size); +typedef UINT (*pcWritePrintJob) (rdpPrintJob* printjob, const BYTE* data, size_t size); typedef void (*pcClosePrintJob) (rdpPrintJob* printjob); struct rdp_print_job diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpdr/client/devman.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpdr/client/devman.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpdr/client/devman.c 2018-10-19 09:30:01.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpdr/client/devman.c 2019-01-29 15:15:23.000000000 +0000 @@ -68,8 +68,8 @@ devman->plugin = (void*) rdpdr; devman->id_sequence = 1; - devman->devices = ListDictionary_New(TRUE); + if (!devman->devices) { WLog_INFO(TAG, "ListDictionary_New failed!"); @@ -78,7 +78,6 @@ } ListDictionary_ValueObject(devman->devices)->fnObjectFree = devman_device_free; - return devman; } @@ -114,26 +113,57 @@ return ERROR_INVALID_PARAMETER; device->id = devman->id_sequence++; - key = (void*) (size_t) device->id; + key = (void*)(size_t) device->id; if (!ListDictionary_Add(devman->devices, key, device)) { WLog_INFO(TAG, "ListDictionary_Add failed!"); return ERROR_INTERNAL_ERROR; } + return CHANNEL_RC_OK; } DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id) { DEVICE* device = NULL; - void* key = (void*) (size_t) id; + void* key = (void*)(size_t) id; if (!devman) return NULL; device = (DEVICE*) ListDictionary_GetItemValue(devman->devices, key); + return device; +} +DEVICE* devman_get_device_by_type(DEVMAN* devman, UINT32 type) +{ + DEVICE* device = NULL; + ULONG_PTR* keys; + int count, x; + + if (!devman) + return NULL; + + ListDictionary_Lock(devman->devices); + count = ListDictionary_GetKeys(devman->devices, &keys); + + for (x = 0; x < count; x++) + { + DEVICE* cur = (DEVICE*) ListDictionary_GetItemValue(devman->devices, (void*)keys[x]); + + if (!cur) + continue; + + if (cur->type != type) + continue; + + device = cur; + break; + } + + free(keys); + ListDictionary_Unlock(devman->devices); return device; } @@ -178,7 +208,9 @@ WLog_INFO(TAG, "Loading device service %s [%s] (static)", ServiceName, device->Name); else WLog_INFO(TAG, "Loading device service %s (static)", ServiceName); - entry = (PDEVICE_SERVICE_ENTRY) freerdp_load_channel_addin_entry(ServiceName, NULL, "DeviceServiceEntry", 0); + + entry = (PDEVICE_SERVICE_ENTRY) freerdp_load_channel_addin_entry(ServiceName, NULL, + "DeviceServiceEntry", 0); if (!entry) { @@ -190,6 +222,5 @@ ep.RegisterDevice = devman_register_device; ep.device = device; ep.rdpcontext = rdpcontext; - return entry(&ep); } diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpdr/client/devman.h freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpdr/client/devman.h --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpdr/client/devman.h 2015-08-27 12:25:09.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpdr/client/devman.h 2018-12-12 09:06:41.000000000 +0000 @@ -28,6 +28,7 @@ void devman_unregister_device(DEVMAN* devman, void* key); UINT devman_load_device_service(DEVMAN* devman, RDPDR_DEVICE* device, rdpContext* rdpcontext); DEVICE* devman_get_device_by_id(DEVMAN* devman, UINT32 id); +DEVICE* devman_get_device_by_type(DEVMAN* devman, UINT32 type); DEVMAN* devman_new(rdpdrPlugin* rdpdr); void devman_free(DEVMAN* devman); diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpdr/client/rdpdr_main.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpdr/client/rdpdr_main.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpdr/client/rdpdr_main.c 2018-10-29 14:17:42.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpdr/client/rdpdr_main.c 2018-12-12 09:06:41.000000000 +0000 @@ -135,7 +135,8 @@ { UINT type = GetDriveTypeA(path); - if (!(type == DRIVE_FIXED ||type == DRIVE_REMOVABLE || type == DRIVE_CDROM || type == DRIVE_REMOTE)) + if (!(type == DRIVE_FIXED || type == DRIVE_REMOVABLE || type == DRIVE_CDROM || + type == DRIVE_REMOTE)) return FALSE; return GetVolumeInformationA(path, NULL, 0, NULL, NULL, NULL, NULL, 0); @@ -1324,6 +1325,31 @@ return error; } +static UINT rdpdr_process_component(rdpdrPlugin* rdpdr, UINT16 component, UINT16 packetId, + wStream* s) +{ + UINT32 type; + DEVICE* device; + + switch (component) + { + case RDPDR_CTYP_PRN: + type = RDPDR_DTYP_PRINT; + break; + + default: + return ERROR_INVALID_DATA; + } + + device = devman_get_device_by_type(rdpdr->devman, type); + + if (!device) + return ERROR_INVALID_PARAMETER; + + return IFCALLRESULT(ERROR_INVALID_PARAMETER, device->CustomComponentRequest, device, component, + packetId, s); +} + /** * Function description * @@ -1368,141 +1394,114 @@ UINT16 packetId; UINT32 deviceId; UINT32 status; - UINT error; + UINT error = ERROR_INVALID_DATA; if (!rdpdr || !s) return CHANNEL_RC_NULL_DATA; - if (Stream_GetRemainingLength(s) < 4) - return ERROR_INVALID_DATA; - - Stream_Read_UINT16(s, component); /* Component (2 bytes) */ - Stream_Read_UINT16(s, packetId); /* PacketId (2 bytes) */ - - if (component == RDPDR_CTYP_CORE) + if (Stream_GetRemainingLength(s) >= 4) { - switch (packetId) - { - case PAKID_CORE_SERVER_ANNOUNCE: - if ((error = rdpdr_process_server_announce_request(rdpdr, s))) - return error; - - if ((error = rdpdr_send_client_announce_reply(rdpdr))) - { - WLog_ERR(TAG, "rdpdr_send_client_announce_reply failed with error %"PRIu32"", error); - return error; - } - - if ((error = rdpdr_send_client_name_request(rdpdr))) - { - WLog_ERR(TAG, "rdpdr_send_client_name_request failed with error %"PRIu32"", error); - return error; - } + Stream_Read_UINT16(s, component); /* Component (2 bytes) */ + Stream_Read_UINT16(s, packetId); /* PacketId (2 bytes) */ - if ((error = rdpdr_process_init(rdpdr))) - { - WLog_ERR(TAG, "rdpdr_process_init failed with error %"PRIu32"", error); - return error; - } - - break; - - case PAKID_CORE_SERVER_CAPABILITY: - if ((error = rdpdr_process_capability_request(rdpdr, s))) - return error; + if (component == RDPDR_CTYP_CORE) + { + switch (packetId) + { + case PAKID_CORE_SERVER_ANNOUNCE: + if ((error = rdpdr_process_server_announce_request(rdpdr, s))) + { + } + else if ((error = rdpdr_send_client_announce_reply(rdpdr))) + { + WLog_ERR(TAG, "rdpdr_send_client_announce_reply failed with error %"PRIu32"", error); + } + else if ((error = rdpdr_send_client_name_request(rdpdr))) + { + WLog_ERR(TAG, "rdpdr_send_client_name_request failed with error %"PRIu32"", error); + } + else if ((error = rdpdr_process_init(rdpdr))) + { + WLog_ERR(TAG, "rdpdr_process_init failed with error %"PRIu32"", error); + } - if ((error = rdpdr_send_capability_response(rdpdr))) - { - WLog_ERR(TAG, "rdpdr_send_capability_response failed with error %"PRIu32"", error); - return error; - } + break; - break; + case PAKID_CORE_SERVER_CAPABILITY: + if ((error = rdpdr_process_capability_request(rdpdr, s))) + { + } + else if ((error = rdpdr_send_capability_response(rdpdr))) + { + WLog_ERR(TAG, "rdpdr_send_capability_response failed with error %"PRIu32"", error); + } - case PAKID_CORE_CLIENTID_CONFIRM: - if ((error = rdpdr_process_server_clientid_confirm(rdpdr, s))) - return error; + break; - if ((error = rdpdr_send_device_list_announce_request(rdpdr, FALSE))) - { - WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %"PRIu32"", - error); - return error; - } + case PAKID_CORE_CLIENTID_CONFIRM: + if ((error = rdpdr_process_server_clientid_confirm(rdpdr, s))) + { + } + else if ((error = rdpdr_send_device_list_announce_request(rdpdr, FALSE))) + { + WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %"PRIu32"", + error); + } - break; + break; - case PAKID_CORE_USER_LOGGEDON: - if ((error = rdpdr_send_device_list_announce_request(rdpdr, TRUE))) - { - WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %"PRIu32"", - error); - return error; - } + case PAKID_CORE_USER_LOGGEDON: + if ((error = rdpdr_send_device_list_announce_request(rdpdr, TRUE))) + { + WLog_ERR(TAG, "rdpdr_send_device_list_announce_request failed with error %"PRIu32"", + error); + } - break; + break; - case PAKID_CORE_DEVICE_REPLY: + case PAKID_CORE_DEVICE_REPLY: - /* connect to a specific resource */ - if (Stream_GetRemainingLength(s) < 8) - return ERROR_INVALID_DATA; + /* connect to a specific resource */ + if (Stream_GetRemainingLength(s) >= 8) + { + Stream_Read_UINT32(s, deviceId); + Stream_Read_UINT32(s, status); + error = CHANNEL_RC_OK; + } - Stream_Read_UINT32(s, deviceId); - Stream_Read_UINT32(s, status); - break; + break; - case PAKID_CORE_DEVICE_IOREQUEST: - if ((error = rdpdr_process_irp(rdpdr, s))) - { - WLog_ERR(TAG, "rdpdr_process_irp failed with error %"PRIu32"", error); - return error; - } + case PAKID_CORE_DEVICE_IOREQUEST: + if ((error = rdpdr_process_irp(rdpdr, s))) + { + WLog_ERR(TAG, "rdpdr_process_irp failed with error %"PRIu32"", error); + return error; + } + else + s = NULL; - s = NULL; - break; + break; - default: - WLog_ERR(TAG, "RDPDR_CTYP_CORE unknown PacketId: 0x%04"PRIX16"", packetId); - return ERROR_INVALID_DATA; - break; + default: + WLog_ERR(TAG, "RDPDR_CTYP_CORE unknown PacketId: 0x%04"PRIX16"", packetId); + error = ERROR_INVALID_DATA; + break; + } } - } - else if (component == RDPDR_CTYP_PRN) - { - switch (packetId) + else { - case PAKID_PRN_CACHE_DATA: - { - UINT32 eventID; - - if (Stream_GetRemainingLength(s) < 4) - return ERROR_INVALID_DATA; - - Stream_Read_UINT32(s, eventID); - WLog_ERR(TAG, - "Ignoring unhandled message PAKID_PRN_CACHE_DATA (EventID: 0x%08"PRIX32")", eventID); - } - break; - - case PAKID_PRN_USING_XPS: - WLog_ERR(TAG, "Ignoring unhandled message PAKID_PRN_USING_XPS"); - break; + error = rdpdr_process_component(rdpdr, component, packetId, s); - default: - WLog_ERR(TAG, "Unknown printing component packetID: 0x%04"PRIX16"", packetId); - return ERROR_INVALID_DATA; + if (error != CHANNEL_RC_OK) + { + WLog_ERR(TAG, "Unknown message: Component: 0x%04"PRIX16" PacketId: 0x%04"PRIX16"", component, + packetId); + } } } - else - { - WLog_ERR(TAG, "Unknown message: Component: 0x%04"PRIX16" PacketId: 0x%04"PRIX16"", component, - packetId); - return ERROR_INVALID_DATA; - } Stream_Free(s, TRUE); - return CHANNEL_RC_OK; + return error; } /** diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpgfx/client/rdpgfx_codec.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpgfx/client/rdpgfx_codec.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpgfx/client/rdpgfx_codec.c 2018-08-17 11:47:24.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpgfx/client/rdpgfx_codec.c 2019-01-29 16:06:08.000000000 +0000 @@ -243,10 +243,7 @@ h264.bitstream[1].length = Stream_GetRemainingLength(s); } else - { h264.bitstream[0].length = Stream_GetRemainingLength(s); - memset(&h264.bitstream[1], 0, sizeof(h264.bitstream[1])); - } cmd->extra = (void*) &h264; diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpsnd/client/winmm/rdpsnd_winmm.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpsnd/client/winmm/rdpsnd_winmm.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/rdpsnd/client/winmm/rdpsnd_winmm.c 2018-04-03 09:18:22.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/rdpsnd/client/winmm/rdpsnd_winmm.c 2019-01-29 09:46:21.000000000 +0000 @@ -29,8 +29,8 @@ #include #include -#include -#include +#include +#include #include #include @@ -102,14 +102,12 @@ case MM_WOM_CLOSE: WLog_DBG(TAG, "MM_WOM_CLOSE"); - SetEvent(winmm->next); break; case MM_WOM_DONE: WLog_DBG(TAG, "MM_WOM_DONE"); lpWaveHdr = (LPWAVEHDR) dwParam1; free(lpWaveHdr); - SetEvent(winmm->next); break; default: @@ -176,7 +174,6 @@ if (winmm) { rdpsnd_winmm_close(device); - CloseHandle(winmm->next); free(winmm); } } @@ -269,7 +266,6 @@ return 0; } - WaitForSingleObject(winmm->next, INFINITE); return 10; /* TODO: Get real latencry in [ms] */ } @@ -305,13 +301,6 @@ winmm->device.Play = rdpsnd_winmm_play; winmm->device.Close = rdpsnd_winmm_close; winmm->device.Free = rdpsnd_winmm_free; - winmm->next = CreateEventA(NULL, FALSE, FALSE, "winmm-play-event"); - - if (!winmm->next) - { - free(winmm); - return CHANNEL_RC_NO_MEMORY; - } args = pEntryPoints->args; rdpsnd_winmm_parse_addin_args((rdpsndDevicePlugin*) winmm, args); diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/remdesk/client/remdesk_main.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/remdesk/client/remdesk_main.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/remdesk/client/remdesk_main.c 2018-08-24 07:54:25.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/remdesk/client/remdesk_main.c 2018-11-12 09:33:46.000000000 +0000 @@ -255,7 +255,13 @@ Stream_Read_UINT32(s, versionMajor); /* versionMajor (4 bytes) */ Stream_Read_UINT32(s, versionMinor); /* versionMinor (4 bytes) */ - remdesk->Version = versionMajor; + + if ((versionMajor != 1) || (versionMinor > 2) || (versionMinor == 0)) + { + WLog_ERR(TAG, "Unsupported protocol version %"PRId32".%"PRId32, versionMajor, versionMinor); + } + + remdesk->Version = versionMinor; return CHANNEL_RC_OK; } diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/remdesk/client/remdesk_main.h freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/remdesk/client/remdesk_main.h --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/remdesk/client/remdesk_main.h 2016-11-22 11:27:05.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/remdesk/client/remdesk_main.h 2018-11-08 08:27:57.000000000 +0000 @@ -55,7 +55,7 @@ UINT32 Version; char* ExpertBlob; BYTE* EncryptedPassStub; - int EncryptedPassStubSize; + size_t EncryptedPassStubSize; rdpContext* rdpcontext; }; typedef struct remdesk_plugin remdeskPlugin; diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/smartcard/client/smartcard_pack.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/smartcard/client/smartcard_pack.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/smartcard/client/smartcard_pack.c 2017-12-21 09:45:55.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/smartcard/client/smartcard_pack.c 2019-01-28 09:56:23.000000000 +0000 @@ -161,7 +161,7 @@ SCARDCONTEXT smartcard_scard_context_native_from_redir(SMARTCARD_DEVICE* smartcard, REDIR_SCARDCONTEXT* context) { - SCARDCONTEXT hContext = 0; + SCARDCONTEXT hContext = { 0 }; if ((context->cbContext != sizeof(ULONG_PTR)) && (context->cbContext != 0)) { @@ -173,8 +173,6 @@ if (context->cbContext) CopyMemory(&hContext, &(context->pbContext), context->cbContext); - else - ZeroMemory(&hContext, sizeof(ULONG_PTR)); return hContext; } diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/ChannelOptions.cmake freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/ChannelOptions.cmake --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/ChannelOptions.cmake 2017-06-26 20:16:22.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/ChannelOptions.cmake 2018-12-13 09:17:46.000000000 +0000 @@ -1,13 +1,11 @@ set(OPTION_DEFAULT OFF) set(OPTION_CLIENT_DEFAULT OFF) -set(OPTION_SERVER_DEFAULT OFF) define_channel_options(NAME "sshagent" TYPE "dynamic" - DESCRIPTION "SSH Agent Forwarding Extension" + DESCRIPTION "SSH Agent Forwarding (experimental)" SPECIFICATIONS "" DEFAULT ${OPTION_DEFAULT}) define_channel_client_options(${OPTION_CLIENT_DEFAULT}) -define_channel_server_options(${OPTION_SERVER_DEFAULT}) diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/CMakeLists.txt freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/CMakeLists.txt --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/CMakeLists.txt 2017-09-08 17:00:34.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/CMakeLists.txt 2018-12-13 09:17:46.000000000 +0000 @@ -21,7 +21,3 @@ if(WITH_CLIENT_CHANNELS) add_channel_client(${MODULE_PREFIX} ${CHANNEL_NAME}) endif() - -if(WITH_SERVER_CHANNELS) - add_channel_server(${MODULE_PREFIX} ${CHANNEL_NAME}) -endif() diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/server/CMakeLists.txt freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/server/CMakeLists.txt --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/server/CMakeLists.txt 2017-09-08 19:05:06.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/server/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# FreeRDP: A Remote Desktop Protocol Implementation -# FreeRDP cmake build script -# -# Copyright 2012 Marc-Andre Moreau -# Copyright 2017 Ben Cohen -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -define_channel_server("sshagent") - -set(${MODULE_PREFIX}_SRCS - sshagent_main.c) - -add_channel_server_library(${MODULE_PREFIX} ${MODULE_NAME} ${CHANNEL_NAME} FALSE "DVCPluginEntry") - - - -target_link_libraries(${MODULE_NAME} freerdp) - - -set_property(TARGET ${MODULE_NAME} PROPERTY FOLDER "Channels/${CHANNEL_NAME}/Server") diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/server/sshagent_main.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/server/sshagent_main.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/sshagent/server/sshagent_main.c 2018-10-03 13:16:59.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/sshagent/server/sshagent_main.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,422 +0,0 @@ -/** - * FreeRDP: A Remote Desktop Protocol Implementation - * SSH Agent Virtual Channel Extension - * - * Copyright 2012-2013 Jay Sorg - * Copyright 2012-2013 Laxmikant Rashinkar - * Copyright 2017 Ben Cohen - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/* - * Portions are from OpenSSH, under the following license: - * - * Author: Tatu Ylonen - * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland - * All rights reserved - * The authentication agent program. - * - * As far as I am concerned, the code I have written for this software - * can be used freely for any purpose. Any derived versions of this - * software must be clearly marked as such, and if the derived work is - * incompatible with the protocol description in the RFC file, it must be - * called by a name other than "ssh" or "Secure Shell". - * - * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * xrdp-ssh-agent.c: program to forward ssh-agent protocol from xrdp session - * - * This performs the equivalent function of ssh-agent on a server you connect - * to via ssh, but the ssh-agent protocol is over an RDP dynamic virtual - * channel and not an SSH channel. - * - * This will print out variables to set in your environment (specifically, - * $SSH_AUTH_SOCK) for ssh clients to find the agent's socket, then it will - * run in the background. This is suitable to run just as you would run the - * normal ssh-agent, e.g. in your Xsession or /etc/xrdp/startwm.sh. - * - * Your RDP client needs to be running a compatible client-side plugin - * that can see a local ssh-agent. - * - * usage (from within an xrdp session): - * xrdp-ssh-agent - * - * build instructions: - * gcc xrdp-ssh-agent.c -o xrdp-ssh-agent -L./.libs -lxrdpapi -Wall - * - * protocol specification: - * Forward data verbatim over RDP dynamic virtual channel named "sshagent" - * between a ssh client on the xrdp server and the real ssh-agent where - * the RDP client is running. Each connection by a separate client to - * xrdp-ssh-agent gets a separate DVC invocation. - */ - -#if defined(HAVE_CONFIG_H) -#include -#endif - -#ifdef __WIN32__ -#include -#endif - -#include - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define _PATH_DEVNULL "/dev/null" - -static char socket_name[PATH_MAX]; -static char socket_dir[PATH_MAX]; -static int sa_uds_fd = -1; -static int is_going = 1; - - -/* Make a template filename for mk[sd]temp() */ -/* This is from mktemp_proto() in misc.c from openssh */ -void -mktemp_proto(char* s, size_t len) -{ - const char* tmpdir; - int r; - - if ((tmpdir = getenv("TMPDIR")) != NULL) - { - r = snprintf(s, len, "%s/ssh-XXXXXXXXXXXX", tmpdir); - - if (r > 0 && (size_t)r < len) - return; - } - - r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXXXX"); - - if (r < 0 || (size_t)r >= len) - { - fprintf(stderr, "%s: template string too short", __func__); - exit(1); - } -} - - -/* This uses parts of main() in ssh-agent.c from openssh */ -static void -setup_ssh_agent(struct sockaddr_un* addr) -{ - int rc; - /* Create private directory for agent socket */ - mktemp_proto(socket_dir, sizeof(socket_dir)); - - if (mkdtemp(socket_dir) == NULL) - { - perror("mkdtemp: private socket dir"); - exit(1); - } - - snprintf(socket_name, sizeof(socket_name), "%s/agent.%ld", socket_dir, - (long)getpid()); - /* Create unix domain socket */ - unlink(socket_name); - sa_uds_fd = socket(AF_UNIX, SOCK_STREAM, 0); - - if (sa_uds_fd == -1) - { - fprintf(stderr, "sshagent: socket creation failed"); - exit(2); - } - - memset(addr, 0, sizeof(struct sockaddr_un)); - addr->sun_family = AF_UNIX; - strncpy(addr->sun_path, socket_name, sizeof(addr->sun_path)); - addr->sun_path[sizeof(addr->sun_path) - 1] = 0; - /* Create with privileges rw------- so other users can't access the UDS */ - mode_t umask_sav = umask(0177); - rc = bind(sa_uds_fd, (struct sockaddr*)addr, sizeof(struct sockaddr_un)); - - if (rc != 0) - { - fprintf(stderr, "sshagent: bind failed"); - close(sa_uds_fd); - unlink(socket_name); - exit(3); - } - - umask(umask_sav); - rc = listen(sa_uds_fd, /* backlog = */ 5); - - if (rc != 0) - { - fprintf(stderr, "listen failed\n"); - close(sa_uds_fd); - unlink(socket_name); - exit(1); - } - - /* Now fork: the child becomes the ssh-agent daemon and the parent prints - * out the pid and socket name. */ - pid_t pid = fork(); - - if (pid == -1) - { - perror("fork"); - exit(1); - } - else if (pid != 0) - { - /* Parent */ - close(sa_uds_fd); - printf("SSH_AUTH_SOCK=%s; export SSH_AUTH_SOCK;\n", socket_name); - printf("SSH_AGENT_PID=%d; export SSH_AGENT_PID;\n", pid); - printf("echo Agent pid %d;\n", pid); - exit(0); - } - - /* Child */ - - if (setsid() == -1) - { - fprintf(stderr, "setsid failed"); - exit(1); - } - - (void)chdir("/"); - int devnullfd; - - if ((devnullfd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) - { - /* XXX might close listen socket */ - (void)dup2(devnullfd, STDIN_FILENO); - (void)dup2(devnullfd, STDOUT_FILENO); - (void)dup2(devnullfd, STDERR_FILENO); - - if (devnullfd > 2) - close(devnullfd); - } - - /* deny core dumps, since memory contains unencrypted private keys */ - struct rlimit rlim; - rlim.rlim_cur = rlim.rlim_max = 0; - - if (setrlimit(RLIMIT_CORE, &rlim) < 0) - { - fprintf(stderr, "setrlimit RLIMIT_CORE: %s", strerror(errno)); - exit(1); - } -} - - -static void -handle_connection(int client_fd) -{ - int rdp_fd = -1; - int rc; - void* channel = WTSVirtualChannelOpenEx(WTS_CURRENT_SESSION, - "SSHAGENT", - WTS_CHANNEL_OPTION_DYNAMIC_PRI_MED); - - if (channel == NULL) - { - fprintf(stderr, "WTSVirtualChannelOpenEx() failed\n"); - } - - unsigned int retlen; - int* retdata; - rc = WTSVirtualChannelQuery(channel, - WTSVirtualFileHandle, - (void**)&retdata, - &retlen); - - if (!rc) - { - fprintf(stderr, "WTSVirtualChannelQuery() failed\n"); - } - - if (retlen != sizeof(rdp_fd)) - { - fprintf(stderr, "WTSVirtualChannelQuery() returned wrong length %d\n", - retlen); - } - - rdp_fd = *retdata; - int client_going = 1; - - while (client_going) - { - /* Wait for data from RDP or the client */ - fd_set readfds; - FD_ZERO(&readfds); - FD_SET(client_fd, &readfds); - FD_SET(rdp_fd, &readfds); - select(FD_SETSIZE, &readfds, NULL, NULL, NULL); - - if (FD_ISSET(rdp_fd, &readfds)) - { - /* Read from RDP and write to the client */ - char buffer[4096]; - unsigned int bytes_to_write; - rc = WTSVirtualChannelRead(channel, - /* TimeOut = */ 5000, - buffer, - sizeof(buffer), - &bytes_to_write); - - if (rc == 1) - { - char* pos = buffer; - errno = 0; - - while (bytes_to_write > 0) - { - int bytes_written = send(client_fd, pos, bytes_to_write, 0); - - if (bytes_written > 0) - { - bytes_to_write -= bytes_written; - pos += bytes_written; - } - else if (bytes_written == 0) - { - fprintf(stderr, "send() returned 0!\n"); - } - else if (errno != EINTR) - { - /* Error */ - fprintf(stderr, "Error %d on recv\n", errno); - client_going = 0; - } - } - } - else - { - /* Error */ - fprintf(stderr, "WTSVirtualChannelRead() failed: %d\n", errno); - client_going = 0; - } - } - - if (FD_ISSET(client_fd, &readfds)) - { - /* Read from the client and write to RDP */ - char buffer[4096]; - ssize_t bytes_to_write = recv(client_fd, buffer, sizeof(buffer), 0); - - if (bytes_to_write > 0) - { - char* pos = buffer; - - while (bytes_to_write > 0) - { - unsigned int bytes_written; - int rc = WTSVirtualChannelWrite(channel, - pos, - bytes_to_write, - &bytes_written); - - if (rc == 0) - { - fprintf(stderr, "WTSVirtualChannelWrite() failed: %d\n", - errno); - client_going = 0; - } - else - { - bytes_to_write -= bytes_written; - pos += bytes_written; - } - } - } - else if (bytes_to_write == 0) - { - /* Client has closed connection */ - client_going = 0; - } - else - { - /* Error */ - fprintf(stderr, "Error %d on recv\n", errno); - client_going = 0; - } - } - } - - WTSVirtualChannelClose(channel); -} - - -int -main(int argc, char** argv) -{ - /* Setup the Unix domain socket and daemon process */ - struct sockaddr_un addr; - setup_ssh_agent(&addr); - - /* Wait for a client to connect to the socket */ - while (is_going) - { - fd_set readfds; - FD_ZERO(&readfds); - FD_SET(sa_uds_fd, &readfds); - select(FD_SETSIZE, &readfds, NULL, NULL, NULL); - - /* If something connected then get it... - * (You can test this using "socat - UNIX-CONNECT:".) */ - if (FD_ISSET(sa_uds_fd, &readfds)) - { - socklen_t addrsize = sizeof(addr); - int client_fd = accept(sa_uds_fd, - (struct sockaddr*)&addr, - &addrsize); - handle_connection(client_fd); - close(client_fd); - } - } - - close(sa_uds_fd); - unlink(socket_name); - return 0; -} - -/* vim: set sw=4:ts=4:et: */ diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/tsmf/client/gstreamer/tsmf_gstreamer.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/tsmf/client/gstreamer/tsmf_gstreamer.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/tsmf/client/gstreamer/tsmf_gstreamer.c 2017-08-29 07:09:38.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/tsmf/client/gstreamer/tsmf_gstreamer.c 2019-01-29 16:48:05.000000000 +0000 @@ -151,11 +151,7 @@ return TRUE; } -#ifdef __OpenBSD__ static inline GstClockTime tsmf_gstreamer_timestamp_ms_to_gst(UINT64 ms_timestamp) -#else -static inline const GstClockTime tsmf_gstreamer_timestamp_ms_to_gst(UINT64 ms_timestamp) -#endif { /* * Convert Microsoft 100ns timestamps to Gstreamer 1ns units. @@ -633,7 +629,8 @@ { tsmf_gstreamer_need_data, tsmf_gstreamer_enough_data, - tsmf_gstreamer_seek_data + tsmf_gstreamer_seek_data, + { NULL } }; g_object_set(mdecoder->src, "format", GST_FORMAT_TIME, NULL); g_object_set(mdecoder->src, "is-live", FALSE, NULL); diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/tsmf/client/tsmf_media.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/tsmf/client/tsmf_media.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/tsmf/client/tsmf_media.c 2018-02-20 11:15:30.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/tsmf/client/tsmf_media.c 2019-01-04 15:56:57.000000000 +0000 @@ -702,16 +702,8 @@ buffer_filled = FALSE; } - if (buffer_filled) - { - ack_anticipation_time += (sample->duration / 2 < MAX_ACK_TIME) ? - sample->duration / 2 : MAX_ACK_TIME; - } - else - { - ack_anticipation_time += (sample->duration / 2 < MAX_ACK_TIME) ? - sample->duration / 2 : MAX_ACK_TIME; - } + ack_anticipation_time += (sample->duration / 2 < MAX_ACK_TIME) ? + sample->duration / 2 : MAX_ACK_TIME; switch (sample->stream->major_type) { diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/urbdrc/client/libusb/libusb_udevice.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/urbdrc/client/libusb/libusb_udevice.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/channels/urbdrc/client/libusb/libusb_udevice.c 2018-08-24 11:49:19.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/channels/urbdrc/client/libusb/libusb_udevice.c 2019-01-28 09:56:23.000000000 +0000 @@ -1387,7 +1387,7 @@ if (iso_transfer == NULL) { WLog_ERR(TAG, "Error: libusb_alloc_transfer."); - status = -1; + return -1; } /** process URB_FUNCTION_IOSCH_TRANSFER */ diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/CMakeLists.txt freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/CMakeLists.txt --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/CMakeLists.txt 2018-05-02 15:03:53.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/CMakeLists.txt 2018-11-22 13:37:10.000000000 +0000 @@ -26,10 +26,6 @@ if(WITH_SAMPLE) add_subdirectory(Sample) endif() - - if(WITH_DIRECTFB) - add_subdirectory(DirectFB) - endif() endif() if(WITH_X11) diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/common/client.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/common/client.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/common/client.c 2018-09-24 14:24:32.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/common/client.c 2018-11-30 10:04:20.000000000 +0000 @@ -303,24 +303,38 @@ } int freerdp_client_settings_parse_assistance_file(rdpSettings* settings, - const char* filename) + int argc, char* argv[]) { - int status; + int status, x; int ret = -1; + char* filename; + char* password = NULL; rdpAssistanceFile* file; + + if (!settings || !argv || (argc < 2)) + return -1; + + filename = argv[1]; + + for (x = 2; x < argc; x++) + { + const char* key = strstr(argv[x], "assistance:"); + + if (key) + password = strchr(key, ':') + 1; + } + file = freerdp_assistance_file_new(); if (!file) return -1; - status = freerdp_assistance_parse_file(file, filename); + status = freerdp_assistance_parse_file(file, filename, password); if (status < 0) goto out; - status = freerdp_client_populate_settings_from_assistance_file(file, settings); - - if (status < 0) + if (!freerdp_assistance_populate_settings_from_assistance_file(file, settings)) goto out; ret = 0; @@ -492,6 +506,7 @@ * when the connection requires it. * This function will actually be called by tls_verify_certificate(). * @see rdp_client_connect() and tls_connect() + * @deprecated Use client_cli_verify_certificate_ex * @param instance - pointer to the rdp_freerdp structure that contains the connection settings * @param common_name * @param subject @@ -504,6 +519,7 @@ const char* subject, const char* issuer, const char* fingerprint, BOOL host_mismatch) { + printf("WARNING: This callback is deprecated, migrate to client_cli_verify_certificate_ex\n"); printf("Certificate details:\n"); printf("\tSubject: %s\n", subject); printf("\tIssuer: %s\n", issuer); @@ -515,9 +531,49 @@ } /** Callback set in the rdp_freerdp structure, and used to make a certificate validation + * when the connection requires it. + * This function will actually be called by tls_verify_certificate(). + * @see rdp_client_connect() and tls_connect() + * @param instance pointer to the rdp_freerdp structure that contains the connection settings + * @param host The host currently connecting to + * @param port The port currently connecting to + * @param common_name The common name of the certificate, should match host or an alias of it + * @param subject The subject of the certificate + * @param issuer The certificate issuer name + * @param fingerprint The fingerprint of the certificate + * @param flags See VERIFY_CERT_FLAG_* for possible values. + * + * @return 1 if the certificate is trusted, 2 if temporary trusted, 0 otherwise. + */ +DWORD client_cli_verify_certificate_ex(freerdp* instance, const char* host, UINT16 port, + const char* common_name, + const char* subject, const char* issuer, + const char* fingerprint, DWORD flags) +{ + const char* type = "RDP-Server"; + + if (flags & VERIFY_CERT_FLAG_GATEWAY) + type = "RDP-Gateway"; + + if (flags & VERIFY_CERT_FLAG_REDIRECT) + type = "RDP-Redirect"; + + printf("Certificate details for %s:%"PRIu16" (%s):\n", host, port, type); + printf("\tCommon Name: %s\n", common_name); + printf("\tSubject: %s\n", subject); + printf("\tIssuer: %s\n", issuer); + printf("\tThumbprint: %s\n", fingerprint); + printf("The above X.509 certificate could not be verified, possibly because you do not have\n" + "the CA certificate in your certificate store, or the certificate has expired.\n" + "Please look at the OpenSSL documentation on how to add a private CA to the store.\n"); + return client_cli_accept_certificate(instance->settings); +} + +/** Callback set in the rdp_freerdp structure, and used to make a certificate validation * when a stored certificate does not match the remote counterpart. * This function will actually be called by tls_verify_certificate(). * @see rdp_client_connect() and tls_connect() + * @deprecated Use client_cli_verify_changed_certificate_ex * @param instance - pointer to the rdp_freerdp structure that contains the connection settings * @param common_name * @param subject @@ -535,6 +591,7 @@ const char* old_subject, const char* old_issuer, const char* old_fingerprint) { + printf("WARNING: This callback is deprecated, migrate to client_cli_verify_changed_certificate_ex\n"); printf("!!! Certificate has changed !!!\n"); printf("\n"); printf("New Certificate details:\n"); @@ -549,6 +606,59 @@ printf("\n"); printf("The above X.509 certificate does not match the certificate used for previous connections.\n" "This may indicate that the certificate has been tampered with.\n" + "Please contact the administrator of the RDP server and clarify.\n"); + return client_cli_accept_certificate(instance->settings); +} + +/** Callback set in the rdp_freerdp structure, and used to make a certificate validation + * when a stored certificate does not match the remote counterpart. + * This function will actually be called by tls_verify_certificate(). + * @see rdp_client_connect() and tls_connect() + * @param instance pointer to the rdp_freerdp structure that contains the connection settings + * @param host The host currently connecting to + * @param port The port currently connecting to + * @param common_name The common name of the certificate, should match host or an alias of it + * @param subject The subject of the certificate + * @param issuer The certificate issuer name + * @param fingerprint The fingerprint of the certificate + * @param old_subject The subject of the previous certificate + * @param old_issuer The previous certificate issuer name + * @param old_fingerprint The fingerprint of the previous certificate + * @param flags See VERIFY_CERT_FLAG_* for possible values. + * + * @return 1 if the certificate is trusted, 2 if temporary trusted, 0 otherwise. + */ +DWORD client_cli_verify_changed_certificate_ex(freerdp* instance, + const char* host, UINT16 port, + const char* common_name, + const char* subject, const char* issuer, + const char* fingerprint, + const char* old_subject, const char* old_issuer, + const char* old_fingerprint, DWORD flags) +{ + const char* type = "RDP-Server"; + + if (flags & VERIFY_CERT_FLAG_GATEWAY) + type = "RDP-Gateway"; + + if (flags & VERIFY_CERT_FLAG_REDIRECT) + type = "RDP-Redirect"; + + printf("!!!Certificate for %s:%"PRIu16" (%s) has changed!!!\n", host, port, type); + printf("\n"); + printf("New Certificate details:\n"); + printf("\tCommon Name: %s\n", common_name); + printf("\tSubject: %s\n", subject); + printf("\tIssuer: %s\n", issuer); + printf("\tThumbprint: %s\n", fingerprint); + printf("\n"); + printf("Old Certificate details:\n"); + printf("\tSubject: %s\n", old_subject); + printf("\tIssuer: %s\n", old_issuer); + printf("\tThumbprint: %s\n", old_fingerprint); + printf("\n"); + printf("The above X.509 certificate does not match the certificate used for previous connections.\n" + "This may indicate that the certificate has been tampered with.\n" "Please contact the administrator of the RDP server and clarify.\n"); return client_cli_accept_certificate(instance->settings); } diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/common/cmdline.c freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/common/cmdline.c --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/common/cmdline.c 2018-11-15 13:40:03.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/common/cmdline.c 2019-01-29 16:24:29.000000000 +0000 @@ -58,6 +58,46 @@ return (*dst) != NULL; } +static BOOL value_to_int(const char* value, LONGLONG* result, LONGLONG min, LONGLONG max) +{ + long long rc; + + if (!value || !result) + return FALSE; + + errno = 0; + rc = _strtoi64(value, NULL, 0); + + if (errno != 0) + return FALSE; + + if ((rc < min) || (rc > max)) + return FALSE; + + *result = rc; + return TRUE; +} + +static BOOL value_to_uint(const char* value, ULONGLONG* result, ULONGLONG min, ULONGLONG max) +{ + unsigned long long rc; + + if (!value || !result) + return FALSE; + + errno = 0; + rc = _strtoui64(value, NULL, 0); + + if (errno != 0) + return FALSE; + + if ((rc < min) || (rc > max)) + return FALSE; + + *result = rc; + return TRUE; +} + BOOL freerdp_client_print_version(void) { printf("This is FreeRDP version %s (%s)\n", FREERDP_VERSION_FULL, @@ -71,6 +111,65 @@ return TRUE; } +static char* print_token(char* text, int start_offset, int* current, int limit, + const char delimiter) +{ + int len = (int)strlen(text); + + if (*current < start_offset) + *current += printf("%*c", (start_offset - *current), ' '); + + if (*current + len > limit) + { + int x; + + for (x = MIN(len, limit - start_offset); x > 1; x--) + { + if (text[x] == delimiter) + { + printf("%.*s\n", x, text); + *current = 0; + return &text[x]; + } + } + + return NULL; + } + + *current += printf("%s", text); + return NULL; +} + +static int print_optionals(const char* text, int start_offset, int current) +{ + const size_t limit = 80; + char* str = _strdup(text); + char* cur = print_token(str, start_offset, ¤t, limit, '['); + + while (cur) + cur = print_token(cur, start_offset, ¤t, limit, '['); + + free(str); + return current; +} + +static int print_description(const char* text, int start_offset, int current) +{ + const size_t limit = 80; + char* str = _strdup(text); + char* cur = print_token(str, start_offset, ¤t, limit, ' '); + + while (cur) + { + cur++; + cur = print_token(cur, start_offset, ¤t, limit, ' '); + } + + free(str); + current += (size_t) printf("\n"); + return current; +} + static void freerdp_client_print_command_line_args(COMMAND_LINE_ARGUMENT_A* arg) { if (!arg) @@ -78,46 +177,45 @@ do { - if (arg->Flags & COMMAND_LINE_VALUE_FLAG) - { - printf(" %s", "/"); - printf("%-20s", arg->Name); - printf("\t%s\n", arg->Text); - } - else if ((arg->Flags & COMMAND_LINE_VALUE_REQUIRED) - || (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL)) - { - BOOL overlong = FALSE; - printf(" %s", "/"); + int pos = 0; + const int description_offset = 30 + 8; + + if (arg->Flags & COMMAND_LINE_VALUE_BOOL) + pos += printf(" %s%s", arg->Default ? "-" : "+", arg->Name); + else + pos += printf(" /%s", arg->Name); + if ((arg->Flags & COMMAND_LINE_VALUE_REQUIRED) + || (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL)) + { if (arg->Format) { - size_t length = (strlen(arg->Name) + strlen(arg->Format) + 2); - - if (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL) - length += 2; - - if (length >= 20 + 8 + 8) - overlong = TRUE; - if (arg->Flags & COMMAND_LINE_VALUE_OPTIONAL) - printf("%s[:%s]", arg->Name, overlong ? "..." : arg->Format); + { + pos += printf("[:"); + pos = print_optionals(arg->Format, pos, pos); + pos += printf("]"); + } else - printf("%s:%s", arg->Name, overlong ? "..." : arg->Format); - } - else - { - printf("%-20s", arg->Name); - } + { + pos += printf(":"); + pos = print_optionals(arg->Format, pos, pos); + } - printf("\t%s\n", arg->Text); - } - else if (arg->Flags & COMMAND_LINE_VALUE_BOOL) - { - printf(" %s", arg->Default ? "-" : "+"); - printf("%-20s", arg->Name); - printf("\t%s %s\n", arg->Default ? "Disable" : "Enable", arg->Text); + if (pos > description_offset) + { + printf("\n"); + pos = 0; + } + } } + + pos += printf("%*c", (description_offset - pos), ' '); + + if (arg->Flags & COMMAND_LINE_VALUE_BOOL) + pos += printf("%s ", arg->Default ? "Disable" : "Enable"); + + print_description(arg->Text, description_offset, pos); } while ((arg = CommandLineFindNextArgumentA(arg)) != NULL); } @@ -130,6 +228,9 @@ BOOL freerdp_client_print_command_line_help_ex(int argc, char** argv, COMMAND_LINE_ARGUMENT_A* custom) { + WINPR_UNUSED(argc); + WINPR_UNUSED(argv); + printf("\n"); printf("FreeRDP - A Free Remote Desktop Protocol Implementation\n"); printf("See www.freerdp.com for more information\n"); @@ -188,6 +289,10 @@ { size_t length; rdpSettings* settings; + + if (argc <= index) + return -1; + length = strlen(argv[index]); if (length > 4) @@ -480,7 +585,7 @@ int index; ADDIN_ARGV* args; - if (!settings || !params || !params[0]) + if (!settings || !params || !params[0] || (count < 0)) return FALSE; if (freerdp_static_channel_collection_find(settings, params[0])) @@ -492,7 +597,7 @@ return FALSE; args->argc = count; - args->argv = (char**) calloc(args->argc, sizeof(char*)); + args->argv = (char**) calloc((size_t)args->argc, sizeof(char*)); if (!args->argv) goto error_argv; @@ -532,7 +637,7 @@ int index; ADDIN_ARGV* args; - if (!settings || !params || !params[0]) + if (!settings || !params || !params[0] || (count < 0)) return FALSE; if (freerdp_dynamic_channel_collection_find(settings, params[0])) @@ -544,7 +649,7 @@ return FALSE; args->argc = count; - args->argv = (char**) calloc(args->argc, sizeof(char*)); + args->argv = (char**) calloc((size_t)args->argc, sizeof(char*)); if (!args->argv) goto error_argv; @@ -839,14 +944,14 @@ BOOL freerdp_parse_username(const char* username, char** user, char** domain) { char* p; - int length = 0; + size_t length = 0; p = strchr(username, '\\'); *user = NULL; *domain = NULL; if (p) { - length = (int)(p - username); + length = (size_t)(p - username); *user = _strdup(&p[1]); if (!*user) @@ -897,12 +1002,10 @@ if (p) { - unsigned long val; - SSIZE_T length = (p - hostname); - errno = 0; - val = strtoul(p + 1, NULL, 0); + size_t length = (size_t)(p - hostname); + LONGLONG val; - if ((errno != 0) || (val <= 0) || (val > UINT16_MAX)) + if (!value_to_int(p + 1, &val, 1, UINT16_MAX)) return FALSE; *host = (char*) calloc(length + 1UL, sizeof(char)); @@ -912,7 +1015,7 @@ CopyMemory(*host, hostname, length); (*host)[length] = '\0'; - *port = val; + *port = (UINT16)val; } else { @@ -927,7 +1030,7 @@ return TRUE; } -BOOL freerdp_set_connection_type(rdpSettings* settings, int type) +BOOL freerdp_set_connection_type(rdpSettings* settings, UINT32 type) { settings->ConnectionType = type; @@ -1062,11 +1165,16 @@ static int freerdp_detect_command_line_pre_filter(void* context, int index, int argc, LPSTR* argv) { - int length; + size_t length; + + WINPR_UNUSED(context); if (index == 1) { - length = (int) strlen(argv[index]); + if (argc < index) + return -1; + + length = strlen(argv[index]); if (length > 4) { @@ -1323,21 +1431,22 @@ * @param v2: pointer to output v2 * @return if the parsing was successful */ -static BOOL parseSizeValue(const char *input, unsigned long *v1, unsigned long *v2) +static BOOL parseSizeValue(const char* input, unsigned long* v1, unsigned long* v2) { - const char *xcharpos; - char *endPtr; + const char* xcharpos; + char* endPtr; unsigned long v; - errno = 0; v = strtoul(input, &endPtr, 10); if ((v == 0 || v == ULONG_MAX) && (errno != 0)) return FALSE; + if (v1) *v1 = v; xcharpos = strchr(input, 'x'); + if (!xcharpos || xcharpos != endPtr) return FALSE; @@ -1349,6 +1458,7 @@ if (*endPtr != '\0') return FALSE; + if (v2) *v2 = v; @@ -1410,7 +1520,7 @@ if (assist) { if (freerdp_client_settings_parse_assistance_file(settings, - argv[1]) < 0) + argc, argv) < 0) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } @@ -1438,6 +1548,8 @@ CommandLineSwitchStart(arg) CommandLineSwitchCase(arg, "v") { + assert(arg->Value); + free(settings->ServerHostname); settings->ServerHostname = NULL; p = strchr(arg->Value, '['); @@ -1449,13 +1561,13 @@ if (p) { - unsigned long val = strtoul(&p[1], NULL, 0); + LONGLONG val; - if ((errno != 0) || (val == 0) || (val > UINT16_MAX)) + if (!value_to_int(&p[1], &val, 1, UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - length = (int)(p - arg->Value); - settings->ServerPort = val; + length = (size_t)(p - arg->Value); + settings->ServerPort = (UINT16)val; if (!(settings->ServerHostname = (char*) calloc(length + 1UL, sizeof(char)))) return COMMAND_LINE_ERROR_MEMORY; @@ -1477,7 +1589,7 @@ if (!p2) continue; - length = p2 - p; + length = (size_t)(p2 - p); if (!(settings->ServerHostname = (char*) calloc(length, sizeof(char)))) return COMMAND_LINE_ERROR_MEMORY; @@ -1486,12 +1598,12 @@ if (*(p2 + 1) == ':') { - unsigned long val = strtoul(&p2[2], NULL, 0); + LONGLONG val; - if ((errno != 0) || (val == 0) || (val > UINT16_MAX)) + if (!value_to_int(&p[2], &val, 0, UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->ServerPort = val; + settings->ServerPort = (UINT16)val; } printf("hostname %s port %"PRIu32"\n", settings->ServerHostname, settings->ServerPort); @@ -1506,6 +1618,8 @@ { size_t count = 0; char* cur = arg->Value; + assert(arg->Value); + settings->RedirectionPreferType = 0; do @@ -1558,35 +1672,37 @@ } CommandLineSwitchCase(arg, "w") { - long val = strtol(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val <= 0) || (val > UINT16_MAX)) + if (!value_to_int(arg->Value, &val, -1, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->DesktopWidth = val; + settings->DesktopWidth = (UINT32)val; } CommandLineSwitchCase(arg, "h") { - long val = strtol(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val <= 0) || (val > UINT16_MAX)) + if (!value_to_int(arg->Value, &val, -1, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->DesktopHeight = val; + settings->DesktopHeight = (UINT32)val; } CommandLineSwitchCase(arg, "size") { + assert(arg->Value); p = strchr(arg->Value, 'x'); if (p) { unsigned long w, h; + if (!parseSizeValue(arg->Value, &w, &h) || (w > UINT16_MAX) || (h > UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->DesktopWidth = w; - settings->DesktopHeight = h; + settings->DesktopWidth = (UINT32)w; + settings->DesktopHeight = (UINT32)h; } else { @@ -1619,15 +1735,15 @@ *p = '\0'; { - long val = strtol(str, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val < 0) || (val > 100)) + if (!value_to_int(str, &val, 0, 100)) { free(str); return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } - settings->PercentScreen = val; + settings->PercentScreen = (UINT32)val; } } @@ -1638,6 +1754,10 @@ { settings->Fullscreen = enable; } + CommandLineSwitchCase(arg, "suppress-output") + { + settings->SuppressOutput = enable; + } CommandLineSwitchCase(arg, "multimon") { settings->UseMultimon = TRUE; @@ -1677,12 +1797,12 @@ for (i = 0; i < settings->NumMonitorIds; i++) { - unsigned long val = strtoul(p[i], NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT16_MAX)) + if (!value_to_int(p[i], &val, 0, UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->MonitorIds[i] = val; + settings->MonitorIds[i] = (UINT32)val; } free(p); @@ -1729,19 +1849,17 @@ if (!parseSizeValue(arg->Value, &w, &h) || (w > UINT16_MAX) || (h > UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->SmartSizingWidth = w; - settings->SmartSizingHeight = h; + settings->SmartSizingWidth = (UINT32)w; + settings->SmartSizingHeight = (UINT32)h; } } CommandLineSwitchCase(arg, "bpp") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if (errno != 0) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->ColorDepth = val; - switch (settings->ColorDepth) { case 32: @@ -1749,6 +1867,7 @@ case 16: case 15: case 8: + settings->ColorDepth = (UINT32)val; break; default: @@ -1783,9 +1902,9 @@ } CommandLineSwitchCase(arg, "kbd") { - unsigned long id = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (id > UINT32_MAX) || (id == 0)) + if (!value_to_int(arg->Value, &val, 1, UINT32_MAX)) { const int rc = freerdp_map_keyboard_layout_name_to_id(arg->Value); @@ -1797,38 +1916,38 @@ } /* Found a valid mapping, reset errno */ - id = (unsigned long)rc; + val = rc; errno = 0; } - settings->KeyboardLayout = (UINT32) id; + settings->KeyboardLayout = (UINT32) val; } CommandLineSwitchCase(arg, "kbd-type") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->KeyboardType = val; + settings->KeyboardType = (UINT32)val; } CommandLineSwitchCase(arg, "kbd-subtype") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->KeyboardSubType = val; + settings->KeyboardSubType = (UINT32)val; } CommandLineSwitchCase(arg, "kbd-fn-key") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->KeyboardFunctionKey = val; + settings->KeyboardFunctionKey = (UINT32)val; } CommandLineSwitchCase(arg, "u") { @@ -1850,23 +1969,26 @@ if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) { + assert(arg->Value); + p = strchr(arg->Value, ':'); if (p) { - unsigned long val = strtoul(&p[1], NULL, 0); + size_t s; + LONGLONG val; - if ((errno != 0) || (val == 0) || (val > UINT16_MAX)) + if (!value_to_int(&p[1], &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - length = (int)(p - arg->Value); - settings->GatewayPort = val; + s = (size_t)(p - arg->Value); + settings->GatewayPort = (UINT32)val; - if (!(settings->GatewayHostname = (char*) calloc(length + 1UL, sizeof(char)))) + if (!(settings->GatewayHostname = (char*) calloc(s + 1UL, sizeof(char)))) return COMMAND_LINE_ERROR_MEMORY; - strncpy(settings->GatewayHostname, arg->Value, length); - settings->GatewayHostname[length] = '\0'; + strncpy(settings->GatewayHostname, arg->Value, s); + settings->GatewayHostname[s] = '\0'; } else { @@ -1892,6 +2014,8 @@ if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) { char* atPtr; + assert(arg->Value); + /* value is [scheme://][user:password@]hostname:port */ p = strstr(arg->Value, "://"); @@ -1960,13 +2084,13 @@ if (p) { - unsigned long val = strtoul(&p[1], NULL, 0); + LONGLONG val; - if ((errno != 0) || (val == 0) || (val > UINT16_MAX)) + if (!value_to_int(&p[1], &val, 0, UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - length = (p - arg->Value); - settings->ProxyPort = val; + length = (size_t)(p - arg->Value); + settings->ProxyPort = (UINT16)val; settings->ProxyHostname = (char*) malloc(length + 1); strncpy(settings->ProxyHostname, arg->Value, length); settings->ProxyHostname[length] = '\0'; @@ -2024,8 +2148,7 @@ } CommandLineSwitchCase(arg, "gateway-usage-method") { - long type = 0; - char* pEnd; + UINT32 type = 0; if (_stricmp(arg->Value, "none") == 0) type = TSC_PROXY_MODE_NONE_DIRECT; @@ -2037,13 +2160,13 @@ type = TSC_PROXY_MODE_DEFAULT; else { - type = strtol(arg->Value, &pEnd, 10); + LONGLONG val; - if (errno != 0) + if (!value_to_int(arg->Value, &val, TSC_PROXY_MODE_NONE_DIRECT, TSC_PROXY_MODE_NONE_DETECT)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } - freerdp_set_gateway_usage_method(settings, (UINT32) type); + freerdp_set_gateway_usage_method(settings, type); } CommandLineSwitchCase(arg, "app") { @@ -2095,12 +2218,12 @@ } CommandLineSwitchCase(arg, "compression-level") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->CompressionLevel = val; + settings->CompressionLevel = (UINT32)val; } CommandLineSwitchCase(arg, "drives") { @@ -2130,29 +2253,33 @@ } CommandLineSwitchCase(arg, "audio-mode") { - long mode = strtol(arg->Value, NULL, 0); + LONGLONG val; - if (errno != 0) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - if (mode == AUDIO_MODE_REDIRECT) - { - settings->AudioPlayback = TRUE; - } - else if (mode == AUDIO_MODE_PLAY_ON_SERVER) + switch (val) { - settings->RemoteConsoleAudio = TRUE; - } - else if (mode == AUDIO_MODE_NONE) - { - settings->AudioPlayback = FALSE; - settings->RemoteConsoleAudio = FALSE; + case AUDIO_MODE_REDIRECT: + settings->AudioPlayback = TRUE; + break; + + case AUDIO_MODE_PLAY_ON_SERVER: + settings->RemoteConsoleAudio = TRUE; + break; + + case AUDIO_MODE_NONE: + settings->AudioPlayback = FALSE; + settings->RemoteConsoleAudio = FALSE; + break; + + default: + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } } CommandLineSwitchCase(arg, "network") { - long type = 0; - char* pEnd; + UINT32 type = 0; if (_stricmp(arg->Value, "modem") == 0) type = CONNECTION_TYPE_MODEM; @@ -2174,10 +2301,12 @@ } else { - type = strtol(arg->Value, &pEnd, 10); + LONGLONG val; - if (errno != 0) + if (!value_to_int(arg->Value, &val, 1, 7)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + + type = (UINT32)val; } if (!freerdp_set_connection_type(settings, type)) @@ -2208,8 +2337,8 @@ return COMMAND_LINE_ERROR_MISSING_ARGUMENT; } - settings->DesktopPosX = x; - settings->DesktopPosY = y; + settings->DesktopPosX = (UINT32)x; + settings->DesktopPosY = (UINT32)y; } CommandLineSwitchCase(arg, "menu-anims") { @@ -2300,6 +2429,8 @@ } CommandLineSwitchCase(arg, "rfx-mode") { + assert(arg->Value); + if (strcmp(arg->Value, "video") == 0) settings->RemoteFxCodecMode = 0x00; else if (strcmp(arg->Value, "image") == 0) @@ -2307,12 +2438,12 @@ } CommandLineSwitchCase(arg, "frame-ack") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->FrameAcknowledge = val; + settings->FrameAcknowledge = (UINT32)val; } CommandLineSwitchCase(arg, "nsc") { @@ -2326,12 +2457,12 @@ } CommandLineSwitchCase(arg, "jpeg-quality") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > 100)) + if (!value_to_int(arg->Value, &val, 0, 100)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->JpegQuality = val; + settings->JpegQuality = (UINT32)val; } #endif CommandLineSwitchCase(arg, "nego") @@ -2347,16 +2478,18 @@ } CommandLineSwitchCase(arg, "pcid") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; settings->SendPreconnectionPdu = TRUE; - settings->PreconnectionId = val; + settings->PreconnectionId = (UINT32)val; } CommandLineSwitchCase(arg, "sec") { + assert(arg->Value); + if (strcmp("rdp", arg->Value) == 0) /* Standard RDP */ { settings->RdpSecurity = TRUE; @@ -2423,6 +2556,8 @@ if (arg->Flags & COMMAND_LINE_VALUE_PRESENT) { + assert(arg->Value); + promptForPassword = (strncmp(arg->Value, "force", 6) == 0); if (!promptForPassword) @@ -2459,6 +2594,8 @@ } CommandLineSwitchCase(arg, "tls-ciphers") { + assert(arg->Value); + free(settings->AllowedTlsCiphers); if (strcmp(arg->Value, "netmon") == 0) @@ -2479,12 +2616,12 @@ } CommandLineSwitchCase(arg, "tls-seclevel") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > 5)) + if (!value_to_int(arg->Value, &val, 0, 5)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->TlsSecLevel = val; + settings->TlsSecLevel = (UINT32)val; } CommandLineSwitchCase(arg, "cert-name") { @@ -2499,6 +2636,10 @@ { settings->AutoAcceptCertificate = enable; } + CommandLineSwitchCase(arg, "cert-deny") + { + settings->AutoDenyCertificate = enable; + } CommandLineSwitchCase(arg, "authentication") { settings->Authentication = enable; @@ -2521,7 +2662,70 @@ } CommandLineSwitchCase(arg, "floatbar") { - settings->Floatbar = enable; + /* Defaults are enabled, visible, sticky, fullscreen */ + settings->Floatbar = 0x0017; + + if (arg->Value) + { + char* start = arg->Value; + + do + { + char* cur = start; + start = strchr(start, ','); + + if (start) + { + *start = '\0'; + start = start + 1; + } + + /* sticky:[on|off] */ + if (_strnicmp(cur, "sticky:", 7) == 0) + { + const char* val = cur + 7; + settings->Floatbar &= ~0x02u; + + if (_strnicmp(val, "on", 3) == 0) + settings->Floatbar |= 0x02u; + else if (_strnicmp(val, "off", 4) == 0) + settings->Floatbar &= ~0x02u; + else + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + } + /* default:[visible|hidden] */ + else if (_strnicmp(cur, "default:", 8) == 0) + { + const char* val = cur + 8; + settings->Floatbar &= ~0x04u; + + if (_strnicmp(val, "visible", 8) == 0) + settings->Floatbar |= 0x04u; + else if (_strnicmp(val, "hidden", 7) == 0) + settings->Floatbar &= ~0x04u; + else + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + } + /* show:[always|fullscreen|window] */ + else if (_strnicmp(cur, "show:", 5) == 0) + { + const char* val = cur + 5; + settings->Floatbar &= ~0x30u; + + if (_strnicmp(val, "always", 7) == 0) + settings->Floatbar |= 0x30u; + else if (_strnicmp(val, "fullscreen", 11) == 0) + settings->Floatbar |= 0x10u; + else if (_strnicmp(val, "window", 7) == 0) + settings->Floatbar |= 0x20u; + else + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + } + else + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + } + while (start); + } } CommandLineSwitchCase(arg, "mouse-motion") { @@ -2529,12 +2733,12 @@ } CommandLineSwitchCase(arg, "parent-window") { - UINT64 val = _strtoui64(arg->Value, NULL, 0); + ULONGLONG val; - if (errno != 0) + if (!value_to_uint(arg->Value, &val, 0, UINT64_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->ParentWindowId = val; + settings->ParentWindowId = (UINT64)val; } CommandLineSwitchCase(arg, "bitmap-cache") { @@ -2542,7 +2746,7 @@ } CommandLineSwitchCase(arg, "offscreen-cache") { - settings->OffscreenSupportLevel = enable; + settings->OffscreenSupportLevel = (UINT32)enable; } CommandLineSwitchCase(arg, "glyph-cache") { @@ -2553,6 +2757,8 @@ { settings->BitmapCacheV3Enabled = TRUE; + assert(arg->Value); + if (strcmp(arg->Value, "rfx") == 0) { settings->RemoteFxCodec = TRUE; @@ -2580,32 +2786,24 @@ } CommandLineSwitchCase(arg, "max-fast-path-size") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->MultifragMaxRequestSize = val; + settings->MultifragMaxRequestSize = (UINT32)val; } CommandLineSwitchCase(arg, "max-loop-time") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, -1, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->MaxTimeInCheckLoop = val; - - if ((long) settings->MaxTimeInCheckLoop < 0) - { - WLog_ERR(TAG, "invalid max loop time: %s", arg->Value); - return COMMAND_LINE_ERROR; - } - - if ((long) settings->MaxTimeInCheckLoop <= 0) - { + if (val < 0) settings->MaxTimeInCheckLoop = 10 * 60 * 60 * 1000; /* 10 hours can be considered as infinite */ - } + else + settings->MaxTimeInCheckLoop = (UINT32)val; } CommandLineSwitchCase(arg, "async-input") { @@ -2641,26 +2839,26 @@ } CommandLineSwitchCase(arg, "auto-reconnect-max-retries") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, 1000)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->AutoReconnectMaxRetries = val; - - if (settings->AutoReconnectMaxRetries > 1000) - return COMMAND_LINE_ERROR; + settings->AutoReconnectMaxRetries = (UINT32)val; } CommandLineSwitchCase(arg, "reconnect-cookie") { BYTE* base64 = NULL; int length; + + assert(arg->Value); + crypto_base64_decode((const char*)(arg->Value), (int) strlen(arg->Value), &base64, &length); if ((base64 != NULL) && (length == sizeof(ARC_SC_PRIVATE_PACKET))) { - memcpy(settings->ServerAutoReconnectCookie, base64, length); + memcpy(settings->ServerAutoReconnectCookie, base64, (size_t)length); } else { @@ -2673,39 +2871,32 @@ { settings->PrintReconnectCookie = enable; } - CommandLineSwitchCase(arg, "assistance") - { - settings->RemoteAssistanceMode = TRUE; - - if (!copy_value(arg->Value, &settings->RemoteAssistancePassword)) - return COMMAND_LINE_ERROR_MEMORY; - } CommandLineSwitchCase(arg, "pwidth") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->DesktopPhysicalWidth = val; + settings->DesktopPhysicalWidth = (UINT32)val; } CommandLineSwitchCase(arg, "pheight") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > UINT32_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT32_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->DesktopPhysicalHeight = val; + settings->DesktopPhysicalHeight = (UINT32)val; } CommandLineSwitchCase(arg, "orientation") { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val > INT16_MAX)) + if (!value_to_int(arg->Value, &val, 0, UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->DesktopOrientation = val; + settings->DesktopOrientation = (UINT16)val; } CommandLineSwitchCase(arg, "old-license") { @@ -2713,55 +2904,49 @@ } CommandLineSwitchCase(arg, "scale") { - unsigned long scaleFactor = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if (errno != 0) + if (!value_to_int(arg->Value, &val, 100, 180)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - if (scaleFactor == 100 || scaleFactor == 140 || scaleFactor == 180) + switch (val) { - settings->DesktopScaleFactor = scaleFactor; - settings->DeviceScaleFactor = scaleFactor; - } - else - { - WLog_ERR(TAG, "scale: invalid scale factor (%d)", scaleFactor); - return COMMAND_LINE_ERROR; + case 100: + case 140: + case 180: + settings->DeviceScaleFactor = (UINT32)val; + break; + + default: + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } } CommandLineSwitchCase(arg, "scale-desktop") { - unsigned long desktopScaleFactor = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if (errno != 0) - return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; + if (!value_to_int(arg->Value, &val, 100, 500)) + return FALSE; - if (desktopScaleFactor >= 100 && desktopScaleFactor <= 500) - { - settings->DesktopScaleFactor = desktopScaleFactor; - } - else - { - WLog_ERR(TAG, "scale: invalid desktop scale factor (%d)", desktopScaleFactor); - return COMMAND_LINE_ERROR; - } + settings->DesktopScaleFactor = (UINT32)val; } CommandLineSwitchCase(arg, "scale-device") { - unsigned long deviceScaleFactor = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if (errno != 0) + if (!value_to_int(arg->Value, &val, 100, 180)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - if (deviceScaleFactor == 100 || deviceScaleFactor == 140 - || deviceScaleFactor == 180) - { - settings->DeviceScaleFactor = deviceScaleFactor; - } - else + switch (val) { - WLog_ERR(TAG, "scale: invalid device scale factor (%d)", deviceScaleFactor); - return COMMAND_LINE_ERROR; + case 100: + case 140: + case 180: + settings->DeviceScaleFactor = (UINT32)val; + break; + + default: + return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; } } CommandLineSwitchCase(arg, "action-script") @@ -2867,12 +3052,12 @@ if (arg->Flags & COMMAND_LINE_ARGUMENT_PRESENT) { - unsigned long val = strtoul(arg->Value, NULL, 0); + LONGLONG val; - if ((errno != 0) || (val == 0) || (val > UINT16_MAX)) + if (!value_to_int(arg->Value, &val, 1, UINT16_MAX)) return COMMAND_LINE_ERROR_UNEXPECTED_VALUE; - settings->ServerPort = val; + settings->ServerPort = (UINT32)val; } arg = CommandLineFindArgumentA(args, "p"); @@ -3057,6 +3242,7 @@ { settings->EncomspVirtualChannel = TRUE; settings->RemdeskVirtualChannel = TRUE; + settings->NlaSecurity = FALSE; } if (settings->EncomspVirtualChannel) diff -Nru freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/common/cmdline.h freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/common/cmdline.h --- freerdp2-2.0.0~git20181120.1.e21b72c95+dfsg1/client/common/cmdline.h 2018-11-15 13:40:03.000000000 +0000 +++ freerdp2-2.0.0~git20190204.1.2693389a+dfsg1/client/common/cmdline.h 2019-01-30 15:26:41.000000000 +0000 @@ -46,19 +46,20 @@ { "bitmap-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "bitmap cache" }, { "bpp", COMMAND_LINE_VALUE_REQUIRED, "", "16", NULL, -1, NULL, "Session bpp (color depth)" }, { "buildconfig", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_BUILDCONFIG, NULL, NULL, NULL, -1, NULL, "Print the build configuration" }, + { "cert-deny", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Automatically abort connection for any certificate that can not be validated." }, { "cert-ignore", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Ignore certificate" }, { "cert-name", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Certificate name" }, { "cert-tofu", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Automatically accept certificate on first connect" }, { "client-hostname", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Client Hostname to send to server" }, { "clipboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Redirect clipboard" }, - { "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "rfx|nsc|jpeg", NULL, NULL, -1, NULL, "Bitmap codec cache" }, + { "codec-cache", COMMAND_LINE_VALUE_REQUIRED, "[rfx|nsc|jpeg]", NULL, NULL, -1, NULL, "Bitmap codec cache" }, { "compression", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, "z", "compression" }, { "compression-level", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Compression level (0,1,2)" }, { "credentials-delegation", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "credentials delegation" }, { "d", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Domain" }, { "decorations", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Window decorations" }, { "disp", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Display control" }, - { "drive", COMMAND_LINE_VALUE_REQUIRED, ",", NULL, NULL, -1, NULL, "Redirect directory as named share " }, + { "drive", COMMAND_LINE_VALUE_REQUIRED, ",", NULL, NULL, -1, NULL, "Redirect directory as named share . Hotplug support is enabled with /drive:hotplug,*. This argument provides the same function as \"Drives that I plug in later\" option in MSTSC." }, { "drives", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Redirect all mount points as shares" }, { "dvc", COMMAND_LINE_VALUE_REQUIRED, "[,]", NULL, NULL, -1, NULL, "Dynamic virtual channel" }, { "dynamic-resolution", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Send resolution updates when the window is resized" }, @@ -68,19 +69,19 @@ { "f", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Fullscreen mode (++ toggles fullscreen)" }, { "fast-path", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "fast-path input/output" }, { "fipsmode", COMMAND_LINE_VALUE_BOOL, NULL, NULL, NULL, -1, NULL, "FIPS mode" }, - { "floatbar", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "floatbar in fullscreen mode" }, - { "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "smooth fonts (ClearType)" }, + { "floatbar", COMMAND_LINE_VALUE_OPTIONAL, "sticky:[on|off],default:[visible|hidden],show:[always|fullscreen||window]", NULL, NULL, -1, NULL, "floatbar is disabled by default (when enabled defaults to sticky in fullscreen mode)" }, + { "fonts", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "smooth fonts (ClearType)" }, { "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Number of frame acknowledgement" }, { "from-stdin", COMMAND_LINE_VALUE_OPTIONAL, "force", NULL, NULL, -1, NULL, "Read credentials from stdin. With the prompt is done before connection, otherwise on server request." }, { "g", COMMAND_LINE_VALUE_REQUIRED, "[:]", NULL, NULL, -1, NULL, "Gateway Hostname" }, - { "gateway-usage-method", COMMAND_LINE_VALUE_REQUIRED, "direct|detect", NULL, NULL, -1, "gum", "Gateway usage method" }, + { "gateway-usage-method", COMMAND_LINE_VALUE_REQUIRED, "[direct|detect]", NULL, NULL, -1, "gum", "Gateway usage method" }, { "gd", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway domain" }, { "gdi", COMMAND_LINE_VALUE_REQUIRED, "sw|hw", NULL, NULL, -1, NULL, "GDI rendering" }, { "geometry", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "Geometry tracking channel" }, { "gestures", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Consume multitouch input locally" }, #ifdef WITH_GFX_H264 - { "gfx", COMMAND_LINE_VALUE_OPTIONAL, "RFX|AVC420|AVC444", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" }, - { "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "AVC420|AVC444", NULL, NULL, -1, NULL, "RDP8.1 graphics pipeline using H264 codec" }, + { "gfx", COMMAND_LINE_VALUE_OPTIONAL, "[RFX|AVC420|AVC444]", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" }, + { "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "[AVC420|AVC444]", NULL, NULL, -1, NULL, "RDP8.1 graphics pipeline using H264 codec" }, #else { "gfx", COMMAND_LINE_VALUE_OPTIONAL, "RFX", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" }, #endif @@ -90,8 +91,8 @@ { "glyph-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Glyph cache (experimental)" }, { "gp", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway password" }, { "grab-keyboard", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Grab keyboard" }, - { "gt", COMMAND_LINE_VALUE_REQUIRED, "rpc|http|auto", NULL, NULL, -1, NULL, "Gateway transport type" }, - { "gu", COMMAND_LINE_VALUE_REQUIRED, "[\\] or [@]", NULL, NULL, -1, NULL, "Gateway username" }, + { "gt", COMMAND_LINE_VALUE_REQUIRED, "[rpc|http|auto]", NULL, NULL, -1, NULL, "Gateway transport type" }, + { "gu", COMMAND_LINE_VALUE_REQUIRED, "[[\\]|[@]]", NULL, NULL, -1, NULL, "Gateway username" }, { "gat", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Gateway Access Token" }, { "h", COMMAND_LINE_VALUE_REQUIRED, "", "768", NULL, -1, NULL, "Height" }, { "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support heartbeat PDUs" }, @@ -109,7 +110,7 @@ { "kbd-type", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Keyboard type" }, { "load-balance-info", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Load balance info" }, { "log-filters", COMMAND_LINE_VALUE_REQUIRED, ":[,:[,...]]", NULL, NULL, -1, NULL, "Set logger filters, see wLog(7) for details" }, - { "log-level", COMMAND_LINE_VALUE_REQUIRED, "OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE", NULL, NULL, -1, NULL, "Set the default log level, see wLog(7) for details" }, + { "log-level", COMMAND_LINE_VALUE_REQUIRED, "[OFF|FATAL|ERROR|WARN|INFO|DEBUG|TRACE]", NULL, NULL, -1, NULL, "Set the default log level, see wLog(7) for details" }, { "max-fast-path-size", COMMAND_LINE_VALUE_REQUIRED, "", NULL, NULL, -1, NULL, "Specify maximum fast-path update size" }, { "max-loop-time", COMMAND_LINE_VALUE_REQUIRED, "