From 5289a5dcc7a928cc73db7ec1e18367bf1665bbc6 Mon Sep 17 00:00:00 2001 From: Joan Torres Lopez Date: Fri, 6 Mar 2026 16:51:07 +0100 Subject: [PATCH] Terminate conflicting sesions started outside of GDM Resolves: https://issues.redhat.com/browse/RHEL-4108 --- 0001-Handle-conflicting-sessions.patch | 113 ++++++++++++++++++++++++- gdm.spec | 6 +- 2 files changed, 115 insertions(+), 4 deletions(-) diff --git a/0001-Handle-conflicting-sessions.patch b/0001-Handle-conflicting-sessions.patch index bfebf39..7242fda 100644 --- a/0001-Handle-conflicting-sessions.patch +++ b/0001-Handle-conflicting-sessions.patch @@ -1,7 +1,7 @@ From e204ee23d7626ee09684494b49774d8fae4d6056 Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Thu, 8 May 2025 11:27:03 +0200 -Subject: [PATCH 1/3] manager: Use full verification on incompatible login +Subject: [PATCH 1/4] manager: Use full verification on incompatible login session Two sessions are incompatible if they don't share the same @@ -142,7 +142,7 @@ index 9c10adff3..051420ac8 100644 From 239aefa42bcba99fa7eac12b98b4dd7f64ef9608 Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Thu, 8 May 2025 11:50:26 +0200 -Subject: [PATCH 2/3] session: Stop conflicting session +Subject: [PATCH 2/4] session: Stop conflicting session This happens when at the login gnome-shell it's been displayed the dialog requesting to logout the existing session. When the user chose to stop @@ -376,7 +376,7 @@ index 137be5e27..e5a1e4bb3 100644 From b70145ecaabe57e947bfb703bbd5d2e7b953609d Mon Sep 17 00:00:00 2001 From: Joan Torres Date: Thu, 8 May 2025 11:52:40 +0200 -Subject: [PATCH 3/3] session: On greeter add SessionOpenedWithSessionId signal +Subject: [PATCH 3/4] session: On greeter add SessionOpenedWithSessionId signal This session_id will be used by the gnome-shell at login session when searching if there's already a user session opened, ignoring this one which is @@ -420,3 +420,110 @@ index f22e37c8c..9ba2fb213 100644 -- 2.49.0 +From c2d9ef68043a0a045b91a164071a7296d6db9017 Mon Sep 17 00:00:00 2001 +From: Joan Torres +Date: Fri, 6 Mar 2026 16:40:01 +0100 +Subject: [PATCH 4/4] manager: Pass opened session ID to stop-conflicting-session + signal + +Track the session ID when a session is opened and pass it to the +stop-conflicting-session signal handler. This allows properly +identifying and terminating conflicting sessions, including remote +sessions started outside of GDM. + +Previously, sessions were only terminated if they were tracked in the +display store, which missed remote sessions not managed by GDM. +--- + daemon/gdm-manager.c | 8 ++------ + daemon/gdm-session.c | 14 ++++++++++++-- + 2 files changed, 14 insertions(+), 8 deletions(-) + +diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c +index b904f93..6eb581d 100644 +--- a/daemon/gdm-manager.c ++++ b/daemon/gdm-manager.c +@@ -2175,6 +2175,7 @@ on_session_reauthenticated (GdmSession *session, + static void + on_stop_conflicting_session (GdmSession *login_session, + const char *username, ++ const char *opened_session_id, + GdmManager *manager) + { + g_auto (GStrv) session_ids = NULL; +@@ -2190,12 +2191,7 @@ on_stop_conflicting_session (GdmSession *login_session, + } + + for (i = 0; i < g_strv_length (session_ids); i++) { +- // Don't kill conflicting session if it's not tracked, +- // this ensures the new session isn't killed (because +- // it's considered a conflicting session). +- if (!gdm_display_store_find (manager->priv->display_store, +- lookup_by_session_id, +- (gpointer) session_ids[i])) ++ if (g_strcmp0 (opened_session_id, session_ids[i]) == 0) + continue; + + if (!gdm_terminate_session_by_id (manager->priv->connection, NULL, session_ids[i])) +diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c +index 5e57a38..9a332d7 100644 +--- a/daemon/gdm-session.c ++++ b/daemon/gdm-session.c +@@ -138,6 +138,8 @@ struct _GdmSession + guint32 is_program_session : 1; + guint32 display_is_initial : 1; + guint32 is_opened : 1; ++ ++ char *session_opened; + }; + + enum { +@@ -895,6 +897,9 @@ on_opened (GdmDBusWorker *worker, + + conversation->session_id = g_strdup (session_id); + ++ g_clear_pointer (&self->session_opened, g_free); ++ self->session_opened = g_strdup (session_id); ++ + if (self->user_verifier_interface != NULL) { + gdm_dbus_user_verifier_emit_verification_complete (self->user_verifier_interface, + service_name); +@@ -1607,7 +1612,7 @@ gdm_session_handle_client_stop_conflicting_session (GdmDBusGreeter *greet + return TRUE; + } + +- g_signal_emit (self, signals[STOP_CONFLICTING_SESSION], 0, self->selected_user); ++ g_signal_emit (self, signals[STOP_CONFLICTING_SESSION], 0, self->selected_user, self->session_opened); + + if (self->greeter_interface != NULL) { + gdm_dbus_greeter_complete_stop_conflicting_session (self->greeter_interface, +@@ -3058,6 +3063,9 @@ do_reset (GdmSession *self) + g_free (self->user_x11_authority_file); + self->user_x11_authority_file = NULL; + ++ g_free (self->session_opened); ++ self->session_opened = NULL; ++ + g_hash_table_remove_all (self->environment); + + self->session_pid = -1; +@@ -3732,6 +3740,7 @@ gdm_session_finalize (GObject *object) + g_free (self->selected_session); + g_free (self->saved_session); + g_free (self->saved_language); ++ g_free (self->session_opened); + + g_free (self->fallback_session_name); + +@@ -4006,7 +4015,8 @@ gdm_session_class_init (GdmSessionClass *session_class) + NULL, + NULL, + G_TYPE_NONE, +- 1, ++ 2, ++ G_TYPE_STRING, + G_TYPE_STRING); + + g_object_class_install_property (object_class, +-- +2.51.0 + diff --git a/gdm.spec b/gdm.spec index 9f6bd30..6e32efb 100644 --- a/gdm.spec +++ b/gdm.spec @@ -11,7 +11,7 @@ Name: gdm Epoch: 1 Version: 40.1 -Release: 41%{?dist} +Release: 42%{?dist} Summary: The GNOME Display Manager License: GPLv2+ @@ -377,6 +377,10 @@ dconf update || : %{_libdir}/pkgconfig/gdm-pam-extensions.pc %changelog +* Fri Mar 6 2026 Joan Torres Lopez - 40.1-42 +- Terminate conflicting sesions started outside of GDM + Resolves: RHEL-4108 + * Tue Nov 18 2025 Joan Torres Lopez - 40.1-41 - Fix recording wtmp/utmp/btmp Resolves: RHEL-129305