Changeset View
Changeset View
Standalone View
Standalone View
x11/gdm/files/patch-daemon_gdm-manager.c
$OpenBSD: patch-daemon_gdm-manager_c,v 1.14 2017/05/10 10:18:15 ajacoutot Exp $ | $OpenBSD: patch-daemon_gdm-manager_c,v 1.24 2020/05/14 15:25:54 ajacoutot Exp $ | ||||
REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | ||||
From fcba1e1a5d556ce7b52101dbd2d1ba4a19469161 Mon Sep 17 00:00:00 2001 | |||||
From: Iain Lane <iain@orangesquash.org.uk> | |||||
Date: Fri, 5 Jan 2018 11:53:34 +0000 | |||||
Subject: [PATCH] manager: Find user's current graphical session, not session of caller | |||||
REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | |||||
From 21905303afbd508f3bf599ad219c9209413c53a2 Mon Sep 17 00:00:00 2001 | From 21905303afbd508f3bf599ad219c9209413c53a2 Mon Sep 17 00:00:00 2001 | ||||
From: Ray Strode <rstrode@redhat.com> | From: Ray Strode <rstrode@redhat.com> | ||||
Date: Wed, 5 Apr 2017 12:11:20 -0400 | Date: Wed, 5 Apr 2017 12:11:20 -0400 | ||||
Subject: manager: stop transient greeter session when done with it | Subject: manager: stop transient greeter session when done with it | ||||
REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | ||||
From 22c332baaf8ad6d7082c5b01250bae70934c2fd1 Mon Sep 17 00:00:00 2001 | From 22c332baaf8ad6d7082c5b01250bae70934c2fd1 Mon Sep 17 00:00:00 2001 | ||||
From: Ray Strode <rstrode@redhat.com> | From: Ray Strode <rstrode@redhat.com> | ||||
Date: Tue, 4 Apr 2017 17:07:04 -0400 | Date: Tue, 4 Apr 2017 17:07:04 -0400 | ||||
Subject: manager: make sure we end up on a login screen | Subject: manager: make sure we end up on a login screen | ||||
REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | ||||
From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 | From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001 | ||||
From: Ray Strode <rstrode@redhat.com> | From: Ray Strode <rstrode@redhat.com> | ||||
Date: Fri, 12 Jun 2015 13:28:01 -0400 | Date: Fri, 12 Jun 2015 13:28:01 -0400 | ||||
Subject: drop consolekit support | Subject: drop consolekit support | ||||
REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit) | ||||
From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 | From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001 | ||||
From: Ray Strode <rstrode@redhat.com> | From: Ray Strode <rstrode@redhat.com> | ||||
Date: Fri, 12 Jun 2015 13:48:52 -0400 | Date: Fri, 12 Jun 2015 13:48:52 -0400 | ||||
Subject: require logind support | Subject: require logind support | ||||
Index: daemon/gdm-manager.c | |||||
--- daemon/gdm-manager.c.orig 2017-10-24 21:33:58.000000000 +0200 | --- daemon/gdm-manager.c.orig 2020-07-13 20:36:07 UTC | ||||
+++ daemon/gdm-manager.c 2018-01-14 13:33:21.588929000 +0100 | +++ daemon/gdm-manager.c | ||||
@@ -36,7 +36,9 @@ | @@ -36,7 +36,9 @@ | ||||
#include <act/act-user-manager.h> | #include <act/act-user-manager.h> | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
#include <systemd/sd-login.h> | #include <systemd/sd-login.h> | ||||
+#endif | +#endif | ||||
#include "gdm-common.h" | #include "gdm-common.h" | ||||
@@ -63,6 +65,15 @@ | @@ -61,9 +63,18 @@ | ||||
#define GDM_MANAGER_PATH GDM_DBUS_PATH "/Manager" | |||||
#define GDM_MANAGER_DISPLAYS_PATH GDM_DBUS_PATH "/Displays" | |||||
#define INITIAL_SETUP_USERNAME "gnome-initial-setup" | -#define INITIAL_SETUP_USERNAME "gnome-initial-setup" | ||||
+#define INITIAL_SETUP_USERNAME "_gnome-initial-setup" | |||||
#define ALREADY_RAN_INITIAL_SETUP_ON_THIS_BOOT GDM_RUN_DIR "/gdm.ran-initial-setup" | |||||
+#define CK_NAME "org.freedesktop.ConsoleKit" | +#define CK_NAME "org.freedesktop.ConsoleKit" | ||||
+#define CK_PATH "/org/freedesktop/ConsoleKit" | +#define CK_PATH "/org/freedesktop/ConsoleKit" | ||||
+#define CK_INTERFACE "org.freedesktop.ConsoleKit" | +#define CK_INTERFACE "org.freedesktop.ConsoleKit" | ||||
+ | + | ||||
+#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" | +#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager" | ||||
+#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" | +#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager" | ||||
+#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" | +#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat" | ||||
+#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" | +#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session" | ||||
+ | + | ||||
typedef struct | typedef struct | ||||
{ | { | ||||
GdmManager *manager; | GdmManager *manager; | ||||
@@ -206,9 +217,10 @@ plymouth_quit_without_transition (void) | @@ -205,9 +216,10 @@ plymouth_quit_without_transition (void) | ||||
} | } | ||||
#endif | #endif | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
static char * | static char * | ||||
-get_session_id_for_pid (pid_t pid, | -get_session_id_for_pid (pid_t pid, | ||||
- GError **error) | - GError **error) | ||||
+get_session_id_for_pid_systemd (pid_t pid, | +get_session_id_for_pid_systemd (pid_t pid, | ||||
+ GError **error) | + GError **error) | ||||
{ | { | ||||
char *session, *gsession; | char *session, *gsession; | ||||
int ret; | int ret; | ||||
@@ -233,11 +245,61 @@ get_session_id_for_pid (pid_t pid, | @@ -232,11 +244,61 @@ get_session_id_for_pid (pid_t pid, | ||||
return NULL; | return NULL; | ||||
} | } | ||||
} | } | ||||
+#endif | +#endif | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
+static char * | +static char * | ||||
+get_session_id_for_pid_consolekit (GDBusConnection *connection, | +get_session_id_for_pid_consolekit (GDBusConnection *connection, | ||||
▲ Show 20 Lines • Show All 48 Lines • ▼ Show 20 Lines | |||||
- uid_t *uid, | - uid_t *uid, | ||||
- GError **error) | - GError **error) | ||||
+get_uid_for_systemd_session_id (const char *session_id, | +get_uid_for_systemd_session_id (const char *session_id, | ||||
+ uid_t *uid, | + uid_t *uid, | ||||
+ GError **error) | + GError **error) | ||||
{ | { | ||||
int ret; | int ret; | ||||
@@ -254,8 +316,62 @@ get_uid_for_session_id (const char *session_id, | @@ -253,8 +315,62 @@ get_uid_for_session_id (const char *session_id, | ||||
return TRUE; | return TRUE; | ||||
} | } | ||||
+#endif | +#endif | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
static gboolean | static gboolean | ||||
+get_uid_for_consolekit_session_id (GDBusConnection *connection, | +get_uid_for_consolekit_session_id (GDBusConnection *connection, | ||||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
+ | + | ||||
+ return FALSE; | + return FALSE; | ||||
+} | +} | ||||
+ | + | ||||
+static gboolean | +static gboolean | ||||
lookup_by_session_id (const char *id, | lookup_by_session_id (const char *id, | ||||
GdmDisplay *display, | GdmDisplay *display, | ||||
gpointer user_data) | gpointer user_data) | ||||
@@ -267,11 +383,51 @@ lookup_by_session_id (const char *id, | @@ -266,11 +382,51 @@ lookup_by_session_id (const char *id, | ||||
return g_strcmp0 (current, looking_for) == 0; | return g_strcmp0 (current, looking_for) == 0; | ||||
} | } | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
static gboolean | static gboolean | ||||
-is_login_session (GdmManager *self, | -is_login_session (GdmManager *self, | ||||
- const char *session_id, | - const char *session_id, | ||||
- GError **error) | - GError **error) | ||||
Show All 38 Lines | |||||
+static gboolean | +static gboolean | ||||
+is_systemd_login_session (GdmManager *self, | +is_systemd_login_session (GdmManager *self, | ||||
+ const char *session_id, | + const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
+{ | +{ | ||||
char *session_class = NULL; | char *session_class = NULL; | ||||
int ret; | int ret; | ||||
@@ -295,12 +451,33 @@ is_login_session (GdmManager *self, | @@ -294,29 +450,49 @@ is_login_session (GdmManager *self, | ||||
g_free (session_class); | g_free (session_class); | ||||
return TRUE; | return TRUE; | ||||
} | } | ||||
+#endif | +#endif | ||||
static gboolean | static gboolean | ||||
-activate_session_id (GdmManager *manager, | -session_unlock (GdmManager *manager, | ||||
- const char *seat_id, | - const char *ssid) | ||||
- const char *session_id) | |||||
+is_login_session (GdmManager *self, | +is_login_session (GdmManager *self, | ||||
+ GDBusConnection *connection, | + GDBusConnection *connection, | ||||
+ const char *session_id, | + const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
{ | { | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
+ if (LOGIND_RUNNING()) { | + if (LOGIND_RUNNING()) { | ||||
+ return is_systemd_login_session (self, session_id, error); | + return is_systemd_login_session (self, session_id, error); | ||||
Show All 11 Lines | |||||
+static gboolean | +static gboolean | ||||
+activate_session_id_for_systemd (GdmManager *manager, | +activate_session_id_for_systemd (GdmManager *manager, | ||||
+ const char *seat_id, | + const char *seat_id, | ||||
+ const char *session_id) | + const char *session_id) | ||||
+{ | +{ | ||||
GError *error = NULL; | GError *error = NULL; | ||||
GVariant *reply; | GVariant *reply; | ||||
@@ -326,16 +503,75 @@ activate_session_id (GdmManager *manager, | - g_debug ("Unlocking session %s", ssid); | ||||
- | |||||
reply = g_dbus_connection_call_sync (manager->priv->connection, | |||||
"org.freedesktop.login1", | |||||
"/org/freedesktop/login1", | |||||
"org.freedesktop.login1.Manager", | |||||
- "UnlockSession", | |||||
- g_variant_new ("(s)", ssid), | |||||
+ "ActivateSessionOnSeat", | |||||
+ g_variant_new ("(ss)", session_id, seat_id), | |||||
NULL, /* expected reply */ | |||||
G_DBUS_CALL_FLAGS_NONE, | |||||
-1, | |||||
NULL, | |||||
&error); | |||||
if (reply == NULL) { | |||||
- g_debug ("GdmManager: logind 'UnlockSession' %s raised:\n %s\n\n", | |||||
+ g_debug ("GdmManager: logind 'ActivateSessionOnSeat' %s raised:\n %s\n\n", | |||||
g_dbus_error_get_remote_error (error), error->message); | |||||
g_error_free (error); | |||||
return FALSE; | |||||
@@ -326,7 +502,119 @@ session_unlock (GdmManager *manager, | |||||
return TRUE; | return TRUE; | ||||
} | } | ||||
+#endif | +#endif | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
static gboolean | +static gboolean | ||||
-session_unlock (GdmManager *manager, | |||||
- const char *ssid) | |||||
+activate_session_id_for_ck (GdmManager *manager, | +activate_session_id_for_ck (GdmManager *manager, | ||||
+ const char *seat_id, | + const char *seat_id, | ||||
+ const char *session_id) | + const char *session_id) | ||||
{ | +{ | ||||
GError *error = NULL; | + GError *error = NULL; | ||||
GVariant *reply; | + GVariant *reply; | ||||
+ | |||||
- g_debug ("Unlocking session %s", ssid); | |||||
+ reply = g_dbus_connection_call_sync (manager->priv->connection, | + reply = g_dbus_connection_call_sync (manager->priv->connection, | ||||
+ CK_NAME, | + CK_NAME, | ||||
+ seat_id, | + seat_id, | ||||
+ "org.freedesktop.ConsoleKit.Seat", | + "org.freedesktop.ConsoleKit.Seat", | ||||
+ "ActivateSession", | + "ActivateSession", | ||||
+ g_variant_new ("(o)", session_id), | + g_variant_new ("(o)", session_id), | ||||
+ NULL, /* expected reply */ | + NULL, /* expected reply */ | ||||
+ G_DBUS_CALL_FLAGS_NONE, | + G_DBUS_CALL_FLAGS_NONE, | ||||
+ -1, | + -1, | ||||
+ NULL, | + NULL, | ||||
+ &error); | + &error); | ||||
+ if (reply == NULL) { | + if (reply == NULL) { | ||||
+ g_debug ("GdmManager: ConsoleKit %s raised:\n %s\n\n", | + g_debug ("GdmManager: ConsoleKit %s raised:\n %s\n\n", | ||||
+ g_dbus_error_get_remote_error (error), error->message); | + g_dbus_error_get_remote_error (error), error->message); | ||||
+ g_error_free (error); | + g_error_free (error); | ||||
+ | |||||
+ /* It is very likely that the "error" just reported is | + /* It is very likely that the "error" just reported is | ||||
+ * that the session is already active. Unfortunately, | + * that the session is already active. Unfortunately, | ||||
+ * ConsoleKit doesn't use proper error codes and it | + * ConsoleKit doesn't use proper error codes and it | ||||
+ * translates the error message, so we have no real way | + * translates the error message, so we have no real way | ||||
+ * to detect this case... | + * to detect this case... | ||||
+ */ | + */ | ||||
+ return TRUE; | + return TRUE; | ||||
+ } | + } | ||||
Show All 14 Lines | |||||
+ if (LOGIND_RUNNING()) { | + if (LOGIND_RUNNING()) { | ||||
+ return activate_session_id_for_systemd (manager, seat_id, session_id); | + return activate_session_id_for_systemd (manager, seat_id, session_id); | ||||
+ } | + } | ||||
+#endif | +#endif | ||||
+ | + | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
+ return activate_session_id_for_ck (manager, seat_id, session_id); | + return activate_session_id_for_ck (manager, seat_id, session_id); | ||||
+#else | +#else | ||||
+ return FALSE; | + return FALSE; | ||||
+#endif | +#endif | ||||
+} | +} | ||||
+ | + | ||||
+#ifdef WITH_SYSTEMD | |||||
+static gboolean | |||||
+session_unlock_for_systemd (GdmManager *manager, | |||||
+ const char *ssid) | |||||
+{ | |||||
+ GError *error = NULL; | |||||
+ GVariant *reply; | |||||
+ | |||||
reply = g_dbus_connection_call_sync (manager->priv->connection, | |||||
"org.freedesktop.login1", | |||||
"/org/freedesktop/login1", | |||||
@@ -358,7 +594,60 @@ session_unlock (GdmManager *manager, | |||||
return TRUE; | |||||
} | |||||
+#endif | |||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
+static gboolean | +static gboolean | ||||
+session_unlock_for_ck (GdmManager *manager, | +session_unlock_for_ck (GdmManager *manager, | ||||
+ const char *ssid) | + const char *ssid) | ||||
+{ | +{ | ||||
+ GError *error = NULL; | + GError *error = NULL; | ||||
+ GVariant *reply; | + GVariant *reply; | ||||
+ | + | ||||
Show All 39 Lines | |||||
+#else | +#else | ||||
+ return TRUE; | + return TRUE; | ||||
+#endif | +#endif | ||||
+} | +} | ||||
+ | + | ||||
static GdmSession * | static GdmSession * | ||||
find_session_for_user_on_seat (GdmManager *manager, | find_session_for_user_on_seat (GdmManager *manager, | ||||
const char *username, | const char *username, | ||||
@@ -389,11 +678,44 @@ find_session_for_user_on_seat (GdmManager *manager, | @@ -374,11 +662,44 @@ find_session_for_user_on_seat (GdmManager *manager, | ||||
return NULL; | return NULL; | ||||
} | } | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
static gboolean | static gboolean | ||||
-is_remote_session (GdmManager *self, | -is_remote_session (GdmManager *self, | ||||
- const char *session_id, | - const char *session_id, | ||||
- GError **error) | - GError **error) | ||||
Show All 31 Lines | |||||
+static gboolean | +static gboolean | ||||
+is_systemd_remote_session (GdmManager *self, | +is_systemd_remote_session (GdmManager *self, | ||||
+ const char *session_id, | + const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
+{ | +{ | ||||
char *seat; | char *seat; | ||||
int ret; | int ret; | ||||
gboolean is_remote; | gboolean is_remote; | ||||
@@ -418,10 +740,31 @@ is_remote_session (GdmManager *self, | @@ -403,10 +724,12 @@ is_remote_session (GdmManager *self, | ||||
return is_remote; | return is_remote; | ||||
} | } | ||||
+#endif | +#endif | ||||
+#ifdef WITH_SYSTEMD | |||||
static char * | |||||
-get_seat_id_for_session_id (const char *session_id, | |||||
- GError **error) | |||||
+get_seat_id_for_systemd_session_id (const char *session_id, | |||||
+ GError **error) | |||||
{ | |||||
int ret; | |||||
char *seat, *out_seat; | |||||
@@ -431,11 +754,85 @@ get_seat_id_for_session_id (const char *session_id, | |||||
return out_seat; | |||||
} | |||||
+#endif | |||||
+static gboolean | +static gboolean | ||||
+is_remote_session (GdmManager *self, | +is_remote_session (GdmManager *self, | ||||
+ GDBusConnection *connection, | + GDBusConnection *connection, | ||||
+ const char *session_id, | + const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
+{ | +{ | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
+ if (LOGIND_RUNNING()) { | + if (LOGIND_RUNNING()) { | ||||
+ return is_systemd_remote_session (self, session_id, error); | + return is_systemd_remote_session (self, session_id, error); | ||||
+ } | + } | ||||
+#endif | +#endif | ||||
+ | + | ||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
+ return is_consolekit_remote_session (self, connection, session_id, error); | + return is_consolekit_remote_session (self, connection, session_id, error); | ||||
+#endif | +#endif | ||||
+ | + | ||||
+ return FALSE; | + return FALSE; | ||||
+} | +} | ||||
+ | + | ||||
+#ifdef WITH_SYSTEMD | |||||
static char * | |||||
-get_seat_id_for_session_id (const char *session_id, | |||||
- GError **error) | |||||
+get_seat_id_for_systemd_session_id (const char *session_id, | |||||
+ GError **error) | |||||
{ | |||||
int ret; | |||||
char *seat, *out_seat; | |||||
@@ -446,11 +789,62 @@ get_seat_id_for_session_id (const char *session_id, | |||||
return out_seat; | |||||
} | |||||
+#endif | |||||
+#ifdef WITH_CONSOLE_KIT | +#ifdef WITH_CONSOLE_KIT | ||||
static char * | static char * | ||||
-get_tty_for_session_id (const char *session_id, | -get_tty_for_session_id (const char *session_id, | ||||
- GError **error) | - GError **error) | ||||
+get_seat_id_for_consolekit_session_id (GDBusConnection *connection, | +get_seat_id_for_consolekit_session_id (GDBusConnection *connection, | ||||
+ const char *session_id, | + const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
{ | { | ||||
Show All 40 Lines | |||||
+ return NULL; | + return NULL; | ||||
+} | +} | ||||
+ | + | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
+static char * | +static char * | ||||
+get_tty_for_systemd_session_id (const char *session_id, | +get_tty_for_systemd_session_id (const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
+{ | +{ | ||||
+ | |||||
+ | |||||
+ | |||||
+ | |||||
int ret; | int ret; | ||||
char *tty, *out_tty; | char *tty, *out_tty; | ||||
@@ -473,7 +867,21 @@ get_tty_for_session_id (const char *session_id, | @@ -458,7 +855,21 @@ get_tty_for_session_id (const char *session_id, | ||||
return out_tty; | return out_tty; | ||||
} | } | ||||
+#endif | +#endif | ||||
+static char * | +static char * | ||||
+get_tty_for_session_id (const char *session_id, | +get_tty_for_session_id (const char *session_id, | ||||
+ GError **error) | + GError **error) | ||||
+{ | +{ | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
+ if (LOGIND_RUNNING()) { | + if (LOGIND_RUNNING()) { | ||||
+ return get_tty_for_systemd_session_id (session_id, error); | + return get_tty_for_systemd_session_id (session_id, error); | ||||
+ } | + } | ||||
+#endif | +#endif | ||||
+ | + | ||||
+ return NULL; | + return NULL; | ||||
+} | +} | ||||
+ | + | ||||
static void | static void | ||||
get_display_and_details_for_bus_sender (GdmManager *self, | get_display_and_details_for_bus_sender (GdmManager *self, | ||||
GDBusConnection *connection, | GDBusConnection *connection, | ||||
@@ -516,7 +924,7 @@ get_display_and_details_for_bus_sender (GdmManager | @@ -501,11 +912,10 @@ get_display_and_details_for_bus_sender (GdmManager | ||||
goto out; | goto out; | ||||
} | } | ||||
- session_id = get_session_id_for_pid (pid, &error); | - ret = gdm_find_display_session (pid, caller_uid, &session_id, &error); | ||||
+ session_id = get_session_id_for_pid (connection, pid, &error); | + session_id = get_session_id_for_pid (connection, pid, &error); | ||||
if (session_id == NULL) { | - if (!ret) { | ||||
g_debug ("GdmManager: Error while retrieving session id for sender: %s", | - g_debug ("GdmManager: Unable to find display session for uid %d: %s", | ||||
@@ -530,7 +938,7 @@ get_display_and_details_for_bus_sender (GdmManager | - (int) caller_uid, | ||||
+ if (session_id == NULL) { | |||||
+ g_debug ("GdmManager: Error while retrieving session id for sender: %s", | |||||
error->message); | |||||
g_error_free (error); | |||||
goto out; | |||||
@@ -516,7 +926,7 @@ get_display_and_details_for_bus_sender (GdmManager | |||||
} | } | ||||
if (out_is_login_screen != NULL) { | if (out_is_login_screen != NULL) { | ||||
- *out_is_login_screen = is_login_session (self, session_id, &error); | - *out_is_login_screen = is_login_session (self, session_id, &error); | ||||
+ *out_is_login_screen = is_login_session (self, connection, session_id, &error); | + *out_is_login_screen = is_login_session (self, connection, session_id, &error); | ||||
if (error != NULL) { | if (error != NULL) { | ||||
g_debug ("GdmManager: Error while checking if sender is login screen: %s", | g_debug ("GdmManager: Error while checking if sender is login screen: %s", | ||||
@@ -540,7 +948,7 @@ get_display_and_details_for_bus_sender (GdmManager | @@ -526,7 +936,7 @@ get_display_and_details_for_bus_sender (GdmManager | ||||
} | } | ||||
} | } | ||||
- if (!get_uid_for_session_id (session_id, &session_uid, &error)) { | - if (!get_uid_for_session_id (session_id, &session_uid, &error)) { | ||||
+ if (!get_uid_for_session_id (connection, session_id, &session_uid, &error)) { | + if (!get_uid_for_session_id (connection, session_id, &session_uid, &error)) { | ||||
g_debug ("GdmManager: Error while retrieving uid for session: %s", | g_debug ("GdmManager: Error while retrieving uid for session: %s", | ||||
error->message); | error->message); | ||||
g_error_free (error); | g_error_free (error); | ||||
@@ -557,7 +965,7 @@ get_display_and_details_for_bus_sender (GdmManager | @@ -543,7 +953,7 @@ get_display_and_details_for_bus_sender (GdmManager | ||||
} | } | ||||
if (out_seat_id != NULL) { | if (out_seat_id != NULL) { | ||||
- *out_seat_id = get_seat_id_for_session_id (session_id, &error); | - *out_seat_id = get_seat_id_for_session_id (session_id, &error); | ||||
+ *out_seat_id = get_seat_id_for_session_id (connection, session_id, &error); | + *out_seat_id = get_seat_id_for_session_id (connection, session_id, &error); | ||||
if (error != NULL) { | if (error != NULL) { | ||||
g_debug ("GdmManager: Error while retrieving seat id for session: %s", | g_debug ("GdmManager: Error while retrieving seat id for session: %s", | ||||
@@ -567,7 +975,7 @@ get_display_and_details_for_bus_sender (GdmManager | @@ -553,7 +963,7 @@ get_display_and_details_for_bus_sender (GdmManager | ||||
} | } | ||||
if (out_is_remote != NULL) { | if (out_is_remote != NULL) { | ||||
- *out_is_remote = is_remote_session (self, session_id, &error); | - *out_is_remote = is_remote_session (self, session_id, &error); | ||||
+ *out_is_remote = is_remote_session (self, connection, session_id, &error); | + *out_is_remote = is_remote_session (self, connection, session_id, &error); | ||||
if (error != NULL) { | if (error != NULL) { | ||||
g_debug ("GdmManager: Error while retrieving remoteness for session: %s", | g_debug ("GdmManager: Error while retrieving remoteness for session: %s", | ||||
@@ -725,29 +1133,6 @@ out: | @@ -609,7 +1019,7 @@ switch_to_compatible_user_session (GdmManager *manager | ||||
if (existing_session != NULL) { | |||||
ssid_to_activate = gdm_session_get_session_id (existing_session); | |||||
if (seat_id != NULL) { | |||||
- res = gdm_activate_session_by_id (manager->priv->connection, seat_id, ssid_to_activate); | |||||
+ res = activate_session_id (manager, seat_id, ssid_to_activate); | |||||
if (! res) { | |||||
g_debug ("GdmManager: unable to activate session: %s", ssid_to_activate); | |||||
goto out; | |||||
@@ -711,29 +1121,6 @@ out: | |||||
return recorded; | return recorded; | ||||
} | } | ||||
-static GdmSession * | -static GdmSession * | ||||
-find_user_session_for_display (GdmManager *self, | -find_user_session_for_display (GdmManager *self, | ||||
- GdmDisplay *display) | - GdmDisplay *display) | ||||
-{ | -{ | ||||
- | - | ||||
Show All 13 Lines | |||||
- } | - } | ||||
- | - | ||||
- return NULL; | - return NULL; | ||||
-} | -} | ||||
- | - | ||||
static gboolean | static gboolean | ||||
gdm_manager_handle_register_display (GdmDBusManager *manager, | gdm_manager_handle_register_display (GdmDBusManager *manager, | ||||
GDBusMethodInvocation *invocation, | GDBusMethodInvocation *invocation, | ||||
@@ -787,7 +1172,7 @@ gdm_manager_handle_register_display (GdmDBusManager | @@ -773,7 +1160,7 @@ gdm_manager_handle_register_display (GdmDBusManager | ||||
} | } | ||||
} | } | ||||
- session = find_user_session_for_display (self, display); | - session = find_user_session_for_display (self, display); | ||||
+ session = get_user_session_for_display (display); | + session = get_user_session_for_display (display); | ||||
if (session != NULL) { | if (session != NULL) { | ||||
GPid pid; | GPid pid; | ||||
@@ -961,7 +1346,8 @@ on_reauthentication_client_rejected (GdmSession | @@ -980,7 +1367,8 @@ on_reauthentication_client_rejected (GdmSession | ||||
* same audit session, ignore it since it doesn't "own" the | * same audit session, ignore it since it doesn't "own" the | ||||
* reauthentication session | * reauthentication session | ||||
*/ | */ | ||||
- client_session_id = get_session_id_for_pid (pid_of_client, | - client_session_id = get_session_id_for_pid (pid_of_client, | ||||
+ client_session_id = get_session_id_for_pid (self->priv->connection, | + client_session_id = get_session_id_for_pid (self->priv->connection, | ||||
+ pid_of_client, | + pid_of_client, | ||||
NULL); | NULL); | ||||
session_id = g_object_get_data (G_OBJECT (session), "caller-session-id"); | session_id = g_object_get_data (G_OBJECT (session), "caller-session-id"); | ||||
@@ -1173,16 +1559,20 @@ static gboolean | @@ -1199,16 +1587,19 @@ static gboolean | ||||
display_is_on_seat0 (GdmDisplay *display) | display_is_on_seat0 (GdmDisplay *display) | ||||
{ | { | ||||
gboolean is_on_seat0 = TRUE; | gboolean is_on_seat0 = TRUE; | ||||
- char *seat_id = NULL; | - char *seat_id = NULL; | ||||
- g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); | - g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); | ||||
+#ifdef WITH_SYSTEMD | +#ifdef WITH_SYSTEMD | ||||
+ if (LOGIND_RUNNING()) { | + if (LOGIND_RUNNING()) { | ||||
+ char *seat_id = NULL; | + char *seat_id = NULL; | ||||
+ g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); | |||||
- if (g_strcmp0 (seat_id, "seat0") != 0) { | - if (g_strcmp0 (seat_id, "seat0") != 0) { | ||||
- is_on_seat0 = FALSE; | - is_on_seat0 = FALSE; | ||||
- } | - } | ||||
+ g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); | |||||
- g_free (seat_id); | |||||
+ if (g_strcmp0 (seat_id, "seat0") != 0) { | + if (g_strcmp0 (seat_id, "seat0") != 0) { | ||||
+ is_on_seat0 = FALSE; | + is_on_seat0 = FALSE; | ||||
+ } | + } | ||||
- g_free (seat_id); | |||||
- | |||||
+ g_free (seat_id); | + g_free (seat_id); | ||||
+ } | + } | ||||
+#endif | +#endif | ||||
return is_on_seat0; | return is_on_seat0; | ||||
} | } | ||||
@@ -1320,133 +1710,6 @@ maybe_start_pending_initial_login (GdmManager *manager | @@ -2031,11 +2422,57 @@ on_user_session_died (GdmSession *session, | ||||
g_free (user_session_seat_id); | |||||
} | } | ||||
-static gboolean | |||||
-get_login_window_session_id (const char *seat_id, | |||||
- char **session_id) | |||||
-{ | |||||
- gboolean ret; | |||||
- int res, i; | |||||
- char **sessions; | |||||
- char *service_id; | |||||
- char *service_class; | |||||
- char *state; | |||||
- | |||||
- res = sd_seat_get_sessions (seat_id, &sessions, NULL, NULL); | |||||
- if (res < 0) { | |||||
- g_debug ("Failed to determine sessions: %s", strerror (-res)); | |||||
- return FALSE; | |||||
- } | |||||
- | |||||
- if (sessions == NULL || sessions[0] == NULL) { | |||||
- *session_id = NULL; | |||||
- ret = TRUE; | |||||
- goto out; | |||||
- } | |||||
- | |||||
- for (i = 0; sessions[i]; i ++) { | |||||
- | |||||
- res = sd_session_get_class (sessions[i], &service_class); | |||||
- if (res < 0) { | |||||
- g_debug ("failed to determine class of session %s: %s", sessions[i], strerror (-res)); | |||||
- ret = FALSE; | |||||
- goto out; | |||||
- } | |||||
- | |||||
- if (strcmp (service_class, "greeter") != 0) { | |||||
- free (service_class); | |||||
- continue; | |||||
- } | |||||
- | |||||
- free (service_class); | |||||
- | |||||
- ret = sd_session_get_state (sessions[i], &state); | |||||
- if (ret < 0) { | |||||
- g_debug ("failed to determine state of session %s: %s", sessions[i], strerror (-res)); | |||||
- ret = FALSE; | |||||
- goto out; | |||||
- } | |||||
- | |||||
- if (g_strcmp0 (state, "closing") == 0) { | |||||
- free (state); | |||||
- continue; | |||||
- } | |||||
- free (state); | |||||
- | |||||
- res = sd_session_get_service (sessions[i], &service_id); | |||||
- if (res < 0) { | |||||
- g_debug ("failed to determine service of session %s: %s", sessions[i], strerror (-res)); | |||||
- ret = FALSE; | |||||
- goto out; | |||||
- } | |||||
- | |||||
- if (strcmp (service_id, "gdm-launch-environment") == 0) { | |||||
- *session_id = g_strdup (sessions[i]); | |||||
- ret = TRUE; | |||||
- | |||||
- free (service_id); | |||||
- goto out; | |||||
- } | |||||
- | |||||
- free (service_id); | |||||
- } | |||||
- | |||||
- *session_id = NULL; | |||||
- ret = TRUE; | |||||
- | |||||
-out: | |||||
- if (sessions) { | |||||
- for (i = 0; sessions[i]; i ++) { | |||||
- free (sessions[i]); | |||||
- } | |||||
- | |||||
- free (sessions); | |||||
- } | |||||
- | |||||
- return ret; | |||||
-} | |||||
- | |||||
-static void | |||||
-activate_login_window_session_on_seat (GdmManager *self, | |||||
- const char *seat_id) | |||||
-{ | |||||
- char *session_id; | |||||
- | |||||
- if (!get_login_window_session_id (seat_id, &session_id)) { | |||||
- return; | |||||
- } | |||||
- | |||||
- activate_session_id (self, seat_id, session_id); | |||||
-} | |||||
- | |||||
-static void | |||||
-maybe_activate_other_session (GdmManager *self, | |||||
- GdmDisplay *old_display) | |||||
-{ | |||||
- char *seat_id = NULL; | |||||
- char *session_id; | |||||
- int ret; | |||||
- | |||||
- g_object_get (G_OBJECT (old_display), | |||||
- "seat-id", &seat_id, | |||||
- NULL); | |||||
- | |||||
- ret = sd_seat_get_active (seat_id, &session_id, NULL); | |||||
- | |||||
- if (ret == 0) { | |||||
- GdmDisplay *display; | |||||
- | |||||
- display = gdm_display_store_find (self->priv->display_store, | |||||
- lookup_by_session_id, | |||||
- (gpointer) session_id); | |||||
- | |||||
- if (display == NULL) { | |||||
- activate_login_window_session_on_seat (self, seat_id); | |||||
- } | |||||
- } | |||||
- | |||||
- g_free (seat_id); | |||||
-} | |||||
- | |||||
static const char * | |||||
get_username_for_greeter_display (GdmManager *manager, | |||||
GdmDisplay *display) | |||||
@@ -1692,7 +1955,6 @@ on_display_status_changed (GdmDisplay *display, | |||||
manager->priv->ran_once = TRUE; | |||||
} | |||||
maybe_start_pending_initial_login (manager, display); | |||||
- maybe_activate_other_session (manager, display); | |||||
break; | |||||
default: | |||||
break; | |||||
@@ -2027,11 +2289,57 @@ on_user_session_died (GdmSession *session, | |||||
} | |||||
static char * | static char * | ||||
+query_ck_for_display_device (GdmManager *manager, | +query_ck_for_display_device (GdmManager *manager, | ||||
+ GdmDisplay *display) | + GdmDisplay *display) | ||||
+{ | +{ | ||||
+ char *out; | + char *out; | ||||
+ char *command; | + char *command; | ||||
+ char *display_name = NULL; | + char *display_name = NULL; | ||||
+ int status; | + int status; | ||||
▲ Show 20 Lines • Show All 41 Lines • ▼ Show 20 Lines | |||||
+ return NULL; | + return NULL; | ||||
+ } | + } | ||||
+#endif | +#endif | ||||
+ | + | ||||
+ return query_ck_for_display_device (manager, display); | + return query_ck_for_display_device (manager, display); | ||||
} | } | ||||
static void | static void | ||||
@@ -2040,25 +2348,6 @@ on_session_reauthenticated (GdmSession *session, | @@ -2044,25 +2481,6 @@ on_session_reauthenticated (GdmSession *session, | ||||
GdmManager *manager) | GdmManager *manager) | ||||
{ | { | ||||
gboolean fail_if_already_switched = FALSE; | gboolean fail_if_already_switched = FALSE; | ||||
- | - | ||||
- if (gdm_session_get_display_mode (session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) { | - if (gdm_session_get_display_mode (session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) { | ||||
- const char *seat_id; | - const char *seat_id; | ||||
- char *session_id; | - char *session_id; | ||||
- | - | ||||
- seat_id = gdm_session_get_display_seat_id (session); | - seat_id = gdm_session_get_display_seat_id (session); | ||||
- if (get_login_window_session_id (seat_id, &session_id)) { | - if (gdm_get_login_window_session_id (seat_id, &session_id)) { | ||||
- GdmDisplay *display = gdm_display_store_find (manager->priv->display_store, | - GdmDisplay *display = gdm_display_store_find (manager->priv->display_store, | ||||
- lookup_by_session_id, | - lookup_by_session_id, | ||||
- (gpointer) session_id); | - (gpointer) session_id); | ||||
- | - | ||||
- if (display != NULL) { | - if (display != NULL) { | ||||
- gdm_display_stop_greeter_session (display); | - gdm_display_stop_greeter_session (display); | ||||
- gdm_display_unmanage (display); | - gdm_display_unmanage (display); | ||||
- gdm_display_finish (display); | - gdm_display_finish (display); | ||||
- } | - } | ||||
- g_free (session_id); | - g_free (session_id); | ||||
- } | - } | ||||
- } | - } | ||||
/* There should already be a session running, so jump to its | /* There should already be a session running, so jump to its | ||||
* VT. In the event we're already on the right VT, (i.e. user | * VT. In the event we're already on the right VT, (i.e. user |