Created attachment 7984 Patch to xfsm-systemd.c Forwarded from https://bugs.launchpad.net/ubuntu/+source/xfce4-session/+bug/1724196 --- xfce4-session 4.12.1-3ubuntu1 xfce4-session determines which buttons to grey out on the logout dialogue box by calling polkit_check_authorization_sync for the action org.freedesktop.login1.reboot etc. However, if polkit policy permits these actions but denies org.freedesktop.login1.reboot-multiple-sessions, and multiple users are logged in, the restart button on the logout dialogue box will be enabled even though the user isn't able to reboot the machine. xfce4-session should instead use the CanReboot (etc.) methods on systemd-logind, which will automatically correctly check the correct polkit permissions. I attach a patch to xfsm-systemd.c which works for me. (S)
Your patch will probably fix bug #13699 too.
Can anyone take a look at this patch? Let's put it in xfce4-session 4.13.x for better testing!
Created attachment 8416 Use logind Can* methods Patch updated to git master plus style fixes.
Tested it on Arch Linux with xfce4-session-4.13.1git-5a42eda8 and can confirm it fixes bug 13699 too.
Created attachment 8417 Use logind Can* methods (V2) One more style fix.
*** Bug 13699 has been marked as a duplicate of this bug. ***
Created attachment 8421 Use logind Can* methods (V3) Very old logind versions (< 196) do not support CanHybridSleep method. In this case g_dbus_connection_call_sync() will return NULL and g_variant_get() will explode. Hence test if dbus_ret != NULL. (sorry, previous patches were mangled somehow)
Fix also needed in xfce4-power-manager: https://git.xfce.org/xfce/xfce4-power-manager/tree/src/xfpm-systemd.c#n116
Simon Steinbeiss referenced this bugreport in commit e10ac91be3301c92900168855b265101ba9884e2 Use systemd-logind methods instead of polkit permissions (Bug #14707) https://git.xfce.org/xfce/xfce4-session/commit?id=e10ac91be3301c92900168855b265101ba9884e2
Merged it in, let's test this properly.