diff --git a/SOURCES/0001-Handle-conflicting-sessions.patch b/SOURCES/0001-Handle-conflicting-sessions.patch index bfebf39..7242fda 100644 --- a/SOURCES/0001-Handle-conflicting-sessions.patch +++ b/SOURCES/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/SOURCES/0001-Revert-hack-that-quits-plymouth-late.patch b/SOURCES/0001-Revert-hack-that-quits-plymouth-late.patch new file mode 100644 index 0000000..164d8d0 --- /dev/null +++ b/SOURCES/0001-Revert-hack-that-quits-plymouth-late.patch @@ -0,0 +1,367 @@ +From 8a91856f4020657adcbba67482daa6db373e8ed6 Mon Sep 17 00:00:00 2001 +From: Adrian Vovk +Date: Thu, 1 May 2025 15:42:49 -0400 +Subject: [PATCH 1/2] Revert hack that quits plymouth late + +Reverts 2cbd7ad1f66d0a757c1d2217705436aa1beca76a + +Fixes #375 + +Part-of: +--- + daemon/gdm-manager.c | 27 ++++++++------------------- + 1 file changed, 8 insertions(+), 19 deletions(-) + +diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c +index b904f93..e04791b 100644 +--- a/daemon/gdm-manager.c ++++ b/daemon/gdm-manager.c +@@ -175,7 +175,7 @@ plymouth_prepare_for_transition (void) + } + } + +-static gboolean ++static void + plymouth_quit_with_transition (void) + { + gboolean res; +@@ -187,8 +187,6 @@ plymouth_quit_with_transition (void) + g_warning ("Could not quit plymouth: %s", error->message); + g_error_free (error); + } +- +- return G_SOURCE_REMOVE; + } + + static void +@@ -1641,6 +1639,13 @@ on_display_status_changed (GdmDisplay *display, + set_up_session (manager, display); + g_free (session_class); + } ++ ++#ifdef WITH_PLYMOUTH ++ if (status == GDM_DISPLAY_MANAGED && quit_plymouth) { ++ plymouth_quit_with_transition (); ++ manager->priv->plymouth_is_running = FALSE; ++ } ++#endif + break; + + case GDM_DISPLAY_FAILING: +@@ -2060,15 +2065,6 @@ on_user_session_started (GdmSession *session, + { + g_debug ("GdmManager: session started %d", pid); + add_session_record (manager, session, pid, SESSION_RECORD_LOGIN); +- +-#ifdef WITH_PLYMOUTH +- if (g_strcmp0 (service_name, "gdm-autologin") == 0) { +- if (manager->priv->plymouth_is_running) { +- g_timeout_add_seconds (20, (GSourceFunc) plymouth_quit_with_transition, NULL); +- manager->priv->plymouth_is_running = FALSE; +- } +- } +-#endif + } + + static void +@@ -2261,13 +2257,6 @@ on_session_client_connected (GdmSession *session, + return; + } + +-#ifdef WITH_PLYMOUTH +- if (manager->priv->plymouth_is_running) { +- plymouth_quit_with_transition (); +- manager->priv->plymouth_is_running = FALSE; +- } +-#endif +- + g_object_get (G_OBJECT (display), "allow-timed-login", &allow_timed_login, NULL); + + if (!allow_timed_login) { +-- +2.51.0 + +From deeb4b8aba46e37a1f6dcb85252ed713183cb170 Mon Sep 17 00:00:00 2001 +From: Adrian Vovk +Date: Thu, 1 May 2025 16:13:53 -0400 +Subject: [PATCH 2/2] manager: Combine register display with register session + +Before we'd always register the display as soon as the session was +started. However, this is too early for Wayland! The compositor might +not have completely initialized its Wayland connection yet, so the +display isn't really open. + +The "register display" should happen when the compositor is up and +running. This occurs when it calls RegisterSession, so it makes sense +to combine both. + +This helps on terminating plymouthd when the new session has been +started, and also kill background greeters. + +Part-of: +--- + daemon/gdm-local-display-factory.c | 33 ++++----------------- + daemon/gdm-manager.c | 47 ++++++------------------------ + daemon/gdm-manager.xml | 3 -- + daemon/gdm-wayland-session.c | 31 -------------------- + daemon/gdm-x-session.c | 32 -------------------- + 5 files changed, 15 insertions(+), 131 deletions(-) + +diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c +index 51f6f34..ef2ff7c 100644 +--- a/daemon/gdm-local-display-factory.c ++++ b/daemon/gdm-local-display-factory.c +@@ -506,25 +506,6 @@ on_finish_waiting_for_seat0_displays_timeout (GdmLocalDisplayFactory *factory) + return G_SOURCE_REMOVE; + } + +-static void +-on_session_registered_cb (GObject *gobject, +- GParamSpec *pspec, +- gpointer user_data) +-{ +- GdmDisplay *display = GDM_DISPLAY (gobject); +- GdmLocalDisplayFactory *factory = GDM_LOCAL_DISPLAY_FACTORY (user_data); +- gboolean registered; +- +- g_object_get (display, "session-registered", ®istered, NULL); +- +- if (!registered) +- return; +- +- g_debug ("GdmLocalDisplayFactory: session registered on display, looking for any background displays to kill"); +- +- finish_waiting_displays_on_seat (factory, "seat0"); +-} +- + static void + on_display_status_changed (GdmDisplay *display, + GParamSpec *arg1, +@@ -537,6 +518,7 @@ on_display_status_changed (GdmDisplay *display, + char *session_class = NULL; + gboolean is_initial = TRUE; + gboolean is_local = TRUE; ++ gboolean registered = FALSE; + + + if (!factory->is_started) +@@ -602,14 +584,11 @@ on_display_status_changed (GdmDisplay *display, + break; + case GDM_DISPLAY_MANAGED: + #if defined(ENABLE_USER_DISPLAY_SERVER) +- g_signal_handlers_disconnect_by_func (display, +- G_CALLBACK (on_session_registered_cb), +- factory); +- g_signal_connect_object (display, +- "notify::session-registered", +- G_CALLBACK (on_session_registered_cb), +- factory, +- 0); ++ g_object_get (display, "session-registered", ®istered, NULL); ++ if (registered) { ++ g_debug ("GdmLocalDisplayFactory: session registered on display, looking for any background displays to kill"); ++ finish_waiting_displays_on_seat (factory, "seat0"); ++ } + #endif + break; + case GDM_DISPLAY_WAITING_TO_FINISH: +diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c +index 3c60c82..dce431e 100644 +--- a/daemon/gdm-manager.c ++++ b/daemon/gdm-manager.c +@@ -747,7 +747,7 @@ find_user_session_for_display (GdmManager *self, + } + + static gboolean +-gdm_manager_handle_register_display (GdmDBusManager *manager, ++gdm_manager_handle_register_session (GdmDBusManager *manager, + GDBusMethodInvocation *invocation, + GVariant *details) + { +@@ -759,15 +759,15 @@ gdm_manager_handle_register_display (GdmDBusManager *manager, + GVariantIter iter; + char *key = NULL; + char *value = NULL; +- char *x11_display_name = NULL; +- char *tty = NULL; +- +- g_debug ("GdmManager: trying to register new display"); ++ g_autofree char *x11_display_name = NULL; ++ g_autofree char *tty = NULL; + + sender = g_dbus_method_invocation_get_sender (invocation); + connection = g_dbus_method_invocation_get_connection (invocation); + get_display_and_details_for_bus_sender (self, connection, sender, &display, NULL, NULL, &tty, NULL, NULL, NULL, NULL); + ++ g_debug ("GdmManager: trying to register new session on display %p", display); ++ + if (display == NULL) { + g_dbus_method_invocation_return_error_literal (invocation, + G_DBUS_ERROR, +@@ -807,38 +807,10 @@ gdm_manager_handle_register_display (GdmDBusManager *manager, + } + } + +- g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL); +- +- gdm_dbus_manager_complete_register_display (GDM_DBUS_MANAGER (manager), +- invocation); +- +- g_clear_pointer (&x11_display_name, g_free); +- g_clear_pointer (&tty, g_free); +- return TRUE; +-} +- +-static gboolean +-gdm_manager_handle_register_session (GdmDBusManager *manager, +- GDBusMethodInvocation *invocation, +- GVariant *details) +-{ +- GdmManager *self = GDM_MANAGER (manager); +- GdmDisplay *display = NULL; +- const char *sender; +- GDBusConnection *connection; +- +- sender = g_dbus_method_invocation_get_sender (invocation); +- connection = g_dbus_method_invocation_get_connection (invocation); +- +- get_display_and_details_for_bus_sender (self, connection, sender, &display, +- NULL, NULL, NULL, NULL, NULL, NULL, NULL); +- +- g_debug ("GdmManager: trying to register new session on display %p", display); +- +- if (display != NULL) +- g_object_set (G_OBJECT (display), "session-registered", TRUE, NULL); +- else +- g_debug ("GdmManager: No display, not registering"); ++ g_object_set (G_OBJECT (display), ++ "status", GDM_DISPLAY_MANAGED, ++ "session-registered", TRUE, ++ NULL); + + gdm_dbus_manager_complete_register_session (GDM_DBUS_MANAGER (manager), + invocation); +@@ -1292,7 +1264,6 @@ gdm_manager_handle_open_reauthentication_channel (GdmDBusManager *manager + static void + manager_interface_init (GdmDBusManagerIface *interface) + { +- interface->handle_register_display = gdm_manager_handle_register_display; + interface->handle_register_session = gdm_manager_handle_register_session; + interface->handle_open_session = gdm_manager_handle_open_session; + interface->handle_open_reauthentication_channel = gdm_manager_handle_open_reauthentication_channel; +diff --git a/daemon/gdm-manager.xml b/daemon/gdm-manager.xml +index 92ef1d0..aba079a 100644 +--- a/daemon/gdm-manager.xml ++++ b/daemon/gdm-manager.xml +@@ -1,9 +1,6 @@ + + + +- +- +- + + + +diff --git a/daemon/gdm-wayland-session.c b/daemon/gdm-wayland-session.c +index d0404d2..d4d1edd 100644 +--- a/daemon/gdm-wayland-session.c ++++ b/daemon/gdm-wayland-session.c +@@ -404,29 +404,6 @@ wait_on_subprocesses (State *state) + } + } + +-static gboolean +-register_display (State *state, +- GCancellable *cancellable) +-{ +- GError *error = NULL; +- gboolean registered = FALSE; +- GVariantBuilder details; +- +- g_variant_builder_init (&details, G_VARIANT_TYPE ("a{ss}")); +- g_variant_builder_add (&details, "{ss}", "session-type", "wayland"); +- +- registered = gdm_dbus_manager_call_register_display_sync (state->display_manager_proxy, +- g_variant_builder_end (&details), +- cancellable, +- &error); +- if (error != NULL) { +- g_debug ("Could not register display: %s", error->message); +- g_error_free (error); +- } +- +- return registered; +-} +- + static void + init_state (State **state) + { +@@ -584,14 +561,6 @@ main (int argc, + if (!connect_to_display_manager (state)) + goto out; + +- ret = register_display (state, state->cancellable); +- +- if (!ret) { +- g_printerr ("Unable to register display with display manager\n"); +- exit_status = EX_SOFTWARE; +- goto out; +- } +- + if (register_session) { + g_debug ("gdm-wayland-session: Will register session in %d seconds", REGISTER_SESSION_TIMEOUT); + state->register_session_id = g_timeout_add_seconds (REGISTER_SESSION_TIMEOUT, +diff --git a/daemon/gdm-x-session.c b/daemon/gdm-x-session.c +index 0b07ab5..36b3975 100644 +--- a/daemon/gdm-x-session.c ++++ b/daemon/gdm-x-session.c +@@ -757,30 +757,6 @@ wait_on_subprocesses (State *state) + } + } + +-static gboolean +-register_display (State *state, +- GCancellable *cancellable) +-{ +- GError *error = NULL; +- gboolean registered = FALSE; +- GVariantBuilder details; +- +- g_variant_builder_init (&details, G_VARIANT_TYPE ("a{ss}")); +- g_variant_builder_add (&details, "{ss}", "session-type", "x11"); +- g_variant_builder_add (&details, "{ss}", "x11-display-name", state->display_name); +- +- registered = gdm_dbus_manager_call_register_display_sync (state->display_manager_proxy, +- g_variant_builder_end (&details), +- cancellable, +- &error); +- if (error != NULL) { +- g_debug ("Could not register display: %s", error->message); +- g_error_free (error); +- } +- +- return registered; +-} +- + static void + init_state (State **state) + { +@@ -953,14 +929,6 @@ main (int argc, + if (!connect_to_display_manager (state)) + goto out; + +- ret = register_display (state, state->cancellable); +- +- if (!ret) { +- g_printerr ("Unable to register display with display manager\n"); +- exit_status = EX_SOFTWARE; +- goto out; +- } +- + ret = spawn_session (state, run_script, state->cancellable); + + if (!ret) { +-- +2.51.0 + diff --git a/SOURCES/0001-libgdm-Don-t-collect-twice-sessions-on-usr-share.patch b/SOURCES/0001-libgdm-Don-t-collect-twice-sessions-on-usr-share.patch index fe19d32..d77a2c9 100644 --- a/SOURCES/0001-libgdm-Don-t-collect-twice-sessions-on-usr-share.patch +++ b/SOURCES/0001-libgdm-Don-t-collect-twice-sessions-on-usr-share.patch @@ -26,7 +26,7 @@ index 134b9bc..ab2a87f 100644 <etc>/dm/ unless GDM is configured to use a different directory via the "--with-dmconfdir" option. diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c -index f078e04..e4a0e6b 100644 +index d8b4d5c..13067ec 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c @@ -275,7 +275,6 @@ collect_sessions (void) @@ -35,9 +35,9 @@ index f078e04..e4a0e6b 100644 DATADIR "/gdm/BuiltInSessions/", - DATADIR "/xsessions/", }; + const gchar *supported_session_types_env = NULL; g_auto (GStrv) supported_session_types = NULL; - -@@ -296,20 +295,12 @@ collect_sessions (void) +@@ -300,20 +299,12 @@ collect_sessions (void) } #ifdef ENABLE_WAYLAND_SUPPORT @@ -58,9 +58,6 @@ index f078e04..e4a0e6b 100644 #endif if (gdm_available_sessions_map == NULL) { --- -2.50.1 - From ac9d403b5b27cbd8396a696223cd96fbac56f142 Mon Sep 17 00:00:00 2001 From: Joan Torres Lopez Date: Mon, 9 Jun 2025 17:11:01 +0200 @@ -84,7 +81,7 @@ before sessions in /etc/. 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c -index e4a0e6b..e0d0044 100644 +index 13067ec..4c3f607 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c @@ -267,8 +267,7 @@ static void @@ -97,8 +94,8 @@ index e4a0e6b..e0d0044 100644 gchar *session_dir = NULL; int i; const char *xorg_search_dirs[] = { -@@ -281,26 +280,30 @@ collect_sessions (void) - supported_session_types = g_strsplit (g_getenv ("GDM_SUPPORTED_SESSION_TYPES"), ":", -1); +@@ -285,26 +284,30 @@ collect_sessions (void) + } names_seen_before = g_hash_table_new (g_str_hash, g_str_equal); - xorg_search_array = g_ptr_array_new_with_free_func (g_free); @@ -140,7 +137,7 @@ index e4a0e6b..e0d0044 100644 #endif if (gdm_available_sessions_map == NULL) { -@@ -308,22 +311,10 @@ collect_sessions (void) +@@ -312,22 +315,10 @@ collect_sessions (void) g_free, (GDestroyNotify)gdm_session_file_free); } diff --git a/SOURCES/0001-local-display-factory-Provide-more-flexibility-for-c.patch b/SOURCES/0001-local-display-factory-Provide-more-flexibility-for-c.patch index e72eab6..2cf9176 100644 --- a/SOURCES/0001-local-display-factory-Provide-more-flexibility-for-c.patch +++ b/SOURCES/0001-local-display-factory-Provide-more-flexibility-for-c.patch @@ -28,41 +28,14 @@ fall back to "wayland". daemon/gdm-manager.c | 22 ++- daemon/gdm-session.c | 115 ++++++++------- data/gdm.schemas.in | 10 ++ - libgdm/gdm-sessions.c | 72 +++++++--- - 8 files changed, 366 insertions(+), 124 deletions(-) + libgdm/gdm-sessions.c | 76 +++++++--- + 8 files changed, 370 insertions(+), 124 deletions(-) diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h -index f0059b5cf..87685d3cd 100644 +index f0059b5..87685d3 100644 --- a/common/gdm-settings-keys.h +++ b/common/gdm-settings-keys.h -@@ -6,59 +6,61 @@ - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - */ - - #ifndef _GDM_SETTINGS_KEYS_H - #define _GDM_SETTINGS_KEYS_H - - #include - - G_BEGIN_DECLS - - #define GDM_KEY_USER "daemon/User" - #define GDM_KEY_GROUP "daemon/Group" - #define GDM_KEY_AUTO_LOGIN_ENABLE "daemon/AutomaticLoginEnable" - #define GDM_KEY_AUTO_LOGIN_USER "daemon/AutomaticLogin" - #define GDM_KEY_TIMED_LOGIN_ENABLE "daemon/TimedLoginEnable" +@@ -33,7 +33,9 @@ G_BEGIN_DECLS #define GDM_KEY_TIMED_LOGIN_USER "daemon/TimedLogin" #define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay" #define GDM_KEY_INITIAL_SETUP_ENABLE "daemon/InitialSetupEnable" @@ -72,63 +45,11 @@ index f0059b5cf..87685d3cd 100644 #define GDM_KEY_DEBUG "debug/Enable" - #define GDM_KEY_INCLUDE "greeter/Include" - #define GDM_KEY_EXCLUDE "greeter/Exclude" - #define GDM_KEY_INCLUDE_ALL "greeter/IncludeAll" - - #define GDM_KEY_DISALLOW_TCP "security/DisallowTCP" - #define GDM_KEY_ALLOW_REMOTE_AUTOLOGIN "security/AllowRemoteAutoLogin" - - #define GDM_KEY_XDMCP_ENABLE "xdmcp/Enable" - #define GDM_KEY_SHOW_LOCAL_GREETER "xdmcp/ShowLocalGreeter" - #define GDM_KEY_MAX_PENDING "xdmcp/MaxPending" - #define GDM_KEY_MAX_SESSIONS "xdmcp/MaxSessions" - #define GDM_KEY_MAX_WAIT "xdmcp/MaxWait" - #define GDM_KEY_DISPLAYS_PER_HOST "xdmcp/DisplaysPerHost" - #define GDM_KEY_UDP_PORT "xdmcp/Port" - #define GDM_KEY_INDIRECT "xdmcp/HonorIndirect" - #define GDM_KEY_MAX_WAIT_INDIRECT "xdmcp/MaxWaitIndirect" - #define GDM_KEY_PING_INTERVAL "xdmcp/PingIntervalSeconds" - #define GDM_KEY_WILLING "xdmcp/Willing" - - #define GDM_KEY_MULTICAST "chooser/Multicast" - #define GDM_KEY_MULTICAST_ADDR "chooser/MulticastAddr" - - G_END_DECLS - - #endif /* _GDM_SETTINGS_KEYS_H */ diff --git a/daemon/gdm-display.c b/daemon/gdm-display.c -index 3a260923a..46d5a7732 100644 +index 3a26092..3446785 100644 --- a/daemon/gdm-display.c +++ b/daemon/gdm-display.c -@@ -66,83 +66,86 @@ typedef struct _GdmDisplayPrivate - char *x11_display_name; - int status; - time_t creation_time; - - char *x11_cookie; - gsize x11_cookie_size; - GdmDisplayAccessFile *access_file; - - guint finish_idle_id; - - xcb_connection_t *xcb_connection; - int xcb_screen_number; - - GDBusConnection *connection; - GdmDisplayAccessFile *user_access_file; - - GdmDBusDisplay *display_skeleton; - GDBusObjectSkeleton *object_skeleton; - - GDBusProxy *accountsservice_proxy; - - /* this spawns and controls the greeter session */ - GdmLaunchEnvironment *launch_environment; - - guint is_local : 1; - guint is_initial : 1; - guint allow_timed_login : 1; +@@ -93,6 +93,8 @@ typedef struct _GdmDisplayPrivate guint have_existing_user_accounts : 1; guint doing_initial_setup : 1; guint session_registered : 1; @@ -137,23 +58,7 @@ index 3a260923a..46d5a7732 100644 } GdmDisplayPrivate; enum { - PROP_0, - PROP_ID, - PROP_STATUS, - PROP_SEAT_ID, - PROP_SESSION_ID, - PROP_SESSION_CLASS, - PROP_SESSION_TYPE, - PROP_REMOTE_HOSTNAME, - PROP_X11_DISPLAY_NUMBER, - PROP_X11_DISPLAY_NAME, - PROP_X11_COOKIE, - PROP_X11_AUTHORITY_FILE, - PROP_IS_CONNECTED, - PROP_IS_LOCAL, - PROP_LAUNCH_ENVIRONMENT, - PROP_IS_INITIAL, - PROP_ALLOW_TIMED_LOGIN, +@@ -116,6 +118,7 @@ enum { PROP_HAVE_EXISTING_USER_ACCOUNTS, PROP_DOING_INITIAL_SETUP, PROP_SESSION_REGISTERED, @@ -161,61 +66,7 @@ index 3a260923a..46d5a7732 100644 }; static void gdm_display_class_init (GdmDisplayClass *klass); - static void gdm_display_init (GdmDisplay *self); - static void gdm_display_finalize (GObject *object); - static void queue_finish (GdmDisplay *self); - static void _gdm_display_set_status (GdmDisplay *self, - int status); - static gboolean wants_initial_setup (GdmDisplay *self); - G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdmDisplay, gdm_display, G_TYPE_OBJECT) - - GQuark - gdm_display_error_quark (void) - { - static GQuark ret = 0; - if (ret == 0) { - ret = g_quark_from_static_string ("gdm_display_error"); - } - - return ret; - } - - time_t - gdm_display_get_creation_time (GdmDisplay *self) - { - GdmDisplayPrivate *priv; - - g_return_val_if_fail (GDM_IS_DISPLAY (self), 0); - - priv = gdm_display_get_instance_private (self); -@@ -883,116 +886,136 @@ _gdm_display_set_launch_environment (GdmDisplay *self, - - priv = gdm_display_get_instance_private (self); - - g_clear_object (&priv->launch_environment); - - priv->launch_environment = g_object_ref (launch_environment); - } - - static void - _gdm_display_set_is_initial (GdmDisplay *self, - gboolean initial) - { - GdmDisplayPrivate *priv; - - priv = gdm_display_get_instance_private (self); - g_debug ("GdmDisplay: initial: %s", initial? "yes" : "no"); - priv->is_initial = initial; - } - - static void - _gdm_display_set_allow_timed_login (GdmDisplay *self, - gboolean allow_timed_login) - { - GdmDisplayPrivate *priv; - - priv = gdm_display_get_instance_private (self); - g_debug ("GdmDisplay: allow timed login: %s", allow_timed_login? "yes" : "no"); +@@ -910,6 +913,23 @@ _gdm_display_set_allow_timed_login (GdmDisplay *self, priv->allow_timed_login = allow_timed_login; } @@ -239,56 +90,7 @@ index 3a260923a..46d5a7732 100644 static void gdm_display_set_property (GObject *object, guint prop_id, - const GValue *value, - GParamSpec *pspec) - { - GdmDisplay *self; - - self = GDM_DISPLAY (object); - - switch (prop_id) { - case PROP_ID: - _gdm_display_set_id (self, g_value_get_string (value)); - break; - case PROP_STATUS: - _gdm_display_set_status (self, g_value_get_int (value)); - break; - case PROP_SEAT_ID: - _gdm_display_set_seat_id (self, g_value_get_string (value)); - break; - case PROP_SESSION_ID: - _gdm_display_set_session_id (self, g_value_get_string (value)); - break; - case PROP_SESSION_CLASS: - _gdm_display_set_session_class (self, g_value_get_string (value)); - break; - case PROP_SESSION_TYPE: - _gdm_display_set_session_type (self, g_value_get_string (value)); - break; - case PROP_REMOTE_HOSTNAME: - _gdm_display_set_remote_hostname (self, g_value_get_string (value)); - break; - case PROP_X11_DISPLAY_NUMBER: - _gdm_display_set_x11_display_number (self, g_value_get_int (value)); - break; - case PROP_X11_DISPLAY_NAME: - _gdm_display_set_x11_display_name (self, g_value_get_string (value)); - break; - case PROP_X11_COOKIE: - _gdm_display_set_x11_cookie (self, g_value_get_string (value)); - break; - case PROP_IS_LOCAL: - _gdm_display_set_is_local (self, g_value_get_boolean (value)); - break; - case PROP_ALLOW_TIMED_LOGIN: - _gdm_display_set_allow_timed_login (self, g_value_get_boolean (value)); - break; - case PROP_LAUNCH_ENVIRONMENT: - _gdm_display_set_launch_environment (self, g_value_get_object (value)); - break; - case PROP_IS_INITIAL: - _gdm_display_set_is_initial (self, g_value_get_boolean (value)); - break; +@@ -966,6 +986,9 @@ gdm_display_set_property (GObject *object, case PROP_SESSION_REGISTERED: _gdm_display_set_session_registered (self, g_value_get_boolean (value)); break; @@ -298,61 +100,7 @@ index 3a260923a..46d5a7732 100644 default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; - } - } - - static void - gdm_display_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) - { - GdmDisplay *self; - GdmDisplayPrivate *priv; - - self = GDM_DISPLAY (object); - priv = gdm_display_get_instance_private (self); - - switch (prop_id) { - case PROP_ID: - g_value_set_string (value, priv->id); - break; - case PROP_STATUS: - g_value_set_int (value, priv->status); - break; - case PROP_SEAT_ID: - g_value_set_string (value, priv->seat_id); - break; - case PROP_SESSION_ID: - g_value_set_string (value, priv->session_id); -@@ -1017,60 +1040,63 @@ gdm_display_get_property (GObject *object, - break; - case PROP_X11_AUTHORITY_FILE: - g_value_take_string (value, - priv->access_file? - gdm_display_access_file_get_path (priv->access_file) : NULL); - break; - case PROP_IS_LOCAL: - g_value_set_boolean (value, priv->is_local); - break; - case PROP_IS_CONNECTED: - g_value_set_boolean (value, priv->xcb_connection != NULL); - break; - case PROP_LAUNCH_ENVIRONMENT: - g_value_set_object (value, priv->launch_environment); - break; - case PROP_IS_INITIAL: - g_value_set_boolean (value, priv->is_initial); - break; - case PROP_HAVE_EXISTING_USER_ACCOUNTS: - g_value_set_boolean (value, priv->have_existing_user_accounts); - break; - case PROP_DOING_INITIAL_SETUP: - g_value_set_boolean (value, priv->doing_initial_setup); - break; - case PROP_SESSION_REGISTERED: - g_value_set_boolean (value, priv->session_registered); - break; +@@ -1044,6 +1067,9 @@ gdm_display_get_property (GObject *object, case PROP_ALLOW_TIMED_LOGIN: g_value_set_boolean (value, priv->allow_timed_login); break; @@ -362,61 +110,7 @@ index 3a260923a..46d5a7732 100644 default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; - } - } - - static gboolean - handle_get_id (GdmDBusDisplay *skeleton, - GDBusMethodInvocation *invocation, - GdmDisplay *self) - { - char *id; - - gdm_display_get_id (self, &id, NULL); - - gdm_dbus_display_complete_get_id (skeleton, invocation, id); - - g_free (id); - return TRUE; - } - - static gboolean - handle_get_remote_hostname (GdmDBusDisplay *skeleton, - GDBusMethodInvocation *invocation, - GdmDisplay *self) - { - char *hostname; - - gdm_display_get_remote_hostname (self, &hostname, NULL); - -@@ -1202,60 +1228,61 @@ gdm_display_constructor (GType type, - priv = gdm_display_get_instance_private (self); - - g_free (priv->id); - priv->id = g_strdup_printf ("/org/gnome/DisplayManager/Displays/%lu", - (gulong) self); - - res = register_display (self); - if (! res) { - g_warning ("Unable to register display with system bus"); - } - - return G_OBJECT (self); - } - - static void - gdm_display_dispose (GObject *object) - { - GdmDisplay *self; - GdmDisplayPrivate *priv; - - self = GDM_DISPLAY (object); - priv = gdm_display_get_instance_private (self); - - g_debug ("GdmDisplay: Disposing display"); - - if (priv->finish_idle_id != 0) { - g_source_remove (priv->finish_idle_id); +@@ -1229,6 +1255,7 @@ gdm_display_dispose (GObject *object) priv->finish_idle_id = 0; } g_clear_object (&priv->launch_environment); @@ -424,61 +118,7 @@ index 3a260923a..46d5a7732 100644 g_warn_if_fail (priv->status != GDM_DISPLAY_MANAGED); g_warn_if_fail (priv->user_access_file == NULL); - g_warn_if_fail (priv->access_file == NULL); - - G_OBJECT_CLASS (gdm_display_parent_class)->dispose (object); - } - - static void - gdm_display_class_init (GdmDisplayClass *klass) - { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->get_property = gdm_display_get_property; - object_class->set_property = gdm_display_set_property; - object_class->constructor = gdm_display_constructor; - object_class->dispose = gdm_display_dispose; - object_class->finalize = gdm_display_finalize; - - klass->prepare = gdm_display_real_prepare; - - g_object_class_install_property (object_class, - PROP_ID, - g_param_spec_string ("id", - "id", - "id", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, - PROP_REMOTE_HOSTNAME, -@@ -1362,60 +1389,68 @@ gdm_display_class_init (GdmDisplayClass *klass) - PROP_DOING_INITIAL_SETUP, - g_param_spec_boolean ("doing-initial-setup", - NULL, - NULL, - FALSE, - G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, - PROP_SESSION_REGISTERED, - g_param_spec_boolean ("session-registered", - NULL, - NULL, - FALSE, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, - PROP_LAUNCH_ENVIRONMENT, - g_param_spec_object ("launch-environment", - NULL, - NULL, - GDM_TYPE_LAUNCH_ENVIRONMENT, - G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, - PROP_STATUS, - g_param_spec_int ("status", - "status", - "status", - -1, +@@ -1389,6 +1416,14 @@ gdm_display_class_init (GdmDisplayClass *klass) G_MAXINT, GDM_DISPLAY_UNMANAGED, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); @@ -493,61 +133,7 @@ index 3a260923a..46d5a7732 100644 } static void - gdm_display_init (GdmDisplay *self) - { - GdmDisplayPrivate *priv; - - priv = gdm_display_get_instance_private (self); - - priv->creation_time = time (NULL); - } - - static void - gdm_display_finalize (GObject *object) - { - GdmDisplay *self; - GdmDisplayPrivate *priv; - - g_return_if_fail (object != NULL); - g_return_if_fail (GDM_IS_DISPLAY (object)); - - self = GDM_DISPLAY (object); - priv = gdm_display_get_instance_private (self); - - g_return_if_fail (priv != NULL); - - g_debug ("GdmDisplay: Finalizing display: %s", priv->id); - g_free (priv->id); - g_free (priv->seat_id); - g_free (priv->session_class); -@@ -1694,60 +1729,61 @@ gdm_display_start_greeter_session (GdmDisplay *self) - G_CALLBACK (on_launch_environment_session_opened), - self, 0); - g_signal_connect_object (priv->launch_environment, - "started", - G_CALLBACK (on_launch_environment_session_started), - self, 0); - g_signal_connect_object (priv->launch_environment, - "stopped", - G_CALLBACK (on_launch_environment_session_stopped), - self, 0); - g_signal_connect_object (priv->launch_environment, - "exited", - G_CALLBACK (on_launch_environment_session_exited), - self, 0); - g_signal_connect_object (priv->launch_environment, - "died", - G_CALLBACK (on_launch_environment_session_died), - self, 0); - - if (auth_file != NULL) { - g_object_set (priv->launch_environment, - "x11-authority-file", auth_file, - NULL); - } - - gdm_launch_environment_start (priv->launch_environment); - +@@ -1721,6 +1756,7 @@ gdm_display_start_greeter_session (GdmDisplay *self) session = gdm_launch_environment_get_session (priv->launch_environment); g_object_set (G_OBJECT (session), "display-is-initial", priv->is_initial, @@ -555,65 +141,11 @@ index 3a260923a..46d5a7732 100644 NULL); g_free (display_name); - g_free (seat_id); - g_free (hostname); - g_free (auth_file); - } - - void - gdm_display_stop_greeter_session (GdmDisplay *self) - { - GdmDisplayPrivate *priv; - - priv = gdm_display_get_instance_private (self); - - if (priv->launch_environment != NULL) { - - g_signal_handlers_disconnect_by_func (priv->launch_environment, - G_CALLBACK (on_launch_environment_session_opened), - self); - g_signal_handlers_disconnect_by_func (priv->launch_environment, - G_CALLBACK (on_launch_environment_session_started), - self); - g_signal_handlers_disconnect_by_func (priv->launch_environment, - G_CALLBACK (on_launch_environment_session_stopped), - self); - g_signal_handlers_disconnect_by_func (priv->launch_environment, - G_CALLBACK (on_launch_environment_session_exited), - self); - g_signal_handlers_disconnect_by_func (priv->launch_environment, diff --git a/daemon/gdm-launch-environment.c b/daemon/gdm-launch-environment.c -index 87a1c5ffe..14ecfac2d 100644 +index 87a1c5f..14ecfac 100644 --- a/daemon/gdm-launch-environment.c +++ b/daemon/gdm-launch-environment.c -@@ -134,60 +134,61 @@ static GHashTable * - build_launch_environment (GdmLaunchEnvironment *launch_environment, - gboolean start_session) - { - GHashTable *hash; - struct passwd *pwent; - static const char *const optional_environment[] = { - "GI_TYPELIB_PATH", - "LANG", - "LANGUAGE", - "LC_ADDRESS", - "LC_ALL", - "LC_COLLATE", - "LC_CTYPE", - "LC_IDENTIFICATION", - "LC_MEASUREMENT", - "LC_MESSAGES", - "LC_MONETARY", - "LC_NAME", - "LC_NUMERIC", - "LC_PAPER", - "LC_TELEPHONE", - "LC_TIME", - "LD_LIBRARY_PATH", - "PATH", - "WINDOWPATH", - "XCURSOR_PATH", - "XDG_CONFIG_DIRS", +@@ -161,6 +161,7 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment, NULL }; char *system_data_dirs; @@ -621,61 +153,7 @@ index 87a1c5ffe..14ecfac2d 100644 int i; /* create a hash table of current environment, then update keys has necessary */ - hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - - for (i = 0; optional_environment[i] != NULL; i++) { - if (g_getenv (optional_environment[i]) == NULL) { - continue; - } - - g_hash_table_insert (hash, - g_strdup (optional_environment[i]), - g_strdup (g_getenv (optional_environment[i]))); - } - - if (launch_environment->priv->x11_authority_file != NULL) - g_hash_table_insert (hash, g_strdup ("XAUTHORITY"), g_strdup (launch_environment->priv->x11_authority_file)); - - if (launch_environment->priv->session_mode != NULL) { - g_hash_table_insert (hash, g_strdup ("GNOME_SHELL_SESSION_MODE"), g_strdup (launch_environment->priv->session_mode)); - - if (strcmp (launch_environment->priv->session_mode, INITIAL_SETUP_SESSION_MODE) != 0) { - /* gvfs is needed for fetching remote avatars in the initial setup. Disable it otherwise. */ - g_hash_table_insert (hash, g_strdup ("GVFS_DISABLE_FUSE"), g_strdup ("1")); - g_hash_table_insert (hash, g_strdup ("GIO_USE_VFS"), g_strdup ("local")); - g_hash_table_insert (hash, g_strdup ("GVFS_REMOTE_VOLUME_MONITOR_IGNORE"), g_strdup ("1")); - - /* The locked down dconf profile should not be used for the initial setup session. - * This allows overridden values from the user profile to take effect. - */ -@@ -217,60 +218,68 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment, - } - - if (start_session && launch_environment->priv->x11_display_seat_id != NULL) { - char *seat_id; - - seat_id = launch_environment->priv->x11_display_seat_id; - - g_hash_table_insert (hash, g_strdup ("GDM_SEAT_ID"), g_strdup (seat_id)); - } - - g_hash_table_insert (hash, g_strdup ("RUNNING_UNDER_GDM"), g_strdup ("true")); - - /* Now populate XDG_DATA_DIRS from env.d if we're running initial setup; this allows - * e.g. Flatpak apps to be recognized by gnome-shell. - */ - if (g_strcmp0 (launch_environment->priv->session_mode, INITIAL_SETUP_SESSION_MODE) == 0) - gdm_load_env_d (load_env_func, get_var_cb, hash); - - /* Prepend our own XDG_DATA_DIRS value */ - system_data_dirs = g_strdup (g_hash_table_lookup (hash, "XDG_DATA_DIRS")); - if (!system_data_dirs) - system_data_dirs = g_strjoinv (":", (char **) g_get_system_data_dirs ()); - - g_hash_table_insert (hash, - g_strdup ("XDG_DATA_DIRS"), - g_strdup_printf ("%s:%s", - DATADIR "/gdm/greeter", +@@ -244,6 +245,14 @@ build_launch_environment (GdmLaunchEnvironment *launch_environment, system_data_dirs)); g_free (system_data_dirs); @@ -690,65 +168,11 @@ index 87a1c5ffe..14ecfac2d 100644 return hash; } - static void - on_session_setup_complete (GdmSession *session, - const char *service_name, - GdmLaunchEnvironment *launch_environment) - { - GHashTable *hash; - GHashTableIter iter; - gpointer key, value; - - hash = build_launch_environment (launch_environment, TRUE); - - g_hash_table_iter_init (&iter, hash); - while (g_hash_table_iter_next (&iter, &key, &value)) { - gdm_session_set_environment_variable (launch_environment->priv->session, key, value); - } - g_hash_table_destroy (hash); - } - - static void - on_session_opened (GdmSession *session, - const char *service_name, - const char *session_id, - GdmLaunchEnvironment *launch_environment) - { - launch_environment->priv->session_id = g_strdup (session_id); - - g_signal_emit (G_OBJECT (launch_environment), signals [OPENED], 0); diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c -index 8a4ef06cd..141d64c6b 100644 +index 8a4ef06..141d64c 100644 --- a/daemon/gdm-local-display-factory.c +++ b/daemon/gdm-local-display-factory.c -@@ -156,126 +156,225 @@ take_next_display_number (GdmLocalDisplayFactory *factory) - - g_debug ("GdmLocalDisplayFactory: Found the following X displays:"); - for (l = list; l != NULL; l = l->next) { - g_debug ("GdmLocalDisplayFactory: %u", GPOINTER_TO_UINT (l->data)); - } - - for (l = list; l != NULL; l = l->next) { - guint32 num; - num = GPOINTER_TO_UINT (l->data); - - /* always fill zero */ - if (l->prev == NULL && num != 0) { - ret = 0; - break; - } - /* now find the first hole */ - if (l->next == NULL || GPOINTER_TO_UINT (l->next->data) != (num + 1)) { - ret = num + 1; - break; - } - } - out: - - /* now reserve this number */ - g_debug ("GdmLocalDisplayFactory: Reserving X display: %u", ret); - g_hash_table_insert (factory->used_display_numbers, GUINT_TO_POINTER (ret), NULL); - +@@ -183,6 +183,93 @@ take_next_display_number (GdmLocalDisplayFactory *factory) return ret; } @@ -842,17 +266,7 @@ index 8a4ef06cd..141d64c6b 100644 static void on_display_disposed (GdmLocalDisplayFactory *factory, GdmDisplay *display) - { - g_debug ("GdmLocalDisplayFactory: Display %p disposed", display); - } - - static void - store_display (GdmLocalDisplayFactory *factory, - GdmDisplay *display) - { - GdmDisplayStore *store; - - store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); +@@ -200,19 +287,6 @@ store_display (GdmLocalDisplayFactory *factory, gdm_display_store_add (store, display); } @@ -872,15 +286,7 @@ index 8a4ef06cd..141d64c6b 100644 /* Example: dbus-send --system --dest=org.gnome.DisplayManager \ - --type=method_call --print-reply --reply-timeout=2000 \ - /org/gnome/DisplayManager/Manager \ - org.gnome.DisplayManager.Manager.GetDisplays - */ - gboolean - gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *factory, - char **id, - GError **error) - { +@@ -228,6 +302,8 @@ gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *fact gboolean ret; GdmDisplay *display = NULL; gboolean is_initial = FALSE; @@ -889,7 +295,7 @@ index 8a4ef06cd..141d64c6b 100644 g_return_val_if_fail (GDM_IS_LOCAL_DISPLAY_FACTORY (factory), FALSE); - ret = FALSE; +@@ -235,20 +311,43 @@ gdm_local_display_factory_create_transient_display (GdmLocalDisplayFactory *fact g_debug ("GdmLocalDisplayFactory: Creating transient display"); @@ -943,61 +349,7 @@ index 8a4ef06cd..141d64c6b 100644 g_object_set (display, "seat-id", "seat0", - "allow-timed-login", FALSE, - "is-initial", is_initial, - NULL); - - store_display (factory, display); - - if (! gdm_display_manage (display)) { - display = NULL; - goto out; - } - - if (! gdm_display_get_id (display, id, NULL)) { - display = NULL; - goto out; - } - - ret = TRUE; - out: - /* ref either held by store or not at all */ - g_object_unref (display); - - return ret; - } - - static void - finish_display_on_seat_if_waiting (GdmDisplayStore *display_store, - GdmDisplay *display, -@@ -454,190 +553,239 @@ lookup_prepared_display_by_seat_id (const char *id, - return lookup_by_seat_id (id, display, user_data); - } - - static int - on_seat0_graphics_check_timeout (gpointer user_data) - { - GdmLocalDisplayFactory *factory = user_data; - - factory->seat0_graphics_check_timeout_id = 0; - - /* Simply try to re-add seat0. If it is there already (i.e. CanGraphical - * turned TRUE, then we'll find it and it will not be created again). - */ - factory->seat0_graphics_check_timed_out = TRUE; - ensure_display_for_seat (factory, "seat0"); - - return G_SOURCE_REMOVE; - } - - static void - ensure_display_for_seat (GdmLocalDisplayFactory *factory, - const char *seat_id) - { - int ret; - gboolean seat_supports_graphics; - gboolean is_seat0; - const char *session_type = "wayland"; +@@ -481,6 +580,19 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory, GdmDisplayStore *store; GdmDisplay *display = NULL; g_autofree char *login_session_id = NULL; @@ -1017,19 +369,7 @@ index 8a4ef06cd..141d64c6b 100644 ret = sd_seat_can_graphical (seat_id); - if (ret < 0) { - g_critical ("Failed to query CanGraphical information for seat %s", seat_id); - return; - } - - if (ret == 0) { - g_debug ("GdmLocalDisplayFactory: System doesn't currently support graphics"); - seat_supports_graphics = FALSE; - } else { - g_debug ("GdmLocalDisplayFactory: System supports graphics"); - seat_supports_graphics = TRUE; - } - +@@ -500,21 +612,18 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory, if (g_strcmp0 (seat_id, "seat0") == 0) { is_seat0 = TRUE; @@ -1057,37 +397,7 @@ index 8a4ef06cd..141d64c6b 100644 } /* For seat0, we have a fallback logic to still try starting it after - * SEAT0_GRAPHICS_CHECK_TIMEOUT seconds. i.e. we simply continue even if - * CanGraphical is unset. - * This is ugly, but it means we'll come up eventually in some - * scenarios where no master device is present. - * Note that we'll force an X11 fallback even though there might be - * cases where an wayland capable device is present and simply not marked as - * master-of-seat. In these cases, this should likely be fixed in the - * udev rules. - * - * At the moment, systemd always sets CanGraphical for non-seat0 seats. - * This is because non-seat0 seats are defined by having master-of-seat - * set. This means we can avoid the fallback check for non-seat0 seats, - * which simplifies the code. - */ - if (is_seat0) { - if (!seat_supports_graphics) { - if (!factory->seat0_graphics_check_timed_out) { - if (factory->seat0_graphics_check_timeout_id == 0) { - g_debug ("GdmLocalDisplayFactory: seat0 doesn't yet support graphics. Waiting %d seconds to try again.", SEAT0_GRAPHICS_CHECK_TIMEOUT); - factory->seat0_graphics_check_timeout_id = g_timeout_add_seconds (SEAT0_GRAPHICS_CHECK_TIMEOUT, - on_seat0_graphics_check_timeout, - factory); - - } else { - /* It is not yet time to force X11 fallback. */ - g_debug ("GdmLocalDisplayFactory: seat0 display requested when there is no graphics support before graphics check timeout."); - } - - return; - } - +@@ -552,7 +661,8 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory, g_debug ("GdmLocalDisplayFactory: Assuming we can use seat0 for X11 even though system says it doesn't support graphics!"); g_debug ("GdmLocalDisplayFactory: This might indicate an issue where the framebuffer device is not tagged as master-of-seat in udev."); seat_supports_graphics = TRUE; @@ -1097,8 +407,7 @@ index 8a4ef06cd..141d64c6b 100644 } else { g_clear_handle_id (&factory->seat0_graphics_check_timeout_id, g_source_remove); } - } - +@@ -561,8 +671,13 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory, if (!seat_supports_graphics) return; @@ -1114,34 +423,7 @@ index 8a4ef06cd..141d64c6b 100644 store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); if (is_seat0) - display = gdm_display_store_find (store, lookup_prepared_display_by_seat_id, (gpointer) seat_id); - else - display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id); - - /* Ensure we don't create the same display more than once */ - if (display != NULL) { - g_debug ("GdmLocalDisplayFactory: display already created"); - return; - } - - /* If we already have a login window, switch to it */ - if (gdm_get_login_window_session_id (seat_id, &login_session_id)) { - GdmDisplay *display; - - display = gdm_display_store_find (store, - lookup_by_session_id, - (gpointer) login_session_id); - if (display != NULL && - (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED || - gdm_display_get_status (display) == GDM_DISPLAY_WAITING_TO_FINISH)) { - g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_MANAGED, NULL); - g_debug ("GdmLocalDisplayFactory: session %s found, activating.", - login_session_id); - gdm_activate_session_by_id (factory->connection, seat_id, login_session_id); - return; - } - } - +@@ -597,20 +712,53 @@ ensure_display_for_seat (GdmLocalDisplayFactory *factory, g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id); #ifdef ENABLE_USER_DISPLAY_SERVER @@ -1198,65 +480,11 @@ index 8a4ef06cd..141d64c6b 100644 } g_object_set (display, "seat-id", seat_id, NULL); - g_object_set (display, "is-initial", is_seat0, NULL); - - store_display (factory, display); - - /* let store own the ref */ - g_object_unref (display); - - if (! gdm_display_manage (display)) { - gdm_display_unmanage (display); - } - - return; - } - - static void - delete_display (GdmLocalDisplayFactory *factory, - const char *seat_id) { - - GdmDisplayStore *store; - - g_debug ("GdmLocalDisplayFactory: Removing used_display_numbers on seat %s", seat_id); - - store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory)); - gdm_display_store_foreach_remove (store, lookup_by_seat_id, (gpointer) seat_id); - } - - static gboolean diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c -index 9c10adff3..4c2752fee 100644 +index 9c10adf..4c2752f 100644 --- a/daemon/gdm-manager.c +++ b/daemon/gdm-manager.c -@@ -1306,74 +1306,75 @@ get_automatic_login_details (GdmManager *manager, - *usernamep = username; - } else { - g_free (username); - } - - return enabled; - } - - static const char * - get_username_for_greeter_display (GdmManager *manager, - GdmDisplay *display) - { - gboolean doing_initial_setup = FALSE; - - g_object_get (G_OBJECT (display), - "doing-initial-setup", &doing_initial_setup, - NULL); - - if (doing_initial_setup) { - return INITIAL_SETUP_USERNAME; - } else { - return GDM_USERNAME; - } - } - - static void - set_up_automatic_login_session (GdmManager *manager, +@@ -1333,7 +1333,7 @@ set_up_automatic_login_session (GdmManager *manager, GdmDisplay *display) { GdmSession *session; @@ -1265,8 +493,7 @@ index 9c10adff3..4c2752fee 100644 /* 0 is root user; since the daemon talks to the session object * directly, itself, for automatic login - */ - create_user_session_for_display (manager, display, 0); +@@ -1342,11 +1342,12 @@ set_up_automatic_login_session (GdmManager *manager, session = get_user_session_for_display (display); g_object_get (G_OBJECT (display), @@ -1280,61 +507,7 @@ index 9c10adff3..4c2752fee 100644 NULL); g_debug ("GdmManager: Starting automatic login conversation"); - gdm_session_start_conversation (session, "gdm-autologin"); - } - - static void - set_up_chooser_session (GdmManager *manager, - GdmDisplay *display) - { - const char *allowed_user; - struct passwd *passwd_entry; - - allowed_user = get_username_for_greeter_display (manager, display); - - if (!gdm_get_pwent_for_name (allowed_user, &passwd_entry)) { - g_warning ("GdmManager: couldn't look up username %s", - allowed_user); - gdm_display_unmanage (display); - gdm_display_finish (display); - return; - } - - gdm_display_start_greeter_session (display); - } - - static void - set_up_greeter_session (GdmManager *manager, - GdmDisplay *display) - { -@@ -2278,87 +2279,85 @@ on_session_reauthentication_started (GdmSession *session, - - if (invocation != NULL) { - g_hash_table_steal (manager->priv->open_reauthentication_requests, - source_tag); - gdm_dbus_manager_complete_open_reauthentication_channel (GDM_DBUS_MANAGER (manager), - invocation, - address); - } - } - - static void - clean_user_session (GdmSession *session) - { - g_object_set_data (G_OBJECT (session), "gdm-display", NULL); - g_object_unref (session); - } - - static void - create_user_session_for_display (GdmManager *manager, - GdmDisplay *display, - uid_t allowed_user) - { - GdmSession *session; - gboolean display_is_local = FALSE; - char *display_name = NULL; - char *display_device = NULL; - char *remote_hostname = NULL; +@@ -2305,10 +2306,7 @@ create_user_session_for_display (GdmManager *manager, char *display_auth_file = NULL; char *display_seat_id = NULL; char *display_id = NULL; @@ -1346,8 +519,7 @@ index 9c10adff3..4c2752fee 100644 g_object_get (G_OBJECT (display), "id", &display_id, - "x11-display-name", &display_name, - "is-local", &display_is_local, +@@ -2317,9 +2315,7 @@ create_user_session_for_display (GdmManager *manager, "remote-hostname", &remote_hostname, "x11-authority-file", &display_auth_file, "seat-id", &display_seat_id, @@ -1358,12 +530,7 @@ index 9c10adff3..4c2752fee 100644 NULL); display_device = get_display_device (manager, display); - session = gdm_session_new (GDM_SESSION_VERIFICATION_MODE_LOGIN, - allowed_user, - display_name, - remote_hostname, - display_device, - display_seat_id, +@@ -2332,6 +2328,9 @@ create_user_session_for_display (GdmManager *manager, display_auth_file, display_is_local, NULL); @@ -1373,61 +540,7 @@ index 9c10adff3..4c2752fee 100644 g_debug ("GdmSession: Created user session for user %d on display %s (seat %s)", (int) allowed_user, - display_id, - display_seat_id); - - g_free (display_name); - g_free (remote_hostname); - g_free (display_auth_file); - g_free (display_seat_id); - - g_signal_connect (session, - "reauthentication-started", - G_CALLBACK (on_session_reauthentication_started), - manager); - g_signal_connect (session, - "reauthenticated", - G_CALLBACK (on_session_reauthenticated), - manager); - g_signal_connect (session, - "client-ready-for-session-to-start", - G_CALLBACK (on_session_client_ready_for_session_to_start), - manager); - g_signal_connect (session, - "client-connected", - G_CALLBACK (on_session_client_connected), - manager); - g_signal_connect (session, - "client-disconnected", - G_CALLBACK (on_session_client_disconnected), -@@ -2378,65 +2377,60 @@ create_user_session_for_display (GdmManager *manager, - g_signal_connect (session, - "authentication-failed", - G_CALLBACK (on_session_authentication_failed), - manager); - g_signal_connect (session, - "session-opened", - G_CALLBACK (on_user_session_opened), - manager); - g_signal_connect (session, - "session-started", - G_CALLBACK (on_user_session_started), - manager); - g_signal_connect (session, - "session-start-failed", - G_CALLBACK (on_session_start_failed), - manager); - g_signal_connect (session, - "session-exited", - G_CALLBACK (on_user_session_exited), - manager); - g_signal_connect (session, - "session-died", - G_CALLBACK (on_user_session_died), - manager); - g_object_set_data (G_OBJECT (session), "gdm-display", display); - g_object_set_data_full (G_OBJECT (display), - "gdm-user-session", +@@ -2405,11 +2404,6 @@ create_user_session_for_display (GdmManager *manager, session, (GDestroyNotify) clean_user_session); @@ -1439,65 +552,11 @@ index 9c10adff3..4c2752fee 100644 } static void - on_display_added (GdmDisplayStore *display_store, - const char *id, - GdmManager *manager) - { - GdmDisplay *display; - - display = gdm_display_store_lookup (display_store, id); - - if (display != NULL) { - g_dbus_object_manager_server_export (manager->priv->object_manager, - gdm_display_get_object_skeleton (display)); - - g_signal_connect (display, "notify::status", - G_CALLBACK (on_display_status_changed), - manager); - g_signal_emit (manager, signals[DISPLAY_ADDED], 0, id); - } - } - - GQuark - gdm_manager_error_quark (void) - { - static GQuark ret = 0; - if (ret == 0) { - ret = g_quark_from_static_string ("gdm_manager_error"); - } - diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c -index a010cecf5..2b941e5e1 100644 +index a010cec..2b941e5 100644 --- a/daemon/gdm-session.c +++ b/daemon/gdm-session.c -@@ -106,84 +106,81 @@ struct _GdmSession - GdmDBusUserVerifier *user_verifier_interface; - GHashTable *user_verifier_extensions; - GdmDBusGreeter *greeter_interface; - GdmDBusRemoteGreeter *remote_greeter_interface; - GdmDBusChooser *chooser_interface; - - GList *pending_worker_connections; - GList *outside_connections; - - GPid session_pid; - - /* object lifetime scope */ - char *session_type; - char *display_name; - char *display_hostname; - char *display_device; - char *display_seat_id; - char *display_x11_authority_file; - gboolean display_is_local; - - GdmSessionVerificationMode verification_mode; - - uid_t allowed_user; - - char *fallback_session_name; - - GDBusServer *worker_server; +@@ -133,11 +133,10 @@ struct _GdmSession GDBusServer *outside_server; GHashTable *environment; @@ -1511,16 +570,7 @@ index a010cecf5..2b941e5e1 100644 }; enum { - PROP_0, - PROP_VERIFICATION_MODE, - PROP_ALLOWED_USER, - PROP_DISPLAY_NAME, - PROP_DISPLAY_HOSTNAME, - PROP_DISPLAY_IS_LOCAL, - PROP_DISPLAY_IS_INITIAL, - PROP_SESSION_TYPE, - PROP_DISPLAY_DEVICE, - PROP_DISPLAY_SEAT_ID, +@@ -154,9 +153,7 @@ enum { PROP_DISPLAY_X11_AUTHORITY_FILE, PROP_USER_X11_AUTHORITY_FILE, PROP_CONVERSATION_ENVIRONMENT, @@ -1531,61 +581,7 @@ index a010cecf5..2b941e5e1 100644 }; enum { - CONVERSATION_STARTED = 0, - CONVERSATION_STOPPED, - SETUP_COMPLETE, - CANCELLED, - HOSTNAME_SELECTED, - CLIENT_REJECTED, - CLIENT_CONNECTED, - CLIENT_DISCONNECTED, - CLIENT_READY_FOR_SESSION_TO_START, - DISCONNECTED, - AUTHENTICATION_FAILED, - VERIFICATION_COMPLETE, - SESSION_OPENED, - SESSION_OPENED_FAILED, - SESSION_STARTED, - SESSION_START_FAILED, - SESSION_EXITED, - SESSION_DIED, - REAUTHENTICATION_STARTED, - REAUTHENTICATED, - LAST_SIGNAL - }; - - #ifdef ENABLE_WAYLAND_SUPPORT - static gboolean gdm_session_is_wayland_session (GdmSession *self); - #endif - static void update_session_type (GdmSession *self); -@@ -320,109 +317,117 @@ on_establish_credentials_cb (GdmDBusWorker *proxy, - g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - return; - - self = g_object_ref (conversation->session); - service_name = g_strdup (conversation->service_name); - - if (worked) { - switch (self->verification_mode) { - case GDM_SESSION_VERIFICATION_MODE_LOGIN: - case GDM_SESSION_VERIFICATION_MODE_CHOOSER: - gdm_session_open_session (self, service_name); - break; - case GDM_SESSION_VERIFICATION_MODE_REAUTHENTICATE: - if (self->user_verifier_interface != NULL) { - gdm_dbus_user_verifier_emit_verification_complete (self->user_verifier_interface, - service_name); - g_signal_emit (self, signals[VERIFICATION_COMPLETE], 0, service_name); - } - break; - default: - break; - } - } else { - report_and_stop_conversation (self, service_name, error); - } - - g_free (service_name); +@@ -347,13 +344,24 @@ on_establish_credentials_cb (GdmDBusWorker *proxy, g_object_unref (self); } @@ -1611,13 +607,7 @@ index a010cecf5..2b941e5e1 100644 const gchar * const *system_data_dirs = g_get_system_data_dirs (); static const char *x_search_dirs[] = { - "/etc/X11/sessions/", - DMCONFDIR "/Sessions/", - DATADIR "/gdm/BuiltInSessions/", - DATADIR "/xsessions/", - }; - - static const char *wayland_search_dir = DATADIR "/wayland-sessions/"; +@@ -367,35 +375,32 @@ get_system_session_dirs (GdmSession *self, search_array = g_array_new (TRUE, TRUE, sizeof (char *)); @@ -1671,61 +661,7 @@ index a010cecf5..2b941e5e1 100644 search_dirs = g_strdupv ((char **) search_array->data); - g_array_free (search_array, TRUE); - - return search_dirs; - } - - static gboolean - is_prog_in_path (const char *prog) - { - char *f; - gboolean ret; - - f = g_find_program_in_path (prog); - ret = (f != NULL); - g_free (f); - return ret; - } - - static GKeyFile * - load_key_file_for_file (GdmSession *self, - const char *file, - const char *type, - char **full_path) - { - GKeyFile *key_file; - GError *error = NULL; - gboolean res; - char **search_dirs; -@@ -444,60 +449,66 @@ load_key_file_for_file (GdmSession *self, - g_debug ("GdmSession: %s", error->message); - g_error_free (error); - } - g_key_file_free (key_file); - key_file = NULL; - } - - g_strfreev (search_dirs); - - return key_file; - } - - static gboolean - get_session_command_for_file (GdmSession *self, - const char *file, - const char *type, - char **command) - { - GKeyFile *key_file; - GError *error; - char *exec; - gboolean ret; - gboolean res; - - exec = NULL; - ret = FALSE; - if (command != NULL) { +@@ -471,6 +476,12 @@ get_session_command_for_file (GdmSession *self, *command = NULL; } @@ -1738,61 +674,7 @@ index a010cecf5..2b941e5e1 100644 g_debug ("GdmSession: getting session command for file '%s'", file); key_file = load_key_file_for_file (self, file, type, NULL); if (key_file == NULL) { - goto out; - } - - error = NULL; - res = g_key_file_get_boolean (key_file, - G_KEY_FILE_DESKTOP_GROUP, - G_KEY_FILE_DESKTOP_KEY_HIDDEN, - &error); - if (error == NULL && res) { - g_debug ("GdmSession: Session %s is marked as hidden", file); - goto out; - } - - exec = g_key_file_get_string (key_file, - G_KEY_FILE_DESKTOP_GROUP, - G_KEY_FILE_DESKTOP_KEY_TRY_EXEC, - NULL); - if (exec != NULL) { - res = is_prog_in_path (exec); - g_free (exec); - exec = NULL; - - if (! res) { - g_debug ("GdmSession: Command not found: %s", - G_KEY_FILE_DESKTOP_KEY_TRY_EXEC); - goto out; - } -@@ -2230,68 +2241,72 @@ close_conversation (GdmSessionConversation *conversation) - - if (conversation->worker_manager_interface != NULL) { - unexport_worker_manager_interface (self, conversation->worker_manager_interface); - g_clear_object (&conversation->worker_manager_interface); - } - - if (conversation->worker_proxy != NULL) { - GDBusConnection *connection = g_dbus_proxy_get_connection (G_DBUS_PROXY (conversation->worker_proxy)); - g_dbus_connection_close_sync (connection, NULL, NULL); - } - } - - static void - stop_conversation (GdmSessionConversation *conversation) - { - close_conversation (conversation); - - conversation->is_stopping = TRUE; - gdm_session_worker_job_stop (conversation->job); - } - - static void - stop_conversation_now (GdmSessionConversation *conversation) - { - close_conversation (conversation); - - gdm_session_worker_job_stop_now (conversation->job); +@@ -2257,14 +2268,18 @@ stop_conversation_now (GdmSessionConversation *conversation) g_clear_object (&conversation->job); } @@ -1816,61 +698,7 @@ index a010cecf5..2b941e5e1 100644 gboolean gdm_session_start_conversation (GdmSession *self, - const char *service_name) - { - GdmSessionConversation *conversation; - - g_return_val_if_fail (GDM_IS_SESSION (self), FALSE); - - conversation = g_hash_table_lookup (self->conversations, - service_name); - - if (conversation != NULL) { - if (!conversation->is_stopping) { - g_warning ("GdmSession: conversation %s started more than once", service_name); - return FALSE; - } - g_debug ("GdmSession: stopping old conversation %s", service_name); - gdm_session_worker_job_stop_now (conversation->job); - g_object_unref (conversation->job); - conversation->job = NULL; - } - - g_debug ("GdmSession: starting conversation %s for session (%p)", service_name, self); - - conversation = start_conversation (self, service_name); - - g_hash_table_insert (self->conversations, - g_strdup (service_name), conversation); - return TRUE; -@@ -3162,69 +3177,69 @@ gdm_session_get_session_id (GdmSession *self) - - const char * - gdm_session_get_conversation_session_id (GdmSession *self, - const char *service_name) - { - GdmSessionConversation *conversation; - - g_return_val_if_fail (GDM_IS_SESSION (self), NULL); - - conversation = find_conversation_by_name (self, service_name); - - if (conversation == NULL) { - return NULL; - } - - return conversation->session_id; - } - - static char * - get_session_filename (GdmSession *self) - { - return g_strdup_printf ("%s.desktop", get_session_name (self)); - } - - #ifdef ENABLE_WAYLAND_SUPPORT - static gboolean - gdm_session_is_wayland_session (GdmSession *self) +@@ -3189,15 +3204,15 @@ gdm_session_is_wayland_session (GdmSession *self) { GKeyFile *key_file; gboolean is_wayland_session = FALSE; @@ -1889,61 +717,7 @@ index a010cecf5..2b941e5e1 100644 if (key_file == NULL) { goto out; - } - - if (full_path != NULL && strstr (full_path, "/wayland-sessions/") != NULL) { - is_wayland_session = TRUE; - } - g_debug ("GdmSession: checking if file '%s' is wayland session: %s", filename, is_wayland_session? "yes" : "no"); - - out: - g_clear_pointer (&key_file, g_key_file_free); - g_free (filename); - return is_wayland_session; - } - #endif - - static void - update_session_type (GdmSession *self) - { - #ifdef ENABLE_WAYLAND_SUPPORT - gboolean is_wayland_session = FALSE; - - is_wayland_session = gdm_session_is_wayland_session (self); - - if (is_wayland_session) { - set_session_type (self, "wayland"); - } else { - set_session_type (self, NULL); - } -@@ -3513,140 +3528,138 @@ gdm_session_set_property (GObject *object, - case PROP_DISPLAY_HOSTNAME: - set_display_hostname (self, g_value_get_string (value)); - break; - case PROP_DISPLAY_DEVICE: - set_display_device (self, g_value_get_string (value)); - break; - case PROP_DISPLAY_SEAT_ID: - set_display_seat_id (self, g_value_get_string (value)); - break; - case PROP_USER_X11_AUTHORITY_FILE: - set_user_x11_authority_file (self, g_value_get_string (value)); - break; - case PROP_DISPLAY_X11_AUTHORITY_FILE: - set_display_x11_authority_file (self, g_value_get_string (value)); - break; - case PROP_DISPLAY_IS_LOCAL: - set_display_is_local (self, g_value_get_boolean (value)); - break; - case PROP_DISPLAY_IS_INITIAL: - set_display_is_initial (self, g_value_get_boolean (value)); - break; - case PROP_VERIFICATION_MODE: - set_verification_mode (self, g_value_get_enum (value)); - break; - case PROP_ALLOWED_USER: - set_allowed_user (self, g_value_get_uint (value)); - break; +@@ -3540,11 +3555,9 @@ gdm_session_set_property (GObject *object, case PROP_CONVERSATION_ENVIRONMENT: set_conversation_environment (self, g_value_get_pointer (value)); break; @@ -1957,53 +731,7 @@ index a010cecf5..2b941e5e1 100644 default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; - } - } - - static void - gdm_session_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) - { - GdmSession *self; - - self = GDM_SESSION (object); - - switch (prop_id) { - case PROP_SESSION_TYPE: - g_value_set_string (value, self->session_type); - break; - case PROP_DISPLAY_NAME: - g_value_set_string (value, self->display_name); - break; - case PROP_DISPLAY_HOSTNAME: - g_value_set_string (value, self->display_hostname); - break; - case PROP_DISPLAY_DEVICE: - g_value_set_string (value, self->display_device); - break; - case PROP_DISPLAY_SEAT_ID: - g_value_set_string (value, self->display_seat_id); - break; - case PROP_USER_X11_AUTHORITY_FILE: - g_value_set_string (value, self->user_x11_authority_file); - break; - case PROP_DISPLAY_X11_AUTHORITY_FILE: - g_value_set_string (value, self->display_x11_authority_file); - break; - case PROP_DISPLAY_IS_LOCAL: - g_value_set_boolean (value, self->display_is_local); - break; - case PROP_DISPLAY_IS_INITIAL: - g_value_set_boolean (value, self->display_is_initial); - break; - case PROP_VERIFICATION_MODE: - g_value_set_enum (value, self->verification_mode); - break; - case PROP_ALLOWED_USER: - g_value_set_uint (value, self->allowed_user); - break; +@@ -3598,11 +3611,9 @@ gdm_session_get_property (GObject *object, case PROP_CONVERSATION_ENVIRONMENT: g_value_set_pointer (value, self->environment); break; @@ -2017,17 +745,7 @@ index a010cecf5..2b941e5e1 100644 default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; - } - } - - static void - gdm_session_dispose (GObject *object) - { - GdmSession *self; - - self = GDM_SESSION (object); - - g_debug ("GdmSession: Disposing session"); +@@ -3620,6 +3631,8 @@ gdm_session_dispose (GObject *object) gdm_session_close (self); @@ -2036,61 +754,7 @@ index a010cecf5..2b941e5e1 100644 g_clear_pointer (&self->conversations, g_hash_table_unref); - g_clear_object (&self->user_verifier_interface); - g_clear_pointer (&self->user_verifier_extensions, - g_hash_table_unref); - g_clear_object (&self->greeter_interface); - g_clear_object (&self->remote_greeter_interface); - g_clear_object (&self->chooser_interface); - - g_free (self->display_name); - self->display_name = NULL; - - g_free (self->display_hostname); - self->display_hostname = NULL; - - g_free (self->display_device); - self->display_device = NULL; - - g_free (self->display_seat_id); - self->display_seat_id = NULL; - - g_free (self->display_x11_authority_file); - self->display_x11_authority_file = NULL; - - g_strfreev (self->conversation_environment); - self->conversation_environment = NULL; - - if (self->worker_server != NULL) { - g_dbus_server_stop (self->worker_server); -@@ -4007,69 +4020,67 @@ gdm_session_class_init (GdmSessionClass *session_class) - PROP_DISPLAY_X11_AUTHORITY_FILE, - g_param_spec_string ("display-x11-authority-file", - "display x11 authority file", - "display x11 authority file", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); - /* not construct only */ - g_object_class_install_property (object_class, - PROP_USER_X11_AUTHORITY_FILE, - g_param_spec_string ("user-x11-authority-file", - "", - "", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - g_object_class_install_property (object_class, - PROP_DISPLAY_DEVICE, - g_param_spec_string ("display-device", - "display device", - "display device", - NULL, - G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); - - g_object_class_install_property (object_class, - PROP_DISPLAY_SEAT_ID, - g_param_spec_string ("display-seat-id", - "display seat id", - "display seat id", +@@ -4034,15 +4047,13 @@ gdm_session_class_init (GdmSessionClass *session_class) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); @@ -2112,65 +776,11 @@ index a010cecf5..2b941e5e1 100644 /* Ensure we can resolve errors */ gdm_dbus_error_ensure (GDM_SESSION_WORKER_ERROR); - } - - GdmSession * - gdm_session_new (GdmSessionVerificationMode verification_mode, - uid_t allowed_user, - const char *display_name, - const char *display_hostname, - const char *display_device, - const char *display_seat_id, - const char *display_x11_authority_file, - gboolean display_is_local, - const char * const *environment) - { - GdmSession *self; - - self = g_object_new (GDM_TYPE_SESSION, - "verification-mode", verification_mode, - "allowed-user", (guint) allowed_user, - "display-name", display_name, - "display-hostname", display_hostname, - "display-device", display_device, - "display-seat-id", display_seat_id, - "display-x11-authority-file", display_x11_authority_file, - "display-is-local", display_is_local, - "conversation-environment", environment, - NULL); - diff --git a/data/gdm.schemas.in b/data/gdm.schemas.in -index 255bff023..a1035f95e 100644 +index 255bff0..a1035f9 100644 --- a/data/gdm.schemas.in +++ b/data/gdm.schemas.in -@@ -25,65 +25,75 @@ - - daemon/AutomaticLoginEnable - b - false - - - daemon/AutomaticLogin - s - - - - daemon/TimedLoginEnable - b - false - - - daemon/TimedLogin - s - - - - daemon/TimedLoginDelay - i - 30 - - - daemon/InitialSetupEnable +@@ -52,11 +52,21 @@ b true @@ -2192,65 +802,11 @@ index 255bff023..a1035f95e 100644 security/AllowRemoteAutoLogin b - false - - - - debug/Enable - b - false - - - - security/DisallowTCP - b - true - - - xdmcp/Enable - b - false - - - xdmcp/ShowLocalGreeter - b - true - - - xdmcp/MaxPending - i diff --git a/libgdm/gdm-sessions.c b/libgdm/gdm-sessions.c -index a13225050..f078e04b8 100644 +index a132250..d8b4d5c 100644 --- a/libgdm/gdm-sessions.c +++ b/libgdm/gdm-sessions.c -@@ -163,171 +163,203 @@ load_session_file (const char *id, - - static gboolean - remove_duplicate_sessions (gpointer key, - gpointer value, - gpointer user_data) - { - gboolean already_known; - GHashTable *names_seen_before; - GdmSessionFile *session; - - names_seen_before = (GHashTable *) user_data; - session = (GdmSessionFile *) value; - already_known = !g_hash_table_add (names_seen_before, session->translated_name); - - if (already_known) - g_debug ("GdmSession: Removing %s (%s) as we already have a session by this name", - session->id, - session->path); - - return already_known; - } - - static void - collect_sessions_from_directory (const char *dirname) - { - GDir *dir; - const char *filename; +@@ -190,6 +190,8 @@ collect_sessions_from_directory (const char *dirname) gboolean is_x11 = g_getenv ("WAYLAND_DISPLAY") == NULL && g_getenv ("RUNNING_UNDER_GDM") != NULL; @@ -2259,16 +815,7 @@ index a13225050..f078e04b8 100644 /* FIXME: add file monitor to directory */ - dir = g_dir_open (dirname, 0, NULL); - if (dir == NULL) { - return; - } - - while ((filename = g_dir_read_name (dir))) { - char *id; - char *full_path; - - if (! g_str_has_suffix (filename, ".desktop")) { +@@ -206,18 +208,46 @@ collect_sessions_from_directory (const char *dirname) continue; } @@ -2326,69 +873,21 @@ index a13225050..f078e04b8 100644 } id = g_strndup (filename, strlen (filename) - strlen (".desktop")); - - full_path = g_build_filename (dirname, filename, NULL); - - load_session_file (id, full_path); - - g_free (id); - g_free (full_path); - } - - g_dir_close (dir); - } - - static void - collect_sessions (void) - { - g_autoptr(GHashTable) names_seen_before = NULL; - g_autoptr(GPtrArray) xorg_search_array = NULL; - g_autoptr(GPtrArray) wayland_search_array = NULL; - gchar *session_dir = NULL; - int i; - const char *xorg_search_dirs[] = { - "/etc/X11/sessions/", - DMCONFDIR "/Sessions/", +@@ -247,6 +277,13 @@ collect_sessions (void) DATADIR "/gdm/BuiltInSessions/", DATADIR "/xsessions/", }; ++ const gchar *supported_session_types_env = NULL; + g_auto (GStrv) supported_session_types = NULL; + -+ supported_session_types = g_strsplit (g_getenv ("GDM_SUPPORTED_SESSION_TYPES"), ":", -1); ++ supported_session_types_env = g_getenv ("GDM_SUPPORTED_SESSION_TYPES"); ++ if (supported_session_types_env != NULL) { ++ supported_session_types = g_strsplit (supported_session_types_env, ":", -1); ++ } names_seen_before = g_hash_table_new (g_str_hash, g_str_equal); xorg_search_array = g_ptr_array_new_with_free_func (g_free); - - const gchar * const *system_data_dirs = g_get_system_data_dirs (); - - for (i = 0; system_data_dirs[i]; i++) { - session_dir = g_build_filename (system_data_dirs[i], "xsessions", NULL); - g_ptr_array_add (xorg_search_array, session_dir); - } - - for (i = 0; i < G_N_ELEMENTS (xorg_search_dirs); i++) { - g_ptr_array_add (xorg_search_array, g_strdup (xorg_search_dirs[i])); - } - - #ifdef ENABLE_WAYLAND_SUPPORT - const char *wayland_search_dirs[] = { - DATADIR "/wayland-sessions/", - }; - - wayland_search_array = g_ptr_array_new_with_free_func (g_free); - - for (i = 0; system_data_dirs[i]; i++) { - session_dir = g_build_filename (system_data_dirs[i], "wayland-sessions", NULL); - g_ptr_array_add (wayland_search_array, session_dir); - } - - for (i = 0; i < G_N_ELEMENTS (wayland_search_dirs); i++) { - g_ptr_array_add (wayland_search_array, g_strdup (wayland_search_dirs[i])); - } - #endif - - if (gdm_available_sessions_map == NULL) { - gdm_available_sessions_map = g_hash_table_new_full (g_str_hash, g_str_equal, +@@ -284,23 +321,22 @@ collect_sessions (void) g_free, (GDestroyNotify)gdm_session_file_free); } @@ -2420,33 +919,6 @@ index a13225050..f078e04b8 100644 g_hash_table_foreach_remove (gdm_available_sessions_map, remove_duplicate_sessions, names_seen_before); - } - - static gint - compare_session_ids (gconstpointer a, - gconstpointer b) - { - GdmSessionFile *session_a, *session_b; - session_a = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map, a); - session_b = (GdmSessionFile *) g_hash_table_lookup (gdm_available_sessions_map, b); - - if (session_a == NULL) - return -1; - - if (session_b == NULL) - return 1; - - return g_strcmp0 (session_a->translated_name, session_b->translated_name); - } - - /** - * gdm_get_session_ids: - * - * Reads /usr/share/xsessions and other relevant places for possible sessions - * to log into and returns the complete list. - * - * Returns: (transfer full): a %NULL terminated list of session ids - */ -- -2.31.1 +2.51.0 diff --git a/SOURCES/0001-manager-allow-multiple-xdmcp-logins-for-the-same-use.patch b/SOURCES/0001-manager-allow-multiple-xdmcp-logins-for-the-same-use.patch index 184f163..730d40a 100644 --- a/SOURCES/0001-manager-allow-multiple-xdmcp-logins-for-the-same-use.patch +++ b/SOURCES/0001-manager-allow-multiple-xdmcp-logins-for-the-same-use.patch @@ -5,42 +5,15 @@ Subject: [PATCH 1/3] manager: allow multiple xdmcp logins for the same user --- common/gdm-settings-keys.h | 1 + - daemon/gdm-manager.c | 71 ++++++++++++++++++++++++++++---------- + daemon/gdm-manager.c | 72 ++++++++++++++++++++++++++++---------- data/gdm.schemas.in | 5 +++ - 3 files changed, 59 insertions(+), 18 deletions(-) + 3 files changed, 60 insertions(+), 18 deletions(-) diff --git a/common/gdm-settings-keys.h b/common/gdm-settings-keys.h -index 87685d3c..4b3a1ffe 100644 +index 87685d3..4b3a1ff 100644 --- a/common/gdm-settings-keys.h +++ b/common/gdm-settings-keys.h -@@ -30,37 +30,38 @@ G_BEGIN_DECLS - #define GDM_KEY_AUTO_LOGIN_ENABLE "daemon/AutomaticLoginEnable" - #define GDM_KEY_AUTO_LOGIN_USER "daemon/AutomaticLogin" - #define GDM_KEY_TIMED_LOGIN_ENABLE "daemon/TimedLoginEnable" - #define GDM_KEY_TIMED_LOGIN_USER "daemon/TimedLogin" - #define GDM_KEY_TIMED_LOGIN_DELAY "daemon/TimedLoginDelay" - #define GDM_KEY_INITIAL_SETUP_ENABLE "daemon/InitialSetupEnable" - #define GDM_KEY_PREFERRED_DISPLAY_SERVER "daemon/PreferredDisplayServer" - #define GDM_KEY_WAYLAND_ENABLE "daemon/WaylandEnable" - #define GDM_KEY_XORG_ENABLE "daemon/XorgEnable" - - #define GDM_KEY_DEBUG "debug/Enable" - - #define GDM_KEY_INCLUDE "greeter/Include" - #define GDM_KEY_EXCLUDE "greeter/Exclude" - #define GDM_KEY_INCLUDE_ALL "greeter/IncludeAll" - - #define GDM_KEY_DISALLOW_TCP "security/DisallowTCP" - #define GDM_KEY_ALLOW_REMOTE_AUTOLOGIN "security/AllowRemoteAutoLogin" - - #define GDM_KEY_XDMCP_ENABLE "xdmcp/Enable" - #define GDM_KEY_SHOW_LOCAL_GREETER "xdmcp/ShowLocalGreeter" - #define GDM_KEY_MAX_PENDING "xdmcp/MaxPending" - #define GDM_KEY_MAX_SESSIONS "xdmcp/MaxSessions" - #define GDM_KEY_MAX_WAIT "xdmcp/MaxWait" - #define GDM_KEY_DISPLAYS_PER_HOST "xdmcp/DisplaysPerHost" - #define GDM_KEY_UDP_PORT "xdmcp/Port" - #define GDM_KEY_INDIRECT "xdmcp/HonorIndirect" +@@ -57,6 +57,7 @@ G_BEGIN_DECLS #define GDM_KEY_MAX_WAIT_INDIRECT "xdmcp/MaxWaitIndirect" #define GDM_KEY_PING_INTERVAL "xdmcp/PingIntervalSeconds" #define GDM_KEY_WILLING "xdmcp/Willing" @@ -48,42 +21,11 @@ index 87685d3c..4b3a1ffe 100644 #define GDM_KEY_MULTICAST "chooser/Multicast" #define GDM_KEY_MULTICAST_ADDR "chooser/MulticastAddr" - - G_END_DECLS - - #endif /* _GDM_SETTINGS_KEYS_H */ diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c -index e1bc62d7..08c3cc17 100644 +index 681c9f6..2be7d2b 100644 --- a/daemon/gdm-manager.c +++ b/daemon/gdm-manager.c -@@ -566,93 +566,106 @@ get_display_and_details_for_bus_sender (GdmManager *self, - *out_tty = get_tty_for_session_id (session_id, &error); - - if (error != NULL) { - g_debug ("GdmManager: Error while retrieving tty for session: %s", - error->message); - g_clear_error (&error); - } - } - - display = gdm_display_store_find (self->priv->display_store, - lookup_by_session_id, - (gpointer) session_id); - - out: - if (out_display != NULL) { - *out_display = display; - } - - g_free (session_id); - } - - static gboolean - switch_to_compatible_user_session (GdmManager *manager, - GdmSession *session, - gboolean fail_if_already_switched) - { - gboolean res; +@@ -597,7 +597,7 @@ switch_to_compatible_user_session (GdmManager *manager, gboolean ret; const char *username; const char *seat_id; @@ -92,7 +34,7 @@ index e1bc62d7..08c3cc17 100644 GdmSession *existing_session; ret = FALSE; - +@@ -605,31 +605,44 @@ switch_to_compatible_user_session (GdmManager *manager, username = gdm_session_get_username (session); seat_id = gdm_session_get_display_seat_id (session); @@ -154,34 +96,7 @@ index e1bc62d7..08c3cc17 100644 ret = TRUE; out: - return ret; - } - - static GdmDisplay * - get_display_for_user_session (GdmSession *session) - { - return g_object_get_data (G_OBJECT (session), "gdm-display"); - } - - static GdmSession * - get_user_session_for_display (GdmDisplay *display) - { - if (display == NULL) { - return NULL; - } - - return g_object_get_data (G_OBJECT (display), "gdm-user-session"); - } - - static gboolean - add_session_record (GdmManager *manager, - GdmSession *session, - GPid pid, - SessionRecord record) - { - const char *username; - char *display_name, *hostname, *display_device, *display_seat_id; -@@ -1129,6 +1142,21 @@ open_temporary_reauthentication_channel (GdmManager *self, +@@ -1077,6 +1090,21 @@ open_temporary_reauthentication_channel (GdmManager *self, return g_strdup (address); } @@ -203,7 +118,7 @@ index e1bc62d7..08c3cc17 100644 static gboolean is_session_graphical (const char *session_id) { -@@ -1237,6 +1265,14 @@ gdm_manager_handle_open_reauthentication_channel (GdmDBusManager *manager +@@ -1188,6 +1216,14 @@ gdm_manager_handle_open_reauthentication_channel (GdmDBusManager *manager return TRUE; } @@ -219,37 +134,10 @@ index e1bc62d7..08c3cc17 100644 g_debug ("GdmManager: looking for login screen session for user %s on seat %s", username, seat_id); session = find_session_for_user_on_seat (self, diff --git a/data/gdm.schemas.in b/data/gdm.schemas.in -index a1035f95..929d13d9 100644 +index a1035f9..929d13d 100644 --- a/data/gdm.schemas.in +++ b/data/gdm.schemas.in -@@ -112,33 +112,38 @@ - - xdmcp/DisplaysPerHost - i - 1 - - - xdmcp/Port - i - 177 - - - xdmcp/HonorIndirect - b - true - - - xdmcp/MaxWaitIndirect - i - 30 - - - xdmcp/PingIntervalSeconds - i - 0 - - - xdmcp/Willing +@@ -139,6 +139,11 @@ s @gdmconfdir@/Xwilling @@ -262,5 +150,5 @@ index a1035f95..929d13d9 100644 -- -2.37.3 +2.51.0 diff --git a/SOURCES/0001-session-record-Rework-wtmp-utmp-btmp-fields.patch b/SOURCES/0001-session-record-Rework-wtmp-utmp-btmp-fields.patch new file mode 100644 index 0000000..8889881 --- /dev/null +++ b/SOURCES/0001-session-record-Rework-wtmp-utmp-btmp-fields.patch @@ -0,0 +1,350 @@ +From 161ce350f8acd18ad49ca880667c1f90f2b55d93 Mon Sep 17 00:00:00 2001 +From: Adrian Vovk +Date: Wed, 12 Nov 2025 14:59:03 -0500 +Subject: [PATCH] session-record: Rework wtmp/utmp/btmp fields + +This reworks the logic we use when setting the various fields in the +wtmp/utmp/btmp records. + +Previously, we'd set the hostname to "[]:" in +the X11 case and to "login screen" on Wayland. We'd also set the "line" +(which is supposed to contain the TTY) to the TTY on X11 but the seat ID +on Wayland. And finally we simply wouldn't write these records for +remote Wayland sessions. + +Now: the hostname is always just a remote IP address for remote +sessions, and the string "local" for local sessions. The "line" is also +consistently set to the TTY, or the seat ID if no TTY is available, or +the string "headless" if no seat is set and the session is headless. +Also Wayland remote sessions are supported properly now. + +This also happens to get rid of this code's dependency on X11: we no +longer consider the X11 display name + +Co-authored-by: Joan Torres Lopez +--- + daemon/gdm-manager.c | 47 ++++---------- + daemon/gdm-session-record.c | 123 ++++++++++++++---------------------- + daemon/gdm-session-record.h | 13 ++-- + 3 files changed, 64 insertions(+), 119 deletions(-) + +diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c +index 05bbb96..681c9f6 100644 +--- a/daemon/gdm-manager.c ++++ b/daemon/gdm-manager.c +@@ -659,68 +659,46 @@ add_session_record (GdmManager *manager, + SessionRecord record) + { + const char *username; +- char *display_name, *hostname, *display_device, *display_seat_id; +- gboolean recorded = FALSE; + +- display_name = NULL; +- username = NULL; +- hostname = NULL; +- display_device = NULL; +- display_seat_id = NULL; ++ g_autofree char *hostname = NULL; ++ g_autofree char *display_device = NULL; ++ g_autofree char *display_seat_id = NULL; + + username = gdm_session_get_username (session); +- +- if (username == NULL) { +- goto out; +- } ++ if (username == NULL) ++ return FALSE; + + g_object_get (G_OBJECT (session), +- "display-name", &display_name, + "display-hostname", &hostname, + "display-device", &display_device, + "display-seat-id", &display_seat_id, + NULL); + +- if (display_name == NULL && display_device == NULL) { +- if (display_seat_id == NULL) +- goto out; +- +- display_name = g_strdup ("login screen"); +- display_device = g_strdup (display_seat_id); +- } +- + switch (record) { + case SESSION_RECORD_LOGIN: + gdm_session_record_login (pid, + username, + hostname, +- display_name, +- display_device); ++ display_device, ++ display_seat_id); + break; + case SESSION_RECORD_LOGOUT: + gdm_session_record_logout (pid, + username, + hostname, +- display_name, +- display_device); ++ display_device, ++ display_seat_id); + break; + case SESSION_RECORD_FAILED: + gdm_session_record_failed (pid, + username, + hostname, +- display_name, +- display_device); ++ display_device, ++ display_seat_id); + break; + } + +- recorded = TRUE; +-out: +- g_free (display_name); +- g_free (hostname); +- g_free (display_device); +- g_free (display_seat_id); +- +- return recorded; ++ return FALSE; + } + + static GdmSession * +@@ -2035,7 +2013,6 @@ on_user_session_started (GdmSession *session, + GdmManager *manager) + { + g_debug ("GdmManager: session started %d", pid); +- add_session_record (manager, session, pid, SESSION_RECORD_LOGIN); + } + + static void +diff --git a/daemon/gdm-session-record.c b/daemon/gdm-session-record.c +index 310323b..3b549d8 100644 +--- a/daemon/gdm-session-record.c ++++ b/daemon/gdm-session-record.c +@@ -111,79 +111,52 @@ record_set_pid (UTMP *u, + + static void + record_set_host (UTMP *u, +- const char *x11_display_name, +- const char *host_name) ++ const char *remote_host) + { +- char *hostname; +- ++ const char *hostname; + #if defined(HAVE_UT_UT_HOST) +- hostname = NULL; +- +- /* +- * Set ut_host to hostname:$DISPLAY if remote, otherwise set +- * to $DISPLAY +- */ +- if (host_name != NULL +- && x11_display_name != NULL +- && g_str_has_prefix (x11_display_name, ":")) { +- hostname = g_strdup_printf ("%s%s", host_name, x11_display_name); +- } else { +- hostname = g_strdup (x11_display_name); +- } +- +- if (hostname != NULL) { +- memccpy (u->ut_host, hostname, '\0', sizeof (u->ut_host)); +- g_debug ("using ut_host %.*s", (int) sizeof (u->ut_host), u->ut_host); ++ if (remote_host != NULL) ++ hostname = remote_host; ++ else ++ hostname = "local"; ++ memccpy (u->ut_host, hostname, '\0', sizeof (u->ut_host)); ++ g_debug ("using ut_host %.*s", (int) sizeof (u->ut_host), u->ut_host); + #ifdef HAVE_UT_UT_SYSLEN +- u->ut_syslen = MIN (strlen (hostname), sizeof (u->ut_host)); ++ u->ut_syslen = MIN (strlen (hostname), sizeof (u->ut_host)); + #endif +- g_free (hostname); +- } + #endif + } + + static void + record_set_line (UTMP *u, +- const char *display_device, +- const char *x11_display_name) ++ const char *tty, ++ const char *seat_id) + { +- /* +- * Set ut_line to the device name associated with this display +- * but remove the "/dev/" prefix. If no device, then use the +- * $DISPLAY value. +- */ +- if (display_device != NULL && g_str_has_prefix (display_device, "/dev/")) { +- memccpy (u->ut_line, +- display_device + strlen ("/dev/"), +- '\0', +- sizeof (u->ut_line)); +- } else if (display_device != NULL && g_str_has_prefix (display_device, "seat")) { +- memccpy (u->ut_line, +- display_device, +- '\0', +- sizeof (u->ut_line)); +- } else if (x11_display_name != NULL) { +- memccpy (u->ut_line, +- x11_display_name, +- '\0', +- sizeof (u->ut_line)); +- } +- ++ const char *line; ++ ++ if (tty != NULL) { ++ if (g_str_has_prefix (tty, "/dev/")) ++ line = tty + strlen("/dev/"); ++ else ++ line = tty; ++ } else if (seat_id != NULL) ++ line = seat_id; ++ else ++ line = "headless"; ++ ++ memccpy (u->ut_line, line, '\0', sizeof (u->ut_line)); + g_debug ("using ut_line %.*s", (int) sizeof (u->ut_line), u->ut_line); + } + + void +-gdm_session_record_login (GPid session_pid, +- const char *user_name, +- const char *host_name, +- const char *x11_display_name, +- const char *display_device) ++gdm_session_record_login (GPid session_pid, ++ const char *user_name, ++ const char *host_name, ++ const char *tty, ++ const char *seat_id) + { + UTMP session_record = { 0 }; + +- if (x11_display_name == NULL) +- x11_display_name = display_device; +- + record_set_username (&session_record, user_name); + + g_debug ("Writing login record"); +@@ -195,8 +168,8 @@ gdm_session_record_login (GPid session_pid, + + record_set_timestamp (&session_record); + record_set_pid (&session_record, session_pid); +- record_set_host (&session_record, x11_display_name, host_name); +- record_set_line (&session_record, display_device, x11_display_name); ++ record_set_host (&session_record, host_name); ++ record_set_line (&session_record, tty, seat_id); + + /* Handle wtmp */ + g_debug ("Writing wtmp session record to " GDM_NEW_SESSION_RECORDS_FILE); +@@ -224,16 +197,15 @@ gdm_session_record_login (GPid session_pid, + } + + void +-gdm_session_record_logout (GPid session_pid, +- const char *user_name, +- const char *host_name, +- const char *x11_display_name, +- const char *display_device) ++gdm_session_record_logout (GPid session_pid, ++ const char *user_name, ++ const char *host_name, ++ const char *tty, ++ const char *seat_id) + { + UTMP session_record = { 0 }; + +- if (x11_display_name == NULL) +- x11_display_name = display_device; ++ record_set_username (&session_record, user_name); + + g_debug ("Writing logout record"); + +@@ -244,8 +216,8 @@ gdm_session_record_logout (GPid session_pid, + + record_set_timestamp (&session_record); + record_set_pid (&session_record, session_pid); +- record_set_host (&session_record, x11_display_name, host_name); +- record_set_line (&session_record, display_device, x11_display_name); ++ record_set_host (&session_record, host_name); ++ record_set_line (&session_record, tty, seat_id); + + /* Handle wtmp */ + g_debug ("Writing wtmp logout record to " GDM_NEW_SESSION_RECORDS_FILE); +@@ -269,17 +241,14 @@ gdm_session_record_logout (GPid session_pid, + } + + void +-gdm_session_record_failed (GPid session_pid, +- const char *user_name, +- const char *host_name, +- const char *x11_display_name, +- const char *display_device) ++gdm_session_record_failed (GPid session_pid, ++ const char *user_name, ++ const char *host_name, ++ const char *tty, ++ const char *seat_id) + { + UTMP session_record = { 0 }; + +- if (x11_display_name == NULL) +- x11_display_name = display_device; +- + record_set_username (&session_record, user_name); + + g_debug ("Writing failed session attempt record"); +@@ -291,8 +260,8 @@ gdm_session_record_failed (GPid session_pid, + + record_set_timestamp (&session_record); + record_set_pid (&session_record, session_pid); +- record_set_host (&session_record, x11_display_name, host_name); +- record_set_line (&session_record, display_device, x11_display_name); ++ record_set_host (&session_record, host_name); ++ record_set_line (&session_record, tty, seat_id); + + #if defined(HAVE_UPDWTMPX) || defined(HAVE_UPDWTMP) + /* Handle btmp */ +diff --git a/daemon/gdm-session-record.h b/daemon/gdm-session-record.h +index 3c53268..bbe323a 100644 +--- a/daemon/gdm-session-record.h ++++ b/daemon/gdm-session-record.h +@@ -29,21 +29,20 @@ void + gdm_session_record_login (GPid session_pid, + const char *user_name, + const char *host_name, +- const char *x11_display_name, +- const char *display_device); ++ const char *tty, ++ const char *seat_id); + void + gdm_session_record_logout (GPid session_pid, + const char *user_name, + const char *host_name, +- const char *x11_display_name, +- const char *display_device); ++ const char *tty, ++ const char *seat_id); + void + gdm_session_record_failed (GPid session_pid, + const char *user_name, + const char *host_name, +- const char *x11_display_name, +- const char *display_device); +- ++ const char *tty, ++ const char *seat_id); + + G_END_DECLS + +-- +2.51.0 + diff --git a/SPECS/gdm.spec b/SPECS/gdm.spec index 0696d9c..6e32efb 100644 --- a/SPECS/gdm.spec +++ b/SPECS/gdm.spec @@ -11,7 +11,7 @@ Name: gdm Epoch: 1 Version: 40.1 -Release: 38%{?dist} +Release: 42%{?dist} Summary: The GNOME Display Manager License: GPLv2+ @@ -70,6 +70,10 @@ Patch140001: 0001-session-Fix-memory-leak-on-new-outside-connection.patch Patch150001: 0001-libgdm-Don-t-collect-twice-sessions-on-usr-share.patch +Patch160001: 0001-Revert-hack-that-quits-plymouth-late.patch + +Patch170001: 0001-session-record-Rework-wtmp-utmp-btmp-fields.patch + # Non-upstreamable workarounds Patch66610001: 0001-data-reap-gdm-sessions-on-shutdown.patch @@ -373,6 +377,22 @@ 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 + +* Tue Nov 18 2025 Joan Torres Lopez - 40.1-40 +- Now Plymouth will quit even when no monitor is connected. + Resolves: RHEL-129215 + +* Fri Oct 31 2025 Joan Torres Lopez - 40.1-39 +- Fix Handle GDM_SUPPORTED_SESSION_TYPES being unset + Resolves: RHEL-117034 + * Thu Oct 2 2025 Joan Torres Lopez - 40.1-38 - Fix issue on conflicting sessions when they are remote Resolves: RHEL-123357