Bug 78905

Summary: systemd: support for D-Bus "user bus" model (patch)
Product: PolicyKit Reporter: Kay Sievers <kay>
Component: daemonAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED FIXED QA Contact: David Zeuthen (not reading bugmail) <zeuthen>
Severity: normal    
Priority: medium CC: walters
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: support for "user bus" model
support for "user bus" model + configure check for older libsystemd-login

Description Kay Sievers 2014-05-19 11:46:24 UTC
Created attachment 99330 [details]
support for "user bus" model

In the D-Bus "user bus" model, all sessions of a user share the same
D-Bus instance, a polkit requesting process might live outside the
login session which registered the user's polkit agent.

In case a polkit requesting process is not part of the user's login
session, we ask systemd-logind for the the user's "display" session
instead.

Thanks!
Comment 1 Colin Walters 2014-05-21 13:51:21 UTC
Comment on attachment 99330 [details]
support for "user bus" model

>
>+      free (session_id);

Can you lower this free to the out: section to deduplicate error handling?

>+      goto out;
>+    }
>+
>+  /* Now do process -> uid -> graphical session */
>+  if (sd_pid_get_owner_uid(pid, &uid) < 0)

Polkit style has space between identifier and paren.

>+  if (sd_uid_get_display(uid, &session_id) >= 0)

Looks like this API isn't in any release yet, it's:
v212-438-ga077b66
And even if it was, having a hard dependency on bleeding edge
systemd would be painful for many people, including me where
I build git master of polkit on RHEL7.

My old patch has some minimally invasive autofoo for this:
https://people.gnome.org/~walters/user-session-patches/polkit/0001-unixsession-systemd-For-processes-not-in-session-loo.patch

Can you do that too?

Thanks for the patch!
Comment 2 Kay Sievers 2014-05-21 14:18:05 UTC
Created attachment 99509 [details]
support for "user bus" model + configure check for older libsystemd-login

(In reply to comment #1)
> >+      free (session_id);
> 
> Can you lower this free to the out: section to deduplicate error handling?

Done.

> Polkit style has space between identifier and paren.

Fixed.

> >+  if (sd_uid_get_display(uid, &session_id) >= 0)
> 
> Looks like this API isn't in any release yet, it's:

It will be the next days, we are working on it.

> And even if it was, having a hard dependency on bleeding edge
> systemd would be painful for many people, including me where
> I build git master of polkit on RHEL7.

Ah, sure, sounds useful. Added the check and ifdefs.

Thanks!
Comment 3 Kay Sievers 2014-05-28 09:34:46 UTC
(In reply to comment #2)
> > >+  if (sd_uid_get_display(uid, &session_id) >= 0)
> > 
> > Looks like this API isn't in any release yet, it's:
> 
> It will be the next days, we are working on it.

systemd 213 is released and in Fedora rawhide now.

Thanks,
Kay
Comment 4 Colin Walters 2014-06-03 18:04:00 UTC
Looks good to me.  I built it on RHEL7 and tested the fallback path as well.

http://cgit.freedesktop.org/polkit/commit/?id=a68f5dfd7662767b7b9822090b70bc5bd145c50c

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.