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