|
|
f83012 |
From 15a19ac7856c539aa9cfbf76997d18b0275aae35 Mon Sep 17 00:00:00 2001
|
|
|
f83012 |
From: Iain Lane <iainl@gnome.org>
|
|
|
f83012 |
Date: Mon, 4 Feb 2019 15:12:38 +0000
|
|
|
f83012 |
Subject: [PATCH 4/4] GdmManager: Don't perform timed login if session gets
|
|
|
f83012 |
started
|
|
|
f83012 |
|
|
|
f83012 |
At the moment it's possible for the login screen to initiate
|
|
|
f83012 |
a timed login operation shortly after a user successfully starts
|
|
|
f83012 |
their session.
|
|
|
f83012 |
|
|
|
f83012 |
GDM won't complete the timed login operation, since a session is
|
|
|
f83012 |
already running, but will erroneously overwrite the username
|
|
|
f83012 |
associated with the session, misattributing the users session
|
|
|
f83012 |
to the timed login user.
|
|
|
f83012 |
|
|
|
f83012 |
Later, attempts to log in as the timed user will instead unlock the
|
|
|
f83012 |
session for the other user, since that session is now associated
|
|
|
f83012 |
with the timed login user.
|
|
|
f83012 |
|
|
|
f83012 |
This commit refuses timed login requests on sessions that are
|
|
|
f83012 |
already running, so the username doesn't get corrupted.
|
|
|
f83012 |
|
|
|
f83012 |
CVE-2019-3825
|
|
|
f83012 |
|
|
|
f83012 |
Closes https://gitlab.gnome.org/GNOME/gdm/issues/460
|
|
|
f83012 |
---
|
|
|
f83012 |
daemon/gdm-manager.c | 8 ++++++++
|
|
|
f83012 |
1 file changed, 8 insertions(+)
|
|
|
f83012 |
|
|
|
f83012 |
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
|
|
|
f83012 |
index 0cc06a978..056560b20 100644
|
|
|
f83012 |
--- a/daemon/gdm-manager.c
|
|
|
f83012 |
+++ b/daemon/gdm-manager.c
|
|
|
f83012 |
@@ -2116,60 +2116,68 @@ on_session_client_ready_for_session_to_start (GdmSession *session,
|
|
|
f83012 |
} else {
|
|
|
f83012 |
g_debug ("GdmManager: Will start session when ready and told");
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
waiting_to_start_user_session = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (session),
|
|
|
f83012 |
"waiting-to-start"));
|
|
|
f83012 |
|
|
|
f83012 |
g_object_set_data (G_OBJECT (session),
|
|
|
f83012 |
"start-when-ready",
|
|
|
f83012 |
GINT_TO_POINTER (client_is_ready));
|
|
|
f83012 |
|
|
|
f83012 |
if (client_is_ready && waiting_to_start_user_session) {
|
|
|
f83012 |
start_user_session_if_ready (manager, session, service_name);
|
|
|
f83012 |
}
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
static void
|
|
|
f83012 |
on_session_client_connected (GdmSession *session,
|
|
|
f83012 |
GCredentials *credentials,
|
|
|
f83012 |
GPid pid_of_client,
|
|
|
f83012 |
GdmManager *manager)
|
|
|
f83012 |
{
|
|
|
f83012 |
GdmDisplay *display;
|
|
|
f83012 |
char *username;
|
|
|
f83012 |
int delay;
|
|
|
f83012 |
gboolean enabled;
|
|
|
f83012 |
gboolean allow_timed_login = FALSE;
|
|
|
f83012 |
|
|
|
f83012 |
g_debug ("GdmManager: client with pid %d connected", (int) pid_of_client);
|
|
|
f83012 |
|
|
|
f83012 |
+ if (gdm_session_is_running (session)) {
|
|
|
f83012 |
+ const char *session_username;
|
|
|
f83012 |
+ session_username = gdm_session_get_username (session);
|
|
|
f83012 |
+ g_debug ("GdmManager: ignoring connection, since session already running (for user %s)",
|
|
|
f83012 |
+ session_username);
|
|
|
f83012 |
+ return;
|
|
|
f83012 |
+ }
|
|
|
f83012 |
+
|
|
|
f83012 |
display = get_display_for_user_session (session);
|
|
|
f83012 |
|
|
|
f83012 |
if (display == NULL) {
|
|
|
f83012 |
return;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
if (!display_is_on_seat0 (display)) {
|
|
|
f83012 |
return;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
#ifdef WITH_PLYMOUTH
|
|
|
f83012 |
if (manager->priv->plymouth_is_running) {
|
|
|
f83012 |
plymouth_quit_with_transition ();
|
|
|
f83012 |
manager->priv->plymouth_is_running = FALSE;
|
|
|
f83012 |
}
|
|
|
f83012 |
#endif
|
|
|
f83012 |
|
|
|
f83012 |
g_object_get (G_OBJECT (display), "allow-timed-login", &allow_timed_login, NULL);
|
|
|
f83012 |
|
|
|
f83012 |
if (!allow_timed_login) {
|
|
|
f83012 |
return;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
enabled = get_timed_login_details (manager, &username, &delay);
|
|
|
f83012 |
|
|
|
f83012 |
if (! enabled) {
|
|
|
f83012 |
return;
|
|
|
f83012 |
}
|
|
|
f83012 |
|
|
|
f83012 |
gdm_session_set_timed_login_details (session, username, delay);
|
|
|
f83012 |
--
|
|
|
f83012 |
2.21.0
|
|
|
f83012 |
|