Blame SOURCES/0001-manager-ensure-is-initial-is-transfered-to-autologin.patch

7b586f
From 4b2db2cf52be75e2eec4aa29f8ee082392ded410 Mon Sep 17 00:00:00 2001
7b586f
From: Ray Strode <rstrode@redhat.com>
7b586f
Date: Thu, 1 Nov 2018 13:03:37 -0400
7b586f
Subject: [PATCH] manager: ensure is-initial is transfered to autologin display
7b586f
7b586f
At the moment, we don't handle transferring the is-initial property to
7b586f
the autologin display.
7b586f
7b586f
That prevents autologin from working if wayland fails and X falls back,
7b586f
since autologin currently requires an initial display.
7b586f
7b586f
This commit makes sure we properly transfer is-initial from greeter to
7b586f
user display.
7b586f
---
7b586f
 daemon/gdm-manager.c | 14 ++++++++++++--
7b586f
 1 file changed, 12 insertions(+), 2 deletions(-)
7b586f
7b586f
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
7b586f
index 1943d89e4..2118c5834 100644
7b586f
--- a/daemon/gdm-manager.c
7b586f
+++ b/daemon/gdm-manager.c
7b586f
@@ -1740,90 +1740,93 @@ start_user_session (GdmManager *manager,
7b586f
 
7b586f
                 g_object_get (G_OBJECT (display), "is-connected", &is_connected, NULL);
7b586f
 
7b586f
                 if (is_connected) {
7b586f
                         auth_file = NULL;
7b586f
                         username = gdm_session_get_username (operation->session);
7b586f
                         gdm_display_add_user_authorization (display,
7b586f
                                                             username,
7b586f
                                                             &auth_file,
7b586f
                                                             NULL);
7b586f
 
7b586f
                         g_assert (auth_file != NULL);
7b586f
 
7b586f
                         g_object_set (operation->session,
7b586f
                                       "user-x11-authority-file", auth_file,
7b586f
                                       NULL);
7b586f
 
7b586f
                         g_free (auth_file);
7b586f
                 }
7b586f
         }
7b586f
 
7b586f
         gdm_session_start_session (operation->session,
7b586f
                                    operation->service_name);
7b586f
 
7b586f
         destroy_start_user_session_operation (operation);
7b586f
 }
7b586f
 
7b586f
 static void
7b586f
 create_display_for_user_session (GdmManager *self,
7b586f
                                  GdmSession *session,
7b586f
-                                 const char *session_id)
7b586f
+                                 const char *session_id,
7b586f
+                                 gboolean    is_initial)
7b586f
 {
7b586f
         GdmDisplay *display;
7b586f
         /* at the moment we only create GdmLocalDisplay objects on seat0 */
7b586f
         const char *seat_id = "seat0";
7b586f
 
7b586f
         display = gdm_local_display_new ();
7b586f
 
7b586f
         g_object_set (G_OBJECT (display),
7b586f
                       "session-class", "user",
7b586f
                       "seat-id", seat_id,
7b586f
                       "session-id", session_id,
7b586f
+                      "is-initial", is_initial,
7b586f
                       NULL);
7b586f
         gdm_display_store_add (self->priv->display_store,
7b586f
                                display);
7b586f
         g_object_set_data (G_OBJECT (session), "gdm-display", display);
7b586f
         g_object_set_data_full (G_OBJECT (display),
7b586f
                                 "gdm-user-session",
7b586f
                                 g_object_ref (session),
7b586f
                                 (GDestroyNotify)
7b586f
                                 clean_user_session);
7b586f
 }
7b586f
 
7b586f
 static gboolean
7b586f
 on_start_user_session (StartUserSessionOperation *operation)
