summaryrefslogtreecommitdiff
path: root/x11/gdm/files/patch-common_gdm-common.c
diff options
context:
space:
mode:
authorNeel Chauhan <nc@FreeBSD.org>2022-01-28 14:51:56 -0800
committerNeel Chauhan <nc@FreeBSD.org>2022-01-31 13:06:19 -0800
commita69eab30db5aa908c31f17217000bd16a44b2496 (patch)
tree03e4995b5bec985fc81f946616fb7373fa3e5751 /x11/gdm/files/patch-common_gdm-common.c
parentdevel/pycharm-ce: update 2021.2.2 -> 2021.3.1 (diff)
x11/gdm: Update to 41.3
Differential Revision: https://reviews.freebsd.org/D34088
Diffstat (limited to 'x11/gdm/files/patch-common_gdm-common.c')
-rw-r--r--x11/gdm/files/patch-common_gdm-common.c601
1 files changed, 341 insertions, 260 deletions
diff --git a/x11/gdm/files/patch-common_gdm-common.c b/x11/gdm/files/patch-common_gdm-common.c
index 567c0853796e..cb4900ae4994 100644
--- a/x11/gdm/files/patch-common_gdm-common.c
+++ b/x11/gdm/files/patch-common_gdm-common.c
@@ -1,22 +1,8 @@
-$OpenBSD: patch-common_gdm-common_c,v 1.4 2015/10/18 13:25:54 ajacoutot Exp $
-
-REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
-From 9be58c9ec9a3a411492a5182ac4b0d51fdc3a323 Mon Sep 17 00:00:00 2001
-From: Ray Strode <rstrode@redhat.com>
-Date: Fri, 12 Jun 2015 13:48:52 -0400
-Subject: require logind support
-
-REVERT - OpenBSD does not have a systemd implementation (we need ConsoleKit)
-From 1ac67f522f5690c27023d98096ca817f12f7eb88 Mon Sep 17 00:00:00 2001
-From: Ray Strode <rstrode@redhat.com>
-Date: Fri, 12 Jun 2015 13:28:01 -0400
-Subject: drop consolekit support
-
---- common/gdm-common.c.orig Sun Oct 18 14:26:27 2015
-+++ common/gdm-common.c Sun Oct 18 14:24:34 2015
-@@ -39,12 +39,25 @@
- #include "mkdtemp.h"
- #endif
+--- common/gdm-common.c.orig 2022-01-12 14:15:56 UTC
++++ common/gdm-common.c
+@@ -36,7 +36,9 @@
+
+ #include "gdm-common.h"
+#ifdef WITH_SYSTEMD
#include <systemd/sd-login.h>
@@ -24,390 +10,485 @@ Subject: drop consolekit support
#define GDM_DBUS_NAME "org.gnome.DisplayManager"
#define GDM_DBUS_LOCAL_DISPLAY_FACTORY_PATH "/org/gnome/DisplayManager/LocalDisplayFactory"
- #define GDM_DBUS_LOCAL_DISPLAY_FACTORY_INTERFACE "org.gnome.DisplayManager.LocalDisplayFactory"
-
-+#ifdef WITH_CONSOLE_KIT
-+#define CK_NAME "org.freedesktop.ConsoleKit"
-+#define CK_PATH "/org/freedesktop/ConsoleKit"
-+#define CK_INTERFACE "org.freedesktop.ConsoleKit"
-+
-+#define CK_MANAGER_PATH "/org/freedesktop/ConsoleKit/Manager"
-+#define CK_MANAGER_INTERFACE "org.freedesktop.ConsoleKit.Manager"
-+#define CK_SEAT_INTERFACE "org.freedesktop.ConsoleKit.Seat"
-+#define CK_SESSION_INTERFACE "org.freedesktop.ConsoleKit.Session"
-+#endif
-+
- G_DEFINE_QUARK (gdm-common-error, gdm_common_error);
-
- const char *
-@@ -343,15 +356,306 @@ create_transient_display (GDBusConnection *connection,
+@@ -352,6 +354,412 @@ create_transient_display (GDBusConnection *connection,
return TRUE;
}
+#ifdef WITH_CONSOLE_KIT
++int
++sd_seat_can_graphical(const char *seat)
++{
++ // XXX
++ return 1;
++}
+
- static gboolean
--activate_session_id (GDBusConnection *connection,
-- const char *seat_id,
-- const char *session_id)
-+get_current_session_id (GDBusConnection *connection,
-+ char **session_id)
- {
- GError *local_error = NULL;
- GVariant *reply;
-
- reply = g_dbus_connection_call_sync (connection,
++int
++sd_session_get_service(const char *session,
++ char **service)
++{
++ GError *local_error = NULL;
++ GVariant *reply;
++ const char *value;
++ g_autoptr(GDBusConnection) connection = NULL;
++
++ if (session == NULL || !g_variant_is_object_path (session))
++ return -ENXIO;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
++
++ reply = g_dbus_connection_call_sync (connection,
+ CK_NAME,
-+ CK_MANAGER_PATH,
-+ CK_MANAGER_INTERFACE,
-+ "GetCurrentSession",
-+ NULL, /* parameters */
-+ G_VARIANT_TYPE ("(o)"),
++ session,
++ CK_SESSION_INTERFACE,
++ "GetSessionService",
++ NULL,
++ G_VARIANT_TYPE ("(s)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
+ if (reply == NULL) {
-+ g_warning ("Unable to determine session: %s", local_error->message);
++ g_warning ("Unable to determine session service: %s", local_error ? local_error->message : "");
+ g_error_free (local_error);
-+ return FALSE;
++ return -ENXIO;
+ }
+
-+ g_variant_get (reply, "(o)", session_id);
++ g_variant_get (reply, "(s)", &value);
+ g_variant_unref (reply);
+
-+ return TRUE;
++ *service = g_strdup (value);
++
++ return 0;
+}
+
-+static gboolean
-+get_seat_id_for_session (GDBusConnection *connection,
-+ const char *session_id,
-+ char **seat_id)
++int
++sd_session_get_uid(const char *session,
++ uid_t *uid)
+{
+ GError *local_error = NULL;
+ GVariant *reply;
++ g_autoptr(GDBusConnection) connection = NULL;
++ uid_t local_uid;
++
++ if (session == NULL || !g_variant_is_object_path (session))
++ return -ENXIO;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
+
+ reply = g_dbus_connection_call_sync (connection,
+ CK_NAME,
-+ session_id,
++ session,
+ CK_SESSION_INTERFACE,
-+ "GetSeatId",
-+ NULL, /* parameters */
-+ G_VARIANT_TYPE ("(o)"),
++ "GetUnixUser",
++ NULL,
++ G_VARIANT_TYPE ("(u)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
+ if (reply == NULL) {
-+ g_warning ("Unable to determine seat: %s", local_error->message);
++ g_warning ("Unable to get session for unix service: %s", local_error ? local_error->message : "");
+ g_error_free (local_error);
-+ return FALSE;
++ return -ENXIO;
+ }
+
-+ g_variant_get (reply, "(o)", seat_id);
++ g_variant_get (reply, "(u)", &local_uid);
+ g_variant_unref (reply);
+
-+ return TRUE;
-+}
-+
-+static char *
-+get_current_seat_id (GDBusConnection *connection)
-+{
-+ gboolean res;
-+ char *session_id;
-+ char *seat_id;
++ *uid = local_uid;
+
-+ session_id = NULL;
-+ seat_id = NULL;
-+
-+ res = get_current_session_id (connection, &session_id);
-+ if (res) {
-+ res = get_seat_id_for_session (connection, session_id, &seat_id);
-+ }
-+ g_free (session_id);
-+
-+ return seat_id;
++ return 0;
+}
+
-+static gboolean
-+activate_session_id_for_ck (GDBusConnection *connection,
-+ const char *seat_id,
-+ const char *session_id)
++int
++sd_seat_get_sessions(const char *seat,
++ char ***sessions,
++ uid_t **uid,
++ unsigned int *n_uids)
+{
+ GError *local_error = NULL;
+ GVariant *reply;
++ GVariantIter *iter;
++ gchar *value = NULL;
++ glong nchild;
++ g_autoptr(GDBusConnection) connection = NULL;
++
++ if (seat == NULL || !g_variant_is_object_path (seat))
++ return -ENXIO;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
+
+ reply = g_dbus_connection_call_sync (connection,
+ CK_NAME,
-+ seat_id,
++ seat,
+ CK_SEAT_INTERFACE,
-+ "ActivateSession",
-+ g_variant_new ("(o)", session_id),
++ "GetSessions",
+ NULL,
++ G_VARIANT_TYPE ("(ao)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
+ if (reply == NULL) {
-+ g_warning ("Unable to activate session: %s", local_error->message);
++ g_warning ("Unable to list sessions: %s", local_error->message);
+ g_error_free (local_error);
-+ return FALSE;
++ return -ENXIO;
+ }
+
++ g_variant_get (reply, "(ao)", &iter);
+ g_variant_unref (reply);
+
-+ return TRUE;
++ nchild = g_variant_iter_n_children(iter);
++ *sessions = calloc(nchild, sizeof(gchar *));
++ if (*sessions == NULL) {
++ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno));
++ return -ENOMEM;
++ }
++
++ while (g_variant_iter_next (iter, "o", &value)) {
++ (*sessions)[nchild - 1] = g_strdup(value);
++ }
++ (*sessions)[nchild] = NULL;
++
++ g_variant_iter_free (iter);
++
++ return 0;
+}
+
-+static gboolean
-+session_is_login_window (GDBusConnection *connection,
-+ const char *session_id)
++int
++sd_session_get_seat(const char *session,
++ char **seat)
+{
+ GError *local_error = NULL;
+ GVariant *reply;
+ const char *value;
-+ gboolean ret;
++ g_autoptr(GDBusConnection) connection = NULL;
++
++ if (session == NULL || !g_variant_is_object_path (session))
++ return -ENXIO;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
+
+ reply = g_dbus_connection_call_sync (connection,
+ CK_NAME,
-+ session_id,
++ session,
+ CK_SESSION_INTERFACE,
-+ "GetSessionType",
-+ NULL,
-+ G_VARIANT_TYPE ("(s)"),
++ "GetSeatId",
++ NULL, /* parameters */
++ G_VARIANT_TYPE ("(o)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
+ if (reply == NULL) {
-+ g_warning ("Unable to determine session type: %s", local_error->message);
++ g_warning ("Unable to determine seat: %s", local_error ? local_error->message : "");
+ g_error_free (local_error);
-+ return FALSE;
-+ }
-+
-+ g_variant_get (reply, "(&s)", &value);
-+
-+ if (value == NULL || value[0] == '\0' || strcmp (value, "LoginWindow") != 0) {
-+ ret = FALSE;
-+ } else {
-+ ret = TRUE;
++ return -ENXIO;
+ }
+
++ g_variant_get (reply, "(o)", &value);
+ g_variant_unref (reply);
+
-+ return ret;
++ *seat = g_strdup(value);
++
++ return 0;
+}
+
-+static gboolean
-+seat_can_activate_sessions (GDBusConnection *connection,
-+ const char *seat_id)
++int
++sd_pid_get_session(pid_t pid, char **session)
+{
+ GError *local_error = NULL;
+ GVariant *reply;
-+ gboolean ret;
++ const char *value;
++ g_autoptr(GDBusConnection) connection = NULL;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
+
+ reply = g_dbus_connection_call_sync (connection,
+ CK_NAME,
-+ seat_id,
-+ CK_SEAT_INTERFACE,
-+ "CanActivateSessions",
-+ NULL,
-+ G_VARIANT_TYPE ("(b)"),
++ CK_MANAGER_PATH,
++ CK_MANAGER_INTERFACE,
++ "GetSessionForUnixProcess",
++ g_variant_new ("(u)", pid),
++ G_VARIANT_TYPE ("(o)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
+ if (reply == NULL) {
-+ g_warning ("Unable to determine if can activate sessions: %s", local_error->message);
++ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : "");
+ g_error_free (local_error);
-+ return FALSE;
++ return -ENXIO;
+ }
+
-+ g_variant_get (reply, "(b)", &ret);
++ g_variant_get (reply, "(o)", &value);
+ g_variant_unref (reply);
+
-+ return ret;
++ *session = g_strdup (value);
++
++ return 0;
+}
+
-+static const char **
-+seat_get_sessions (GDBusConnection *connection,
-+ const char *seat_id)
++int
++sd_session_get_type(const char *session, char **type)
+{
+ GError *local_error = NULL;
+ GVariant *reply;
-+ const char **value;
++ const char *value;
++ g_autoptr(GDBusConnection) connection = NULL;
++
++ if (session == NULL || !g_variant_is_object_path (session))
++ return -ENXIO;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
+
+ reply = g_dbus_connection_call_sync (connection,
+ CK_NAME,
-+ seat_id,
-+ CK_SEAT_INTERFACE,
-+ "GetSessions",
++ session,
++ CK_SESSION_INTERFACE,
++ "GetSessionType",
+ NULL,
-+ G_VARIANT_TYPE ("(ao)"),
++ G_VARIANT_TYPE ("(s)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
+ if (reply == NULL) {
-+ g_warning ("Unable to list sessions: %s", local_error->message);
++ g_warning ("Unable to determine session type: %s", local_error ? local_error->message : "");
+ g_error_free (local_error);
-+ return FALSE;
++ return -ENXIO;
+ }
+
-+ g_variant_get (reply, "(^ao)", &value);
++ g_variant_get (reply, "(s)", &value);
+ g_variant_unref (reply);
+
-+ return value;
++ *type = g_strdup (value);
++
++ return 0;
+}
+
-+static gboolean
-+get_login_window_session_id_for_ck (GDBusConnection *connection,
-+ const char *seat_id,
-+ char **session_id)
++int
++sd_session_get_class(const char *session, char **class)
+{
-+ gboolean can_activate_sessions;
-+ const char **sessions;
-+ int i;
-+
-+ *session_id = NULL;
-+ sessions = NULL;
++ GError *local_error = NULL;
++ GVariant *reply;
++ const gchar *value;
++ g_autoptr(GDBusConnection) connection = NULL;
+
-+ g_debug ("checking if seat can activate sessions");
++ if (session == NULL || !g_variant_is_object_path (session))
++ return -ENXIO;
+
-+ can_activate_sessions = seat_can_activate_sessions (connection, seat_id);
-+ if (! can_activate_sessions) {
-+ g_debug ("seat is unable to activate sessions");
-+ return FALSE;
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
+ }
+
-+ sessions = seat_get_sessions (connection, seat_id);
-+ for (i = 0; sessions [i] != NULL; i++) {
-+ const char *ssid;
++ reply = g_dbus_connection_call_sync (connection,
++ CK_NAME,
++ session,
++ CK_SESSION_INTERFACE,
++ "GetSessionClass",
++ NULL,
++ G_VARIANT_TYPE ("(s)"),
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL, &local_error);
++ if (reply == NULL) {
++ g_warning ("Unable to determine session class: %s", local_error ? local_error->message : "");
++ g_error_free (local_error);
++ return -ENXIO;
++ }
+
-+ ssid = sessions [i];
++ g_variant_get (reply, "(s)", &value);
++ g_variant_unref (reply);
+
-+ if (session_is_login_window (connection, ssid)) {
-+ *session_id = g_strdup (ssid);
-+ break;
-+ }
-+ }
-+ g_free (sessions);
++ *class = g_strdup(value);
+
-+ return TRUE;
++ return 0;
+}
+
-+static gboolean
-+goto_login_session_for_ck (GDBusConnection *connection,
-+ GError **error)
++int
++sd_session_get_state(const char *session, char **state)
+{
-+ gboolean ret;
-+ gboolean res;
-+ char *session_id;
-+ char *seat_id;
++ GError *local_error = NULL;
++ GVariant *reply;
++ const char *value;
++ g_autoptr(GDBusConnection) connection = NULL;
+
-+ ret = FALSE;
++ if (session == NULL || !g_variant_is_object_path (session))
++ return -ENXIO;
+
-+ /* First look for any existing LoginWindow sessions on the seat.
-+ If none are found, create a new one. */
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
++ }
+
-+ seat_id = get_current_seat_id (connection);
-+ if (seat_id == NULL || seat_id[0] == '\0') {
-+ g_debug ("seat id is not set; can't switch sessions");
-+ g_set_error (error, GDM_COMMON_ERROR, 0, _("Could not identify the current session."));
++ reply = g_dbus_connection_call_sync (connection,
++ CK_NAME,
++ session,
++ CK_SESSION_INTERFACE,
++ "GetSessionState",
++ NULL,
++ G_VARIANT_TYPE ("(s)"),
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL, &local_error);
++ if (reply == NULL) {
++ g_warning ("Unable to determine session state: %s", local_error ? local_error->message : "");
++ g_error_free (local_error);
++ return -ENXIO;
++ }
+
-+ return FALSE;
++ g_variant_get (reply, "(s)", &value);
++ g_variant_unref (reply);
++
++ *state = g_strdup (value);
++
++ return 0;
++}
++
++int
++sd_uid_get_sessions(uid_t uid, int require_active, char ***sessions)
++{
++ GError *local_error = NULL;
++ GVariant *reply;
++ GVariantIter *iter;
++ gchar *value = NULL;
++ glong nchild;
++ g_autoptr(GDBusConnection) connection = NULL;
++
++ connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &local_error);
++ if (connection == NULL) {
++ g_warning ("Failed to connect to the D-Bus daemon: %s", local_error->message);
++ return -ENXIO;
+ }
+
-+ res = get_login_window_session_id_for_ck (connection, seat_id, &session_id);
-+ if (! res) {
-+ g_set_error (error, GDM_COMMON_ERROR, 1, _("User unable to switch sessions."));
-+ return FALSE;
++ reply = g_dbus_connection_call_sync (connection,
++ CK_NAME,
++ CK_MANAGER_PATH,
++ CK_MANAGER_INTERFACE,
++ "GetSessionsForUnixUser",
++ g_variant_new ("(u)", uid),
++ G_VARIANT_TYPE ("(ao)"),
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL, &local_error);
++ if (reply == NULL) {
++ g_warning ("Unable to list sessions: %s", local_error ? local_error->message : "");
++ g_error_free (local_error);
++ return -ENXIO;
+ }
+
-+ if (session_id != NULL) {
-+ res = activate_session_id_for_ck (connection, seat_id, session_id);
-+ if (res) {
-+ ret = TRUE;
-+ }
++ g_variant_get (reply, "(ao)", &iter);
++ g_variant_unref (reply);
++
++ nchild = g_variant_iter_n_children(iter);
++ *sessions = calloc(nchild, sizeof(gchar *));
++ if (*sessions == NULL) {
++ g_warning ("Unable to allocate memory for sessions array: %s", g_strerror(errno));
++ return -ENOMEM;
+ }
+
-+ if (! ret && g_strcmp0 (seat_id, "/org/freedesktop/ConsoleKit/Seat1") == 0) {
-+ res = create_transient_display (connection, error);
-+ if (res) {
-+ ret = TRUE;
-+ }
++ while (g_variant_iter_next (iter, "o", &value)) {
++ (*sessions)[nchild - 1] = g_strdup(value);
+ }
++ (*sessions)[nchild] = NULL;
+
-+ return ret;
++ g_variant_iter_free (iter);
++
++ return 0;
+}
+#endif
+
-+#ifdef WITH_SYSTEMD
+ gboolean
+ gdm_activate_session_by_id (GDBusConnection *connection,
+ const char *seat_id,
+@@ -360,6 +768,7 @@ gdm_activate_session_by_id (GDBusConnection *connectio
+ GError *local_error = NULL;
+ GVariant *reply;
+
++#if defined(WITH_SYSTEMD)
+ reply = g_dbus_connection_call_sync (connection,
+ "org.freedesktop.login1",
+ "/org/freedesktop/login1",
+@@ -370,7 +779,41 @@ gdm_activate_session_by_id (GDBusConnection *connectio
+ G_DBUS_CALL_FLAGS_NONE,
+ -1,
+ NULL, &local_error);
++#elif defined(WITH_CONSOLE_KIT)
++ gboolean ret;
+
-+static gboolean
-+activate_session_id_for_systemd (GDBusConnection *connection,
-+ const char *seat_id,
-+ const char *session_id)
-+{
-+ GError *local_error = NULL;
-+ GVariant *reply;
++ reply = g_dbus_connection_call_sync (connection,
++ CK_NAME,
++ seat_id,
++ CK_SEAT_INTERFACE,
++ "CanActivateSessions",
++ NULL,
++ G_VARIANT_TYPE ("(b)"),
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL, &local_error);
+ if (reply == NULL) {
++ g_warning ("Unable to determine if can activate sessions: %s", local_error ? local_error->message : "");
++ g_error_free (local_error);
++ return FALSE;
++ }
++
++ g_variant_get (reply, "(b)", &ret);
++ if (ret != TRUE)
++ return ret;
+
+ reply = g_dbus_connection_call_sync (connection,
- "org.freedesktop.login1",
- "/org/freedesktop/login1",
- "org.freedesktop.login1.Manager",
-@@ -373,8 +677,8 @@ activate_session_id (GDBusConnection *connection,
- }
-
- static gboolean
--get_login_window_session_id (const char *seat_id,
-- char **session_id)
-+get_login_window_session_id_for_systemd (const char *seat_id,
-+ char **session_id)
- {
- gboolean ret;
- int res, i;
-@@ -442,8 +746,8 @@ out:
- }
-
- static gboolean
--goto_login_session (GDBusConnection *connection,
-- GError **error)
-+goto_login_session_for_systemd (GDBusConnection *connection,
-+ GError **error)
- {
- gboolean ret;
- int res;
-@@ -497,9 +801,9 @@ goto_login_session (GDBusConnection *connection,
++ CK_NAME,
++ seat_id,
++ CK_SEAT_INTERFACE,
++ "ActivateSession",
++ g_variant_new ("(o)", session_id),
++ NULL,
++ G_DBUS_CALL_FLAGS_NONE,
++ -1,
++ NULL, &local_error);
++#endif
++ if (reply == NULL) {
+ g_warning ("Unable to activate session: %s", local_error->message);
+ g_error_free (local_error);
return FALSE;
+@@ -521,7 +964,7 @@ goto_login_session (GDBusConnection *connection,
+ }
}
-- res = get_login_window_session_id (seat_id, &session_id);
-+ res = get_login_window_session_id_for_systemd (seat_id, &session_id);
- if (res && session_id != NULL) {
-- res = activate_session_id (connection, seat_id, session_id);
-+ res = activate_session_id_for_systemd (connection, seat_id, session_id);
-
+- if (! ret && g_strcmp0 (seat_id, "seat0") == 0) {
++ if (! ret && g_strcmp0 (seat_id, SEAT_ID) == 0) {
+ res = create_transient_display (connection, error);
if (res) {
ret = TRUE;
-@@ -518,6 +822,7 @@ goto_login_session (GDBusConnection *connection,
+@@ -907,7 +1350,9 @@ gdm_find_display_session (GPid pid,
- return ret;
- }
+ return TRUE;
+ } else {
++#ifdef ENODATA
+ if (res != -ENODATA)
+#endif
-
- gboolean
- gdm_goto_login_session (GError **error)
-@@ -533,7 +838,17 @@ gdm_goto_login_session (GError **error)
- return FALSE;
+ g_warning ("GdmCommon: Failed to retrieve session information for pid %d: %s",
+ pid, strerror (-res));
}
-
-- return goto_login_session (connection, error);
-+#ifdef WITH_SYSTEMD
-+ if (LOGIND_RUNNING()) {
-+ return goto_login_session_for_systemd (connection, error);
-+ }
-+#endif
-+
-+#ifdef WITH_CONSOLE_KIT
-+ return goto_login_session_for_ck (connection, error);
-+#else
-+ return FALSE;
-+#endif
- }
-
- static void