! 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 !
Suspend and Hibernate doesn't work from Logout (because of subject cookie usage)
Status:
RESOLVED: FIXED
Product:
Xfce4-session
Component:
General

Comments

Description Samuli Suominen 2010-11-12 18:22:59 CET
Created attachment 3185 
Dont use subject cookie

Suspend and Hibernate is only visible from Logout with --disable-policykit passed to ./configure.

This same problem was fixed in xfce4-power-manager with this commit for 1.0.0 release:

http://git.xfce.org/apps/xfce4-power-manager/commit/?id=17f616d957f6ab7be0d61487babb582b53ed2459

$ pkaction | grep -e hibernate -e suspend
org.freedesktop.upower.hibernate
org.freedesktop.upower.suspend

$ xfce4-power-manager --dump | grep -e hibernate -e suspend
Can suspend: True
Can hibernate: True
Authorized to suspend: True
Authorized to hibernate: True

As above output 'proofs' the authorization to do that is present, so it's not a issue in upower's policy rules.

I'm attaching the patch that imitates the commit in xfce4-power-manager, that fixed the problem for me in xfce4-session too.
Comment 1 Tomoh K. 2010-11-13 07:28:00 CET
I can confirm this issue too and I think I can explain a little bit about this.

IMHO, PolicyKit authorization which using org.freedesktop.PolicyKit1.Authority interface with using unix-session as a Polkit Subject is broken. It makes a authorization for "nil" session. Using this interface in such a way is exists only in PolKit documents but not be implemented on sources.

Same interface with using unix-process or system-bus-name works properly. So Samuli's patch (and xfpm) works fine.

I have tested it on Gentoo's polkit-0.96-r1. As a my understanding, latest PolicyKit is the same about this.(I haven't tested it yet, only read sources on git). If I am not wrong about this, I (or someone who knows more about PolicyKit than me) should be fill a bug report for PolicyKit.
Comment 2 Jannis Pohlmann editbugs 2010-11-13 12:58:39 CET
Thanks for the comments. This bug has some information on the topic as well:

  http://bugzilla.xfce.org/show_bug.cgi?id=6462#c11

I fixed this in master now:

commit 394a43c96387ec1c294105b6fa8ea610d5e381dc
Author: Jannis Pohlmann <jannis@xfce.org>
Date:   Sat Nov 13 12:57:19 2010 +0100

    Don't use "unix-session" authorization with PolicyKit (bug #6817).
    
    This fixes suspend/hibernate in xfce4-session-logout. For some reason
    PolicyKit either has a broken "unix-session" implementation or no
    implementation at all. So most GNOME apps seem to use "unix-process".

Bug #6817

Reported by:
Samuli Suominen
Reported on: 2010-11-12
Last modified on: 2010-11-13

People

Assignee:
Jannis Pohlmann
CC List:
2 users

Version

Attachments

Dont use subject cookie (1.10 KB, patch)
2010-11-12 18:22 CET , Samuli Suominen
no flags

Additional information