valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0218-logind-Save-the-user-s-state-when-a-session-enters-S.patch

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