Blame SOURCES/0001-manager-update-session-id-property-when-reusing-disp.patch

75a7a3
From b1e364e4f5651888be7a075dad044b445e0f0236 Mon Sep 17 00:00:00 2001
75a7a3
From: Ray Strode <rstrode@redhat.com>
75a7a3
Date: Thu, 4 May 2017 15:34:33 -0400
75a7a3
Subject: [PATCH] manager: update session-id property when reusing display
75a7a3
75a7a3
If a display starts out its life as a greeter display, and then
75a7a3
gets reused for the user session, we need to update the session-id
75a7a3
property on the display to match its new session.
75a7a3
75a7a3
This is important so the reauthentication process match the
75a7a3
session with existing display and run in the proper context.
75a7a3
---
75a7a3
 daemon/gdm-manager.c | 12 ++++++++----
75a7a3
 1 file changed, 8 insertions(+), 4 deletions(-)
75a7a3
75a7a3
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
75a7a3
index 9201b9f8..3eef745f 100644
75a7a3
--- a/daemon/gdm-manager.c
75a7a3
+++ b/daemon/gdm-manager.c
75a7a3
@@ -1750,130 +1750,134 @@ start_user_session (GdmManager *manager,
75a7a3
 static void
75a7a3
 create_display_for_user_session (GdmManager *self,
75a7a3
                                  GdmSession *session,
75a7a3
                                  const char *session_id)
75a7a3
 {
75a7a3
         GdmDisplay *display;
75a7a3
         /* at the moment we only create GdmLocalDisplay objects on seat0 */
75a7a3
         const char *seat_id = "seat0";
75a7a3
 
75a7a3
         display = gdm_local_display_new ();
75a7a3
 
75a7a3
         g_object_set (G_OBJECT (display),
75a7a3
                       "session-class", "user",
75a7a3
                       "seat-id", seat_id,
75a7a3
                       "session-id", session_id,
75a7a3
                       NULL);
75a7a3
         gdm_display_store_add (self->priv->display_store,
75a7a3
                                display);
75a7a3
         g_object_set_data (G_OBJECT (session), "gdm-display", display);
75a7a3
 }
75a7a3
 
75a7a3
 static gboolean
75a7a3
 on_start_user_session (StartUserSessionOperation *operation)
75a7a3
 {
75a7a3
         GdmManager *self = operation->manager;
75a7a3
         gboolean migrated;
75a7a3
         gboolean fail_if_already_switched = TRUE;
75a7a3
         gboolean doing_initial_setup = FALSE;
75a7a3
         gboolean starting_user_session_right_away = TRUE;
75a7a3
         GdmDisplay *display;
75a7a3
+        const char *session_id;
75a7a3
 
75a7a3
         g_debug ("GdmManager: start or jump to session");
75a7a3
 
75a7a3
         /* If there's already a session running, jump to it.
75a7a3
          * If the only session running is the one we just opened,
75a7a3
          * start a session on it.
75a7a3
          */
75a7a3
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
75a7a3
 
75a7a3
         g_debug ("GdmManager: migrated: %d", migrated);
75a7a3
         if (migrated) {
75a7a3
                 /* We don't stop the manager here because
75a7a3
                    when Xorg exits it switches to the VT it was
75a7a3
                    started from.  That interferes with fast
75a7a3
                    user switching. */
75a7a3
                 gdm_session_reset (operation->session);
75a7a3
                 destroy_start_user_session_operation (operation);
75a7a3
                 goto out;
75a7a3
         }
75a7a3
 
75a7a3
         display = get_display_for_user_session (operation->session);
75a7a3
 
75a7a3
         g_object_get (G_OBJECT (display), "doing-initial-setup", &doing_initial_setup, NULL);
75a7a3
 
75a7a3
+        session_id = gdm_session_get_conversation_session_id (operation->session,
75a7a3
+                                                              operation->service_name);
75a7a3
+
75a7a3
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
75a7a3
                 /* In this case, the greeter's display is morphing into
75a7a3
                  * the user session display. Kill the greeter on this session
75a7a3
                  * and let the user session follow the same display. */
75a7a3
                 gdm_display_stop_greeter_session (display);
75a7a3
-                g_object_set (G_OBJECT (display), "session-class", "user", NULL);
75a7a3
+                g_object_set (G_OBJECT (display),
75a7a3
+                                "session-class", "user",
75a7a3
+                                "session-id", session_id,
75a7a3
+                                NULL);
75a7a3
         } else {
75a7a3
-                const char *session_id;
75a7a3
                 uid_t allowed_uid;
75a7a3
 
75a7a3
                 g_object_ref (display);
75a7a3
                 if (doing_initial_setup) {
75a7a3
                         g_debug ("GdmManager: closing down initial setup display");
75a7a3
                         gdm_display_stop_greeter_session (display);
75a7a3
                         gdm_display_unmanage (display);
75a7a3
                         gdm_display_finish (display);
75a7a3
 
75a7a3
                         /* We can't start the user session until the finished display
75a7a3
                          * starts to respawn (since starting an X server and bringing
75a7a3
                          * one down at the same time is a no go)
75a7a3
                          */
75a7a3
                         g_assert (self->priv->initial_login_operation == NULL);
75a7a3
                         self->priv->initial_login_operation = operation;
75a7a3
                         starting_user_session_right_away = FALSE;
75a7a3
                 } else {
75a7a3
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
75a7a3
                 }
75a7a3
 
75a7a3
                 /* The user session is going to follow the session worker
75a7a3
                  * into the new display. Untie it from this display and
75a7a3
                  * create a new embryonic session for a future user login. */
75a7a3
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
75a7a3
                 g_object_set_data (G_OBJECT (display), "gdm-embryonic-user-session", NULL);
75a7a3
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
75a7a3
                 create_embryonic_user_session_for_display (operation->manager, display, allowed_uid);
75a7a3
 
75a7a3
                 if (g_strcmp0 (operation->service_name, "gdm-autologin") == 0) {
75a7a3
                         /* remove the unused prepared greeter display since we're not going
75a7a3
                          * to have a greeter */
75a7a3
                         gdm_display_store_remove (self->priv->display_store, display);
75a7a3
                         g_object_unref (display);
75a7a3
                 }
75a7a3
 
75a7a3
                 /* Give the user session a new display object for bookkeeping purposes */
75a7a3
-                session_id = gdm_session_get_conversation_session_id (operation->session,
75a7a3
-                                                                      operation->service_name);
75a7a3
                 create_display_for_user_session (operation->manager,
75a7a3
                                                  operation->session,
75a7a3
                                                  session_id);
75a7a3
         }
75a7a3
 
75a7a3
         if (starting_user_session_right_away) {
75a7a3
                 start_user_session (operation->manager, operation);
75a7a3
         }
75a7a3
 
75a7a3
  out:
75a7a3
         return G_SOURCE_REMOVE;
75a7a3
 }
75a7a3
 
75a7a3
 static void
75a7a3
 queue_start_user_session (GdmManager *manager,
75a7a3
                           GdmSession *session,
75a7a3
                           const char *service_name)
75a7a3
 {
75a7a3
         StartUserSessionOperation *operation;
75a7a3
 
75a7a3
         operation = g_slice_new0 (StartUserSessionOperation);
75a7a3
         operation->manager = manager;
75a7a3
         operation->session = g_object_ref (session);
75a7a3
         operation->service_name = g_strdup (service_name);
75a7a3
 
75a7a3
         operation->idle_id = g_idle_add ((GSourceFunc) on_start_user_session, operation);
75a7a3
         g_object_set_data (G_OBJECT (session), "start-user-session-operation", operation);
75a7a3
 }
75a7a3
 
75a7a3
 static void
75a7a3
-- 
75a7a3
2.12.2
75a7a3