neutrinolabs / xrdp

xrdp: an open source RDP server
http://www.xrdp.org/
Apache License 2.0
5.64k stars 1.73k forks source link

Wait for capabilities message from Xorg #3197

Open matt335672 opened 1 month ago

matt335672 commented 1 month ago

This is partly mentioned in #1816

This commit adds a stage into the Xorg connection status to wait for the capabilities message from the Xorg server.

This allows us to move the xorgxrdp version check to xrdp from the X server for better reporting to the user.

This PR needs neutrinolabs/xorgxrdp#332 to function correctly, but can be merged separately.

Currently, if the xrdp and xorgxrdp versions don't match:- 1) The connection terminates immediately. 2) The version mismatch is reported in ~/.xorgxrdp.$D.log (not xrdp.log) 3) The X server aborts.

With both of these PRs:- 1) An error is displayed to the user 2) The version mismatch is reported in xrdp.log 3) The X server continues to run.

Screenshot for a version mismatch:-

image

Corresponding xrdp.log:-

[2024-08-06T11:32:08.469+0100] [INFO ] [lib_mod_connect(xup.c:269)] lib_mod_connect: connecting via UNIX socket
[2024-08-06T11:32:08.469+0100] [INFO ] [lib_mod_connect(xup.c:304)] lib_mod_connect: connected to Xserver (Xorg) sck 29
[2024-08-06T11:32:08.469+0100] [INFO ] [lib_mod_log_peer(xup.c:79)] lib_mod_log_peer: xrdp_pid=80398 connected to Xorg_pid=80518 Xorg_uid=1001 Xorg_gid=1001 client=[::ffff:172.19.73.10]:32884
[2024-08-06T11:32:08.476+0100] [ERROR] [lib_mod_process_message(xup.c:1839)] Xorg module has version 20240806, expected 20240805
[2024-08-06T11:32:08.479+0100] [ERROR] [xrdp_wm_log_msg(xrdp_wm.c:2434)] xrdp_wm_log_msg: Error connecting to user session
metalefty commented 1 month ago

I like the idea.