Set XAUTHORITY environment variable if is unset
authorDavid Zeuthen <zeuthen@gmail.com>
Wed, 19 Dec 2012 19:28:29 +0000 (14:28 -0500)
committerDavid Zeuthen <zeuthen@gmail.com>
Wed, 19 Dec 2012 19:34:34 +0000 (14:34 -0500)
commitd6acecdd0ebb42e28ff28e04e0207cb01fa20910
treef7ecf4eed3ab4c663361946b2fd95be706e77783
parent672189617a86ff63cedbf20e2e9e6e3ab599b278
Set XAUTHORITY environment variable if is unset

The way it works is that if XAUTHORITY is unset, then its default
value is $HOME/.Xauthority. But since we're changing user identity
this will not work since $HOME will now change. Therefore, if
XAUTHORITY is unset, just set its default value before changing
identity. This bug only affected login managers using X Window
Authorization but not explicitly setting the XAUTHORITY variable.

You can argue that XAUTHORITY is broken since it forces uid-changing
apps like pkexec(1) to do more work - and get involved in intimate
details of how X works and so on - but that doesn't change how things
work.

Based on a patch from Peter Wu <lekensteyn@gmail.com>.

https://bugs.freedesktop.org/show_bug.cgi?id=51623

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
src/programs/pkexec.c