daandemeyer / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
923a60
From a01e2476f0421026d12384292b34f303fc01c43c Mon Sep 17 00:00:00 2001
923a60
From: Philip Withnall <philip.withnall@collabora.co.uk>
923a60
Date: Tue, 2 Jun 2015 14:17:10 +0100
923a60
Subject: [PATCH] =?UTF-8?q?logind:=20Save=20the=20user=E2=80=99s=20state?=
923a60
 =?UTF-8?q?=20when=20a=20session=20enters=20SESSION=5FACTIVE?=
923a60
MIME-Version: 1.0
923a60
Content-Type: text/plain; charset=UTF-8
923a60
Content-Transfer-Encoding: 8bit
923a60
923a60
When (for example) switching from X11 to a new VT and logging in there,
923a60
creating a new session, the user state file (/run/systemd/users/$uid) is
923a60
not updated after the session becomes active. The latest time it is
923a60
saved is when the session is in SESSION_OPENING.
923a60
923a60
This results in a /run/systemd/users/$uid file which contains
923a60
STATE=online for the current user on the current active VT, which is
923a60
obviously wrong.
923a60
923a60
As functions like sd_uid_get_state() use this file to get the user’s
923a60
state, this could result in things like PolicyKit making incorrect
923a60
decisions about the user’s state. (See
923a60
https://bugs.freedesktop.org/show_bug.cgi?id=76358.)
923a60
923a60
Fix this by re-saving the state for a session’s user after completing
923a60
the state_job for that session.
923a60
923a60
https://bugs.freedesktop.org/show_bug.cgi?id=90818
923a60
(cherry picked from commit 41dfeaa194c18de49706b5cecf4e53accd12b7f6)
923a60
923a60
Cherry-picked from: 41dfeaa
923a60
Resolves: #1222517
923a60
---
923a60
 src/login/logind-dbus.c | 1 +
923a60
 1 file changed, 1 insertion(+)
923a60
923a60
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
923a60
index 8b0bafd49e..fb84e92e5d 100644
923a60
--- a/src/login/logind-dbus.c
923a60
+++ b/src/login/logind-dbus.c
923a60
@@ -2124,6 +2124,7 @@ int match_job_removed(sd_bus *bus, sd_bus_message *message, void *userdata, sd_b
923a60
                 session_jobs_reply(session, unit, result);
923a60
 
923a60
                 session_save(session);
923a60
+                user_save(session->user);
923a60
                 session_add_to_gc_queue(session);
923a60
         }
923a60