xfce4-session doesn't check for reboot correctly

Bug #1724196 reported by Owen Dunn
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Xfce4 Session
Fix Released
Medium
xfce4-session (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

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)

Tags: patch
Revision history for this message
Owen Dunn (osd1000) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Patch to xfsm-systemd.c" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Theo Linkspfeifer (lastonestanding) wrote :

Please forward this patch to the Xfce bug tracker. Thanks.

https://bugzilla.xfce.org/

Revision history for this message
In , Theo Linkspfeifer (lastonestanding) wrote :

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)

Changed in xfce4-session:
importance: Unknown → Medium
status: Unknown → Confirmed
Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :

Your patch will probably fix bug #13699 too.

Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :

Can anyone take a look at this patch? Let's put it in xfce4-session 4.13.x for better testing!

Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :

Created attachment 8416
Use logind Can* methods

Patch updated to git master plus style fixes.

Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :

Tested it on Arch Linux with xfce4-session-4.13.1git-5a42eda8 and can confirm it fixes bug 13699 too.

Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :

Created attachment 8417
Use logind Can* methods (V2)

One more style fix.

Revision history for this message
In , Theo Linkspfeifer (lastonestanding) wrote :

*** Bug 13699 has been marked as a duplicate of this bug. ***

Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :

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)

Revision history for this message
In , Marcos Felipe Mello (marcosfrm) wrote :
Revision history for this message
In , Gitbot (gitbot) wrote :

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

Revision history for this message
In , Simon Steinbeiß (ochosi) wrote :

Merged it in, let's test this properly.

Changed in xfce4-session:
status: Confirmed → Fix Released
Revision history for this message
Sean Davis (bluesabre) wrote :

Fixed in release 4.13.2.

Changed in xfce4-session (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.