Blob Blame History Raw
From 66250ce6402087d2e08f2008782edc02a0d013b0 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 5 Apr 2017 12:11:20 -0400
Subject: [PATCH 2/2] manager: stop transient greeter session when done with it

If we're running in legacy display mode, we currently can
end up with a leaked greeter following user switching.
That can happen if a user with an already running session
is reauthenticated (so the login screen won't morph into the
use session).

This commit makes sure we kill the greeter session off in that
case.
---
 daemon/gdm-manager.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 6ffb842..9201b9f 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -2010,6 +2010,26 @@ on_session_reauthenticated (GdmSession *session,
                             GdmManager *manager)
 {
         gboolean fail_if_already_switched = FALSE;
+
+        if (gdm_session_get_display_mode (session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
+                const char *seat_id;
+                char *session_id;
+
+                seat_id = gdm_session_get_display_seat_id (session);
+                if (get_login_window_session_id (seat_id, &session_id)) {
+                        GdmDisplay *display = gdm_display_store_find (manager->priv->display_store,
+                                                                      lookup_by_session_id,
+                                                                      (gpointer) session_id);
+
+                        if (display != NULL) {
+                                gdm_display_stop_greeter_session (display);
+                                gdm_display_unmanage (display);
+                                gdm_display_finish (display);
+                        }
+                }
+                g_free (session_id);
+        }
+
         /* There should already be a session running, so jump to its
          * VT. In the event we're already on the right VT, (i.e. user
          * used an unlock screen instead of a user switched login screen),
-- 
1.8.3.1