diff --git a/src/polkit/polkitunixsession-systemd.c b/src/polkit/polkitunixsession-systemd.c index 8a8bf65..2cbaa82 100644 --- a/src/polkit/polkitunixsession-systemd.c +++ b/src/polkit/polkitunixsession-systemd.c @@ -451,6 +451,7 @@ polkit_unix_session_initable_init (GInitable *initable, PolkitUnixSession *session = POLKIT_UNIX_SESSION (initable); gboolean ret = FALSE; char *s; + uid_t uid; if (session->session_id != NULL) { @@ -467,6 +468,17 @@ polkit_unix_session_initable_init (GInitable *initable, goto out; } + /* Now do process -> uid -> graphical session (systemd version 213)*/ + if (sd_pid_get_owner_uid (session->pid, &uid) < 0) + goto out; + + if (sd_uid_get_display (uid, &s) >= 0) + { + session->session_id = g_strdup (polkit_unix_session_new (s)); + ret = TRUE; + goto out; + } + g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED,