Replaced most exec call with execFile
Using execFile should prevent risks of shell injection. Thanks!
I'm marking this as a draft for now, as I haven't tested any USB-pass though, yet. p.s. it's tested so I've marked it as ready
p.s. Should I squash the commit before it is merged?
p.s. Should I squash the commit before it is merged?
Nah, we'll just use the squash option when we merge
Additionally, during testing everything behaves as expected. However, closing app windows results in an exception that I don't get in main - Do you see this in yours? Is this just because we were previously hiding an error log?:
Uncaught (in promise) Error: Command failed: xfreerdp /u:<REDACTED> /p:<REDACTED> /v:127.0.0.1 /port:3389 /cert:ignore +clipboard /sound:sys:pulse /microphone:sys:pulse /floatbar /compression -wallpaper /scale-desktop:100 /wm-class:winboat-Device Manager /app:program:C:\Windows\System32\devmgmt.msc,name:Device Manager
[21:42:15:830] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [load_map_from_xkbfile]: : keycode: 0x08 -> no RDP scancode found
[21:42:15:830] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [load_map_from_xkbfile]: : keycode: 0x5D -> no RDP scancode found
[21:42:15:833] [3152983:00301c64] [ERROR][com.freerdp.codec] - [openh264_init]: Failed to create OpenH264 decoder
[21:42:15:833] [3152983:00301c64] [WARN][com.freerdp.core.codecs] - [freerdp_client_codecs_prepare]: Failed to create h264 codec context
[21:42:15:869] [3152983:00301c64] [ERROR][com.winpr.sspi.Kerberos] - [kerberos_AcquireCredentialsHandleA]: krb5_parse_name (Configuration file does not specify default realm [-1765328160])
[21:42:15:869] [3152983:00301c64] [ERROR][com.winpr.sspi.Kerberos] - [kerberos_AcquireCredentialsHandleA]: krb5_parse_name (Configuration file does not specify default realm [-1765328160])
[21:42:15:874] [3152983:00301c64] [WARN][com.freerdp.core.connection] - [rdp_client_connect_auto_detect]: expected messageChannelId=1009, got 1003
[21:42:15:874] [3152983:00301c64] [WARN][com.freerdp.core.license] - [license_read_binary_blob_data]: license binary blob::type BB_ERROR_BLOB, length=0, skipping.
[21:42:15:894] [3152983:00301c64] [WARN][com.freerdp.core.connection] - [rdp_client_connect_auto_detect]: expected messageChannelId=1009, got 1003
[21:42:15:930] [3152983:00301c8f] [ERROR][com.freerdp.codec] - [openh264_init]: Failed to create OpenH264 decoder
[21:42:15:930] [3152983:00301c8f] [WARN][com.freerdp.core.codecs] - [freerdp_client_codecs_prepare]: Failed to create h264 codec context
[21:42:16:147] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:150] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:150] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_Set]: handle=0
[21:42:16:166] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:166] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_Set]: handle=0
[21:42:16:215] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:215] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_Set]: handle=0
[21:42:16:486] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:784] [3152983:00301c8f] [WARN][com.freerdp.channels.drdynvc.client] - [check_open_close_receive]: {Microsoft::Windows::RDS::DisplayControl:10} OnOpen=(nil), OnClose=0x7f8dcacb5840
[21:42:16:789] [3152983:00301c89] [ERROR][TODO] - [xf_rail_server_system_param]: TODO: implement
[21:42:16:789] [3152983:00301c89] [ERROR][TODO] - [xf_rail_server_system_param]: TODO: implement
[21:42:16:790] [3152983:00301c89] [ERROR][TODO] - [xf_rail_server_language_bar_info]: TODO: implement
[21:42:16:852] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:857] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:857] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_Set]: handle=0
[21:42:16:964] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:16:964] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_Set]: handle=0
[21:42:16:975] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:16:986] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:012] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:034] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:036] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:037] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:038] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:039] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:17:395] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:21:555] [3152983:00301c64] [ERROR][TODO] - [xf_rail_monitored_desktop]: TODO: implement
[21:42:41:541] [3152983:00301c64] [WARN][com.freerdp.client.x11] - [xf_Pointer_get_window]: xf_Pointer: Invalid appWindow
[21:42:41:743] [3152983:00301c64] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C]
[21:42:41:748] [3152983:00301c8f] [WARN][com.freerdp.channels.drdynvc.client] - [check_open_close_receive]: {Microsoft::Windows::RDS::DisplayControl:10} OnOpen=(nil), OnClose=0x7f8dcacb5840
at genericNodeError (node:internal/errors:983:15)
at wrappedFn (node:internal/errors:537:14)
at ChildProcess.exithandler (node:child_process:414:12)
at ChildProcess.emit (node:events:518:28)
at maybeClose (node:internal/child_process:1101:16)
at ChildProcess._handle.onexit (node:internal/child_process:304:5)
Is this just because we were previously hiding an error log?:
I would assume so, as I get the same error and [16:03:53:626] [2:00000004] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C] seems to suggest the same.
[17:03:01:401] [2:00000004] [WARN][com.freerdp.client.x11] - [xf_rail_monitored_desktop]: TODO: implement WINDOW_ORDER_FIELD_DESKTOP_ZORDER
[17:03:21:423] [2:00000004] [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server.
[17:03:21:423] [2:00000004] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C]
I get the same error when I run the command normally, so it seems to be the same. Should I try and catch this error?
[17:03:01:401] [2:00000004] [WARN][com.freerdp.client.x11] - [xf_rail_monitored_desktop]: TODO: implement WINDOW_ORDER_FIELD_DESKTOP_ZORDER [17:03:21:423] [2:00000004] [INFO][com.freerdp.core] - [rdp_print_errinfo]: ERRINFO_LOGOFF_BY_USER (0x0000000C):The disconnection was initiated by the user logging off their session on the server. [17:03:21:423] [2:00000004] [ERROR][com.freerdp.core] - [rdp_set_error_info]: ERRINFO_LOGOFF_BY_USER [0x0001000C]I get the same error when I run the command normally, so it seems to be the same. Should I try and catch this error?
If it can be caught, yes please.
Note, at the moment I'm not sure if this PR will make it through to 0.9.0 - though I personally wouldn't mind if it did - feel free to hold off efforts until after the freeze is lifted if you want. Once I'm happy with changes the final call is with Levev/Tibix.
The error should now be caught properly!
Marking this as draft, as I have to also convert the new container runtime code into execFile
(and im a bit tired, so I can't do it now)
Done!
Thanks!
LGTM!
OH LOL, I completely forgot the purpose of async, is to be non blocking. No clues why I used callback instead. Thanks levev for fixing that silly mistake for me!