Blob Blame History Raw
From cfc1dd96dee55afde7f377878905302db9cbdcf6 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 30 Aug 2018 16:04:41 -0400
Subject: [PATCH 26/48] manager: don't set ran_once after running initial-setup

GdmManager tracks whether or not the user session has ran
once, so it won't autologin a user again after logout.

Unfortunately the initial-setup session was counting toward the
ran_once count preventing initial-setup from logging the user
in afterward.

This commit prevents ran_once from getting set in that case.
---
 daemon/gdm-manager.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index 367a731cc..c8197a043 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1519,105 +1519,107 @@ set_up_session (GdmManager *manager,
                 operation->username = username;
 
                 g_signal_connect (user,
                                   "notify::is-loaded",
                                   G_CALLBACK (on_user_is_loaded_changed),
                                   operation);
         }
 }
 
 static void
 greeter_display_started (GdmManager *manager,
                          GdmDisplay *display)
 {
         if (manager->priv->ran_once) {
                 return;
         }
 
         maybe_start_pending_initial_login (manager, display);
 }
 
 static void
 on_display_status_changed (GdmDisplay *display,
                            GParamSpec *arg1,
                            GdmManager *manager)
 {
         int         status;
         int         display_number = -1;
         char       *session_type = NULL;
 #ifdef WITH_PLYMOUTH
         gboolean    display_is_local = FALSE;
+        gboolean    doing_initial_setup = FALSE;
         gboolean    quit_plymouth = FALSE;
 
         g_object_get (display,
                       "is-local", &display_is_local,
+                      "doing-initial-setup", &doing_initial_setup,
                       NULL);
         quit_plymouth = display_is_local && manager->priv->plymouth_is_running;
 #endif
 
         g_object_get (display,
                       "x11-display-number", &display_number,
                       "session-type", &session_type,
                       NULL);
 
         status = gdm_display_get_status (display);
 
         switch (status) {
                 case GDM_DISPLAY_PREPARED:
                 case GDM_DISPLAY_MANAGED:
                         if ((display_number == -1 && status == GDM_DISPLAY_PREPARED) ||
                             (display_number != -1 && status == GDM_DISPLAY_MANAGED)) {
                                 char *session_class;
 
                                 g_object_get (display,
                                               "session-class", &session_class,
                                               NULL);
                                 if (g_strcmp0 (session_class, "greeter") == 0)
                                         set_up_session (manager, display);
                                 g_free (session_class);
                         }
 
                         if (status == GDM_DISPLAY_MANAGED) {
                                 greeter_display_started (manager, display);
                         }
                         break;
                 case GDM_DISPLAY_FAILED:
                 case GDM_DISPLAY_UNMANAGED:
                 case GDM_DISPLAY_FINISHED:
 #ifdef WITH_PLYMOUTH
                         if (quit_plymouth) {
                                 plymouth_quit_without_transition ();
                                 manager->priv->plymouth_is_running = FALSE;
                         }
 #endif
 
-                        if (status == GDM_DISPLAY_FINISHED || g_strcmp0 (session_type, "x11") == 0) {
+                        if (!doing_initial_setup && (status == GDM_DISPLAY_FINISHED || g_strcmp0 (session_type, "x11") == 0)) {
                                 manager->priv->ran_once = TRUE;
                         }
                         maybe_start_pending_initial_login (manager, display);
                         break;
                 default:
                         break;
         }
 
 }
 
 static void
 on_display_removed (GdmDisplayStore *display_store,
                     GdmDisplay      *display,
                     GdmManager      *manager)
 {
         char    *id;
 
         gdm_display_get_id (display, &id, NULL);
         g_dbus_object_manager_server_unexport (manager->priv->object_manager, id);
         g_free (id);
 
         g_signal_handlers_disconnect_by_func (display, G_CALLBACK (on_display_status_changed), manager);
 
         g_signal_emit (manager, signals[DISPLAY_REMOVED], 0, display);
 }
 
 static void
 destroy_start_user_session_operation (StartUserSessionOperation *operation)
 {
         g_object_set_data (G_OBJECT (operation->session),
-- 
2.26.0