! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
xfce4-session doesn't check for reboot correctly
Status:
RESOLVED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Theo Linkspfeifer editbugs 2018-09-19 11:55:02 CEST
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)
Comment 1 Marcos Mello 2018-11-03 11:40:18 CET
Your patch will probably fix bug #13699 too.
Comment 2 Marcos Mello 2019-03-04 12:22:30 CET
Can anyone take a look at this patch? Let's put it in xfce4-session 4.13.x for better testing!
Comment 3 Marcos Mello 2019-04-17 17:19:05 CEST
Created attachment 8416 
Use logind Can* methods

Patch updated to git master plus style fixes.
Comment 4 Marcos Mello 2019-04-17 17:21:56 CEST
Tested it on Arch Linux with xfce4-session-4.13.1git-5a42eda8 and can confirm it fixes bug 13699 too.
Comment 5 Marcos Mello 2019-04-17 17:38:02 CEST
Created attachment 8417 
Use logind Can* methods (V2)

One more style fix.
Comment 6 Theo Linkspfeifer editbugs 2019-04-17 20:35:57 CEST
*** Bug 13699 has been marked as a duplicate of this bug. ***
Comment 7 Marcos Mello 2019-04-19 00:47:45 CEST
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)
Comment 8 Marcos Mello 2019-04-22 12:13:00 CEST
Fix also needed in xfce4-power-manager:

https://git.xfce.org/xfce/xfce4-power-manager/tree/src/xfpm-systemd.c#n116
Comment 9 Git Bot editbugs 2019-04-25 00:51:34 CEST
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
Comment 10 Simon Steinbeiss editbugs 2019-04-25 01:07:35 CEST
Merged it in, let's test this properly.

Bug #14707

Reported by:
Theo Linkspfeifer
Reported on: 2018-09-19
Last modified on: 2019-04-25
Duplicates (1):
  • 13699 Logout dialog shows "Hibernate" despite logind saying it is not supported

People

Assignee:
Skunnyk
CC List:
3 users

Version

Version:
4.12.0

Attachments

Patch to xfsm-systemd.c (4.92 KB, application/octet-stream)
2018-09-19 11:55 CEST , Theo Linkspfeifer
no flags
Use logind Can* methods (3.05 KB, patch)
2019-04-17 17:19 CEST , Marcos Mello
no flags
Use logind Can* methods (V2) (3.04 KB, patch)
2019-04-17 17:38 CEST , Marcos Mello
no flags
Use logind Can* methods (V3) (3.16 KB, patch)
2019-04-19 00:47 CEST , Marcos Mello
no flags

Additional information