From b0c44d868e9c28a87b8a5428b1c43c34ef9d6b33 Mon Sep 17 00:00:00 2001 From: totaam Date: Thu, 23 Sep 2021 18:59:19 +0700 Subject: [PATCH] #3276 fallback to current user credentials if the ones specified are invalid --- xpra/scripts/main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/xpra/scripts/main.py b/xpra/scripts/main.py index 52b0e88843..242a7b840e 100755 --- a/xpra/scripts/main.py +++ b/xpra/scripts/main.py @@ -1430,12 +1430,21 @@ def get_sockpath(display_desc, error_cb, timeout=CONNECT_TIMEOUT): sockpath = display_desc.get("socket_path") if not sockpath: #find the socket using the display: + # if uid, gid or username are missing or not found on the local system, + # use the uid, gid and username of the current user: + uid = display_desc.get("uid", getuid()) + gid = display_desc.get("gid", getgid()) + username = display_desc.get("username", get_username_for_uid(uid)) + if not username: + uid = getuid() + gid = getgid() + username = get_username_for_uid(uid) dotxpra = DotXpra( display_desc.get("socket_dir"), display_desc.get("socket_dirs"), - display_desc.get("username", ""), - display_desc.get("uid", 0), - display_desc.get("gid", 0), + username, + uid, + gid, ) display = display_desc["display"] def socket_details(state=DotXpra.LIVE):