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 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!
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!
(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
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.