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

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