From: Anthony Eadicicco Date: Tue, 6 Oct 2020 18:36:29 +0000 (-0400) Subject: In batch mode, set groups to group membership of target user. X-Git-Tag: 1.11~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=26985aef96b820d0b62aca93e565559ab612ee82;p=deb_pkgs%2Fautorandr.git In batch mode, set groups to group membership of target user. Previously, group list was cleared during privilege de-escalation. This causes profiles scripts to be run as the local user with an empty group list. This can cause issues when, eg, the 'video' group is required for backlight control, and the user is trying to invoke xbacklight from postswitch.sh. --- diff --git a/autorandr.py b/autorandr.py index 535ec31..a2c6f82 100755 --- a/autorandr.py +++ b/autorandr.py @@ -1101,7 +1101,7 @@ def dispatch_call_to_sessions(argv): # so it should be safe. Also, note that since the environment # is taken from a process owned by the user, reusing it should # not leak any information. - os.setgroups([]) + os.setgroups(os.getgrouplist(pwent.pw_name, pwent.pw_gid)) os.setresgid(pwent.pw_gid, pwent.pw_gid, pwent.pw_gid) os.setresuid(pwent.pw_uid, pwent.pw_uid, pwent.pw_uid) os.chdir(pwent.pw_dir)