Blob Blame History Raw
From ecd37ba6d56a49dd896613f68d1e1754633b9f0c Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Wed, 6 Feb 2019 16:14:52 -0500
Subject: [PATCH 1/4] manager: don't kill timed login session immediately after
 it starts

At the moment GDM is misidentifying timed login sessions as if
they are automatic login sessions.  That leads to their displays
getting killed sometimes shortly after log in.

This commit corrects the check, so that timed login sessions aren't
treated as autologin sessions.
---
 daemon/gdm-manager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 1943d89e4..72d44b006 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1838,61 +1838,62 @@ on_start_user_session (StartUserSessionOperation *operation)
                                 NULL);
         } else {
                 uid_t allowed_uid;
 
                 g_object_ref (display);
                 if (doing_initial_setup) {
                         g_debug ("GdmManager: closing down initial setup display");
                         gdm_display_stop_greeter_session (display);
                         gdm_display_unmanage (display);
                         gdm_display_finish (display);
 
                         /* We can't start the user session until the finished display
                          * starts to respawn (since starting an X server and bringing
                          * one down at the same time is a no go)
                          */
                         g_assert (self->priv->initial_login_operation == NULL);
                         self->priv->initial_login_operation = operation;
                         starting_user_session_right_away = FALSE;
                 } else {
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
                 }
 
                 /* The user session is going to follow the session worker
                  * into the new display. Untie it from this display and
                  * create a new session for a future user login. */
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
                 create_user_session_for_display (operation->manager, display, allowed_uid);
 
-                if (g_strcmp0 (operation->service_name, "gdm-autologin") == 0) {
+                if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
+                    !gdm_session_client_is_connected (operation->session)) {
                         /* remove the unused prepared greeter display since we're not going
                          * to have a greeter */
                         gdm_display_store_remove (self->priv->display_store, display);
                         g_object_unref (display);
                 }
 
                 /* Give the user session a new display object for bookkeeping purposes */
                 create_display_for_user_session (operation->manager,
                                                  operation->session,
                                                  session_id);
         }
 
         if (starting_user_session_right_away) {
                 start_user_session (operation->manager, operation);
         }
 
  out:
         return G_SOURCE_REMOVE;
 }
 
 static void
 queue_start_user_session (GdmManager *manager,
                           GdmSession *session,
                           const char *service_name)
 {
         StartUserSessionOperation *operation;
 
         operation = g_slice_new0 (StartUserSessionOperation);
         operation->manager = manager;
         operation->session = g_object_ref (session);
-- 
2.26.0