7b586f
 {
7b586f
         GdmManager *self = operation->manager;
7b586f
         gboolean migrated;
7b586f
         gboolean fail_if_already_switched = TRUE;
7b586f
         gboolean doing_initial_setup = FALSE;
7b586f
+        gboolean should_be_initial = FALSE;
7b586f
         gboolean starting_user_session_right_away = TRUE;
7b586f
         GdmDisplay *display;
7b586f
         const char *session_id;
7b586f
 
7b586f
         g_debug ("GdmManager: start or jump to session");
7b586f
 
7b586f
         /* If there's already a session running, jump to it.
7b586f
          * If the only session running is the one we just opened,
7b586f
          * start a session on it.
7b586f
          */
7b586f
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
7b586f
 
7b586f
         g_debug ("GdmManager: migrated: %d", migrated);
7b586f
         if (migrated) {
7b586f
                 /* We don't stop the manager here because
7b586f
                    when Xorg exits it switches to the VT it was
7b586f
                    started from.  That interferes with fast
7b586f
                    user switching. */
7b586f
                 gdm_session_reset (operation->session);
7b586f
                 destroy_start_user_session_operation (operation);
7b586f
                 goto out;
7b586f
         }
7b586f
 
7b586f
         display = get_display_for_user_session (operation->session);
7b586f
 
7b586f
         g_object_get (G_OBJECT (display), "doing-initial-setup", &doing_initial_setup, NULL);
7b586f
 
7b586f
         session_id = gdm_session_get_conversation_session_id (operation->session,
7b586f
                                                               operation->service_name);
7b586f
 
7b586f
@@ -1839,70 +1842,77 @@ on_start_user_session (StartUserSessionOperation *operation)
7b586f
         } else {
7b586f
                 uid_t allowed_uid;
7b586f
 
7b586f
                 g_object_ref (display);
7b586f
                 if (doing_initial_setup) {
7b586f
                         g_debug ("GdmManager: closing down initial setup display");
7b586f
                         gdm_display_stop_greeter_session (display);
7b586f
                         gdm_display_unmanage (display);
7b586f
                         gdm_display_finish (display);
7b586f
 
7b586f
                         /* We can't start the user session until the finished display
7b586f
                          * starts to respawn (since starting an X server and bringing
7b586f
                          * one down at the same time is a no go)
7b586f
                          */
7b586f
                         g_assert (self->priv->initial_login_operation == NULL);
7b586f
                         self->priv->initial_login_operation = operation;
7b586f
                         starting_user_session_right_away = FALSE;
7b586f
                 } else {
7b586f
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
7b586f
                 }
7b586f
 
7b586f
                 /* The user session is going to follow the session worker
7b586f
                  * into the new display. Untie it from this display and
7b586f
                  * create a new session for a future user login. */
7b586f
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
7b586f
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
7b586f
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
7b586f
                 create_user_session_for_display (operation->manager, display, allowed_uid);
7b586f
 
7b586f
                 if (g_strcmp0 (operation->service_name, "gdm-autologin") == 0) {
7b586f
+                        gboolean was_initial = FALSE;
7b586f
+
7b586f
+                        g_object_get (G_OBJECT (display), "is-initial", &was_initial, NULL);
7b586f
+
7b586f
                         /* remove the unused prepared greeter display since we're not going
7b586f
                          * to have a greeter */
7b586f
                         gdm_display_store_remove (self->priv->display_store, display);
7b586f
                         g_object_unref (display);
7b586f
+
7b586f
+                        should_be_initial = was_initial;
7b586f
                 }
7b586f
 
7b586f
                 /* Give the user session a new display object for bookkeeping purposes */
7b586f
                 create_display_for_user_session (operation->manager,
7b586f
                                                  operation->session,
7b586f
-                                                 session_id);
7b586f
+                                                 session_id,
7b586f
+                                                 should_be_initial);
7b586f
         }
7b586f
 
7b586f
         if (starting_user_session_right_away) {
7b586f
                 start_user_session (operation->manager, operation);
7b586f
         }
7b586f
 
7b586f
  out:
7b586f
         return G_SOURCE_REMOVE;
7b586f
 }
7b586f
 
7b586f
 static void
7b586f
 queue_start_user_session (GdmManager *manager,
7b586f
                           GdmSession *session,
7b586f
                           const char *service_name)
7b586f
 {
7b586f
         StartUserSessionOperation *operation;
7b586f
 
7b586f
         operation = g_slice_new0 (StartUserSessionOperation);
7b586f
         operation->manager = manager;
7b586f
         operation->session = g_object_ref (session);
7b586f
         operation->service_name = g_strdup (service_name);
7b586f
 
7b586f
         operation->idle_id = g_idle_add ((GSourceFunc) on_start_user_session, operation);
7b586f
         g_object_set_data (G_OBJECT (session), "start-user-session-operation", operation);
7b586f
 }
7b586f
 
7b586f
 static void
7b586f
 start_user_session_if_ready (GdmManager *manager,
7b586f
                              GdmSession *session,
7b586f
                              const char *service_name)
7b586f
-- 
7b586f
2.19.1
7b586f