diff options
34 files changed, 42 insertions, 1118 deletions
diff --git a/debian/control b/debian/control index fb253ddd..591dfc91 100644 --- a/debian/control +++ b/debian/control @@ -47,11 +47,12 @@ Conflicts: liblightdm-gobject-0-0, liblightdm-qt-0-0, Provides: x-display-manager Description: Display Manager - LightDM is a X display manager that: - * Has a lightweight codebase - * Is standards compliant (PAM, ConsoleKit, etc) - * Has a well defined interface between the server and user interface - * Cross-desktop (greeters can be written in any toolkit) + LightDM is a display manager that: + * Is cross-desktop - supports different desktops + * Supports different display technologies + * Is lightweight - low memory usage and fast performance + * Has a comprehensive test suite + * Has low code complexity Package: liblightdm-gobject-1-0 Architecture: any diff --git a/liblightdm-gobject/power.c b/liblightdm-gobject/power.c index 9b2dc172..356a8cda 100644 --- a/liblightdm-gobject/power.c +++ b/liblightdm-gobject/power.c @@ -16,7 +16,6 @@ #include "lightdm/power.h" static GDBusProxy *upower_proxy = NULL; -static GDBusProxy *ck_proxy = NULL; static GDBusProxy *login1_proxy = NULL; static GVariant * @@ -205,36 +204,6 @@ lightdm_hibernate (GError **error) return hibernated; } -static GVariant * -ck_call_function (const gchar *function, GError **error) -{ - GVariant *r; - - if (!ck_proxy) - { - ck_proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_NONE, - NULL, - "org.freedesktop.ConsoleKit", - "/org/freedesktop/ConsoleKit/Manager", - "org.freedesktop.ConsoleKit.Manager", - NULL, - error); - if (!ck_proxy) - return FALSE; - } - - r = g_dbus_proxy_call_sync (ck_proxy, - function, - NULL, - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - error); - - return r; -} - /** * lightdm_get_can_restart: * @@ -257,15 +226,8 @@ lightdm_get_can_restart (void) g_variant_get (r, "(&s)", &result); can_restart = g_strcmp0 (result, "yes") == 0; } - } - else - { - r = ck_call_function ("CanRestart", NULL); - if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)"))) - g_variant_get (r, "(b)", &can_restart); - } - if (r) g_variant_unref (r); + } return can_restart; } @@ -282,19 +244,15 @@ gboolean lightdm_restart (GError **error) { GVariant *r; - gboolean restarted; r = login1_call_function ("Reboot", g_variant_new("(b)", FALSE), error); - if (!r) - { - g_clear_error (error); - r = ck_call_function ("Restart", error); - } - restarted = r != NULL; if (r) + { g_variant_unref (r); + return TRUE; + } - return restarted; + return FALSE; } /** @@ -319,15 +277,8 @@ lightdm_get_can_shutdown (void) g_variant_get (r, "(&s)", &result); can_shutdown = g_strcmp0 (result, "yes") == 0; } - } - else - { - r = ck_call_function ("CanStop", NULL); - if (r && g_variant_is_of_type (r, G_VARIANT_TYPE ("(b)"))) - g_variant_get (r, "(b)", &can_shutdown); - } - if (r) g_variant_unref (r); + } return can_shutdown; } @@ -344,17 +295,13 @@ gboolean lightdm_shutdown (GError **error) { GVariant *r; - gboolean shutdown; r = login1_call_function ("PowerOff", g_variant_new("(b)", FALSE), error); - if (!r) - { - g_clear_error (error); - r = ck_call_function ("Stop", error); - } - shutdown = r != NULL; if (r) + { g_variant_unref (r); + return TRUE; + } - return shutdown; + return FALSE; } diff --git a/liblightdm-qt/power.cpp b/liblightdm-qt/power.cpp index a8cb4fae..fa366a1f 100644 --- a/liblightdm-qt/power.cpp +++ b/liblightdm-qt/power.cpp @@ -26,13 +26,11 @@ class PowerInterface::PowerInterfacePrivate public: PowerInterfacePrivate(); QScopedPointer<QDBusInterface> powerManagementInterface; - QScopedPointer<QDBusInterface> consoleKitInterface; QScopedPointer<QDBusInterface> login1Interface; }; PowerInterface::PowerInterfacePrivate::PowerInterfacePrivate() : powerManagementInterface(new QDBusInterface("org.freedesktop.UPower","/org/freedesktop/UPower", "org.freedesktop.UPower", QDBusConnection::systemBus())), - consoleKitInterface(new QDBusInterface("org.freedesktop.ConsoleKit", "/org/freedesktop/ConsoleKit/Manager", "org.freedesktop.ConsoleKit.Manager", QDBusConnection::systemBus())), login1Interface(new QDBusInterface("org.freedesktop.login1", "/org/freedesktop/login1", "org.freedesktop.login1.Manager", QDBusConnection::systemBus())) { } @@ -117,17 +115,9 @@ bool PowerInterface::hibernate() bool PowerInterface::canShutdown() { - if (d->login1Interface->isValid()) { - QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff"); - if (reply1.isValid()) { - return reply1.value() == "yes"; - } - } - qWarning() << d->login1Interface->lastError(); - - QDBusReply<bool> reply = d->consoleKitInterface->call("CanStop"); - if (reply.isValid()) { - return reply.value(); + QDBusReply<QString> reply1 = d->login1Interface->call("CanPowerOff"); + if (reply1.isValid()) { + return reply1.value() == "yes"; } return false; @@ -136,26 +126,15 @@ bool PowerInterface::canShutdown() bool PowerInterface::shutdown() { QDBusReply<void> reply; - if (d->login1Interface->isValid()) - reply = d->login1Interface->call("PowerOff", false); - else - reply = d->consoleKitInterface->call("Stop"); + reply = d->login1Interface->call("PowerOff", false); return reply.isValid(); } bool PowerInterface::canRestart() { - if (d->login1Interface->isValid()) { - QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot"); - if (reply1.isValid()) { - return reply1.value() == "yes"; - } - } - qWarning() << d->login1Interface->lastError(); - - QDBusReply<bool> reply = d->consoleKitInterface->call("CanRestart"); - if (reply.isValid()) { - return reply.value(); + QDBusReply<QString> reply1 = d->login1Interface->call("CanReboot"); + if (reply1.isValid()) { + return reply1.value() == "yes"; } return false; @@ -164,10 +143,7 @@ bool PowerInterface::canRestart() bool PowerInterface::restart() { QDBusReply<void> reply; - if (d->login1Interface->isValid()) - reply = d->login1Interface->call("Reboot", false); - else - reply = d->consoleKitInterface->call("Restart"); + reply = d->login1Interface->call("Reboot", false); return reply.isValid(); } diff --git a/src/Makefile.am b/src/Makefile.am index fc6f7f25..b89df1e0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -4,8 +4,6 @@ bin_PROGRAMS = dm-tool lightdm_SOURCES = \ accounts.c \ accounts.h \ - console-kit.c \ - console-kit.h \ display-manager.c \ display-manager.h \ display-server.c \ diff --git a/src/console-kit.c b/src/console-kit.c deleted file mode 100644 index 41ffbc49..00000000 --- a/src/console-kit.c +++ /dev/null @@ -1,262 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: nil; tab-width: 4 -*- - * - * Copyright (C) 2010-2011 Robert Ancell. - * Author: Robert Ancell <robert.ancell@canonical.com> - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later - * version. See http://www.gnu.org/copyleft/gpl.html the full text of the - * license. - */ - -#include <gio/gio.h> - -#include "console-kit.h" - -gchar * -ck_open_session (GVariantBuilder *parameters) -{ - GDBusConnection *bus; - GVariant *result; - gchar *cookie; - GError *error = NULL; - - g_return_val_if_fail (parameters != NULL, NULL); - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (error) - g_warning ("Failed to get system bus: %s", error->message); - g_clear_error (&error); - if (!bus) - return NULL; - result = g_dbus_connection_call_sync (bus, - "org.freedesktop.ConsoleKit", - "/org/freedesktop/ConsoleKit/Manager", - "org.freedesktop.ConsoleKit.Manager", - "OpenSessionWithParameters", - g_variant_new ("(a(sv))", parameters), - G_VARIANT_TYPE ("(s)"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - g_object_unref (bus); - - if (error) - g_warning ("Failed to open CK session: %s", error->message); - g_clear_error (&error); - if (!result) - return NULL; - - g_variant_get (result, "(s)", &cookie); - g_variant_unref (result); - g_debug ("Opened ConsoleKit session %s", cookie); - - return cookie; -} - -static gchar * -get_ck_session (GDBusConnection *bus, const gchar *cookie) -{ - GVariant *result; - gchar *session_path; - GError *error = NULL; - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - result = g_dbus_connection_call_sync (bus, - "org.freedesktop.ConsoleKit", - "/org/freedesktop/ConsoleKit/Manager", - "org.freedesktop.ConsoleKit.Manager", - "GetSessionForCookie", - g_variant_new ("(s)", cookie), - G_VARIANT_TYPE ("(o)"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - g_object_unref (bus); - if (error) - g_warning ("Error getting ConsoleKit session: %s", error->message); - g_clear_error (&error); - if (!result) - return NULL; - - g_variant_get (result, "(o)", &session_path); - g_variant_unref (result); - - return session_path; -} - -void -ck_lock_session (const gchar *cookie) -{ - GDBusConnection *bus; - gchar *session_path; - GError *error = NULL; - - g_return_if_fail (cookie != NULL); - - g_debug ("Locking ConsoleKit session %s", cookie); - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (error) - g_warning ("Failed to get system bus: %s", error->message); - g_clear_error (&error); - if (!bus) - return; - - session_path = get_ck_session (bus, cookie); - if (session_path) - { - GVariant *result; - - result = g_dbus_connection_call_sync (bus, - "org.freedesktop.ConsoleKit", - session_path, - "org.freedesktop.ConsoleKit.Session", - "Lock", - g_variant_new ("()"), - G_VARIANT_TYPE ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - if (error) - g_warning ("Error locking ConsoleKit session: %s", error->message); - g_clear_error (&error); - if (result) - g_variant_unref (result); - } - g_object_unref (bus); -} - -void -ck_unlock_session (const gchar *cookie) -{ - GDBusConnection *bus; - gchar *session_path; - GError *error = NULL; - - g_return_if_fail (cookie != NULL); - - g_debug ("Unlocking ConsoleKit session %s", cookie); - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (error) - g_warning ("Failed to get system bus: %s", error->message); - g_clear_error (&error); - if (!bus) - return; - - session_path = get_ck_session (bus, cookie); - if (session_path) - { - GVariant *result; - - result = g_dbus_connection_call_sync (bus, - "org.freedesktop.ConsoleKit", - session_path, - "org.freedesktop.ConsoleKit.Session", - "Unlock", - g_variant_new ("()"), - G_VARIANT_TYPE ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - if (error) - g_warning ("Error unlocking ConsoleKit session: %s", error->message); - g_clear_error (&error); - if (result) - g_variant_unref (result); - } - g_object_unref (bus); -} - -void -ck_activate_session (const gchar *cookie) -{ - GDBusConnection *bus; - gchar *session_path; - GError *error = NULL; - - g_return_if_fail (cookie != NULL); - - g_debug ("Activating ConsoleKit session %s", cookie); - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (error) - g_warning ("Failed to get system bus: %s", error->message); - g_clear_error (&error); - if (!bus) - return; - - session_path = get_ck_session (bus, cookie); - if (session_path) - { - GVariant *result; - - result = g_dbus_connection_call_sync (bus, - "org.freedesktop.ConsoleKit", - session_path, - "org.freedesktop.ConsoleKit.Session", - "Activate", - g_variant_new ("()"), - G_VARIANT_TYPE ("()"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - if (error) - g_warning ("Error activating ConsoleKit session: %s", error->message); - g_clear_error (&error); - if (result) - g_variant_unref (result); - } - g_object_unref (bus); -} - -void -ck_close_session (const gchar *cookie) -{ - GDBusConnection *bus; - GVariant *result; - gboolean is_closed; - GError *error = NULL; - - g_return_if_fail (cookie != NULL); - - g_debug ("Ending ConsoleKit session %s", cookie); - - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (error) - g_warning ("Failed to get system bus: %s", error->message); - g_clear_error (&error); - if (!bus) - return; - result = g_dbus_connection_call_sync (bus, - "org.freedesktop.ConsoleKit", - "/org/freedesktop/ConsoleKit/Manager", - "org.freedesktop.ConsoleKit.Manager", - "CloseSession", - g_variant_new ("(s)", cookie), - G_VARIANT_TYPE ("(b)"), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - &error); - g_object_unref (bus); - - if (error) - g_warning ("Error ending ConsoleKit session: %s", error->message); - g_clear_error (&error); - if (!result) - return; - - g_variant_get (result, "(b)", &is_closed); - g_variant_unref (result); - - if (!is_closed) - g_warning ("ConsoleKit.Manager.CloseSession() returned false"); -} diff --git a/src/console-kit.h b/src/console-kit.h deleted file mode 100644 index 1080338e..00000000 --- a/src/console-kit.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (C) 2010-2011 Robert Ancell. - * Author: Robert Ancell <robert.ancell@canonical.com> - * - * This program is free software: you can redistribute it and/or modify it under - * the terms of the GNU General Public License as published by the Free Software - * Foundation, either version 3 of the License, or (at your option) any later - * version. See http://www.gnu.org/copyleft/gpl.html the full text of the - * license. - */ - -#ifndef CONSOLE_KIT_H_ -#define CONSOLE_KIT_H_ - -#include <glib-object.h> - -G_BEGIN_DECLS - -gchar *ck_open_session (GVariantBuilder *parameters); - -void ck_lock_session (const gchar *cookie); - -void ck_unlock_session (const gchar *cookie); - -void ck_activate_session (const gchar *cookie); - -void ck_close_session (const gchar *cookie); - -G_END_DECLS - -#endif /* CONSOLE_KIT_H_ */ @@ -608,8 +608,7 @@ run_session (Seat *seat, Session *session) { /* Multiple sessions can theoretically be on the same VT (especially if using Mir). If a new session appears on an existing active VT, - logind will mark it as active, while ConsoleKit will re-mark the - oldest session as active. In either case, that may not be the + logind will mark it as active which may not be the session that we want to be active. So let's be explicit and re-activate the correct session whenever a new session starts. There's no harm to do this in seats that enforce separate VTs. */ diff --git a/src/session-child.c b/src/session-child.c index c6f8a7ce..993dd623 100644 --- a/src/session-child.c +++ b/src/session-child.c @@ -20,7 +20,6 @@ #include "configuration.h" #include "session-child.h" #include "session.h" -#include "console-kit.h" #include "login1.h" #include "privileges.h" #include "x-authority.h" @@ -231,7 +230,6 @@ session_child_run (int argc, char **argv) gsize env_length; gsize command_argc; gchar **command_argv; - GVariantBuilder ck_parameters; int return_code; int authentication_result; gchar *authentication_result_string; @@ -242,9 +240,7 @@ session_child_run (int argc, char **argv) gchar *xdisplay; XAuthority *x_authority = NULL; gchar *x_authority_filename; - GDBusConnection *bus; const gchar *login1_session = NULL; - gchar *console_kit_cookie = NULL; const gchar *locale_value; gchar *locale_var; static const gchar * const locale_var_names[] = { @@ -261,7 +257,6 @@ session_child_run (int argc, char **argv) gid_t gid; uid_t uid; const gchar *home_directory; - GError *error = NULL; #if !defined(GLIB_VERSION_2_36) g_type_init (); @@ -534,55 +529,21 @@ session_child_run (int argc, char **argv) return EXIT_FAILURE; } - /* Open a connection to the system bus for ConsoleKit - we must keep it open or CK will close the session */ - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (error) - g_printerr ("Unable to contact system bus: %s", error->message); - if (!bus) - { - pam_end (pam_handle, 0); - return EXIT_FAILURE; - } - /* Check what logind session we are, or fallback to ConsoleKit */ login1_session = pam_getenv (pam_handle, "XDG_SESSION_ID"); if (login1_session) { write_string (login1_session); + /* Write what was a ConsoleKit cookie */ if (version >= 2) write_string (NULL); } else { - g_variant_builder_init (&ck_parameters, G_VARIANT_TYPE ("(a(sv))")); - g_variant_builder_open (&ck_parameters, G_VARIANT_TYPE ("a(sv)")); - g_variant_builder_add (&ck_parameters, "(sv)", "unix-user", g_variant_new_int32 (user_get_uid (user))); - if (g_strcmp0 (pam_getenv (pam_handle, "XDG_SESSION_CLASS"), "greeter") == 0) - g_variant_builder_add (&ck_parameters, "(sv)", "session-type", g_variant_new_string ("LoginWindow")); - if (xdisplay) - { - g_variant_builder_add (&ck_parameters, "(sv)", "x11-display", g_variant_new_string (xdisplay)); - if (tty) - g_variant_builder_add (&ck_parameters, "(sv)", "x11-display-device", g_variant_new_string (tty)); - } - if (remote_host_name) - { - g_variant_builder_add (&ck_parameters, "(sv)", "is-local", g_variant_new_boolean (FALSE)); - g_variant_builder_add (&ck_parameters, "(sv)", "remote-host-name", g_variant_new_string (remote_host_name)); - } - else - g_variant_builder_add (&ck_parameters, "(sv)", "is-local", g_variant_new_boolean (TRUE)); - console_kit_cookie = ck_open_session (&ck_parameters); if (version >= 2) write_string (NULL); - write_string (console_kit_cookie); - if (console_kit_cookie) - { - gchar *value; - value = g_strdup_printf ("XDG_SESSION_COOKIE=%s", console_kit_cookie); - pam_putenv (pam_handle, value); - g_free (value); - } + /* Write what was a ConsoleKit cookie */ + write_string (NULL); } /* Write X authority */ @@ -760,10 +721,6 @@ session_child_run (int argc, char **argv) _exit (EXIT_FAILURE); } - /* Close the Console Kit session */ - if (console_kit_cookie) - ck_close_session (console_kit_cookie); - /* Close the session */ pam_close_session (pam_handle, 0); diff --git a/src/session.c b/src/session.c index c0729df3..7b5fcf9a 100644 --- a/src/session.c +++ b/src/session.c @@ -23,7 +23,6 @@ #include "session.h" #include "configuration.h" -#include "console-kit.h" #include "login1.h" #include "guest-account.h" #include "shared-data-manager.h" @@ -96,9 +95,6 @@ struct SessionPrivate /* Remote host this session is being controlled from */ gchar *remote_host_name; - /* Console kit cookie */ - gchar *console_kit_cookie; - /* login1 session ID */ gchar *login1_session_id; @@ -652,13 +648,6 @@ session_get_username (Session *session) return session->priv->username; } -const gchar * -session_get_console_kit_cookie (Session *session) -{ - g_return_val_if_fail (session != NULL, NULL); - return session->priv->console_kit_cookie; -} - void session_respond (Session *session, struct pam_response *response) { @@ -806,46 +795,30 @@ session_real_run (Session *session) write_string (session, session->priv->argv[i]); session->priv->login1_session_id = read_string_from_child (session); - session->priv->console_kit_cookie = read_string_from_child (session); } void session_lock (Session *session) { g_return_if_fail (session != NULL); - if (getuid () == 0) - { - if (session->priv->login1_session_id) - login1_service_lock_session (login1_service_get_instance (), session->priv->login1_session_id); - else if (session->priv->console_kit_cookie) - ck_lock_session (session->priv->console_kit_cookie); - } + if (getuid () == 0 && session->priv->login1_session_id) + login1_service_lock_session (login1_service_get_instance (), session->priv->login1_session_id); } void session_unlock (Session *session) { g_return_if_fail (session != NULL); - if (getuid () == 0) - { - if (session->priv->login1_session_id) - login1_service_unlock_session (login1_service_get_instance (), session->priv->login1_session_id); - else if (session->priv->console_kit_cookie) - ck_unlock_session (session->priv->console_kit_cookie); - } + if (getuid () == 0 && session->priv->login1_session_id) + login1_service_unlock_session (login1_service_get_instance (), session->priv->login1_session_id); } void session_activate (Session *session) { g_return_if_fail (session != NULL); - if (getuid () == 0) - { - if (session->priv->login1_session_id) - login1_service_activate_session (login1_service_get_instance (), session->priv->login1_session_id); - else if (session->priv->console_kit_cookie) - ck_activate_session (session->priv->console_kit_cookie); - } + if (getuid () == 0 && session->priv->login1_session_id) + login1_service_activate_session (login1_service_get_instance (), session->priv->login1_session_id); } void @@ -938,7 +911,6 @@ session_finalize (GObject *object) g_object_unref (self->priv->x_authority); g_free (self->priv->remote_host_name); g_free (self->priv->login1_session_id); - g_free (self->priv->console_kit_cookie); g_list_free_full (self->priv->env, g_free); g_strfreev (self->priv->argv); diff --git a/src/session.h b/src/session.h index b79a53d8..38205a8f 100644 --- a/src/session.h +++ b/src/session.h @@ -111,8 +111,6 @@ gboolean session_get_is_started (Session *session); const gchar *session_get_username (Session *session); -const gchar *session_get_console_kit_cookie (Session *session); - void session_respond (Session *session, struct pam_response *response); void session_respond_error (Session *session, int error); diff --git a/tests/Makefile.am b/tests/Makefile.am index c28f1a51..d0e7c739 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -134,8 +134,6 @@ TESTS = \ test-lock-session-no-password \ test-lock-session-resettable \ test-lock-session-return-session \ - test-lock-seat-console-kit \ - test-lock-seat-return-session-console-kit \ test-switch-to-greeter \ test-switch-to-greeter-disabled \ test-switch-to-greeter-new-session \ @@ -170,12 +168,8 @@ TESTS = \ test-utmp-autologin \ test-utmp-wrong-password \ test-no-accounts-service \ - test-console-kit \ - test-no-console-kit \ test-no-login1 \ - test-no-console-kit-or-login1 \ test-power-gobject \ - test-power-no-console-kit-gobject \ test-power-no-login1-gobject \ test-power-no-services-gobject \ test-open-file-descriptors \ @@ -253,7 +247,6 @@ TESTS += \ test-autologin-timeout-python \ test-autologin-guest-timeout-python \ test-power-python \ - test-power-no-console-kit-python \ test-power-no-login1-python \ test-power-no-services-python @@ -289,7 +282,6 @@ TESTS += \ test-login-remote-session-qt4 \ test-users-qt4 \ test-power-qt4 \ - test-power-no-console-kit-qt4 \ test-power-no-login1-qt4 \ test-power-no-services-qt4 endif @@ -326,7 +318,6 @@ TESTS += \ test-login-remote-session-qt5 \ test-users-qt5 \ test-power-qt5 \ - test-power-no-console-kit-qt5 \ test-power-no-login1-qt5 \ test-power-no-services-qt5 endif @@ -377,7 +368,6 @@ EXTRA_DIST = \ scripts/autologin-xserver-crash.conf \ scripts/change-authentication.conf \ scripts/cancel-authentication.conf \ - scripts/console-kit.conf \ scripts/corrupt-xauthority.conf \ scripts/crash-authenticate.conf \ scripts/cred-error.conf \ @@ -405,10 +395,8 @@ EXTRA_DIST = \ scripts/language-env.conf \ scripts/language-no-accounts-service.conf \ scripts/lock-seat.conf \ - scripts/lock-seat-console-kit.conf \ scripts/lock-seat-resettable.conf \ scripts/lock-seat-return-session.conf \ - scripts/lock-seat-return-session-console-kit.conf \ scripts/lock-session.conf \ scripts/lock-session-no-password.conf \ scripts/lock-session-resettable.conf \ @@ -462,12 +450,9 @@ EXTRA_DIST = \ scripts/multi-seat-seat0-non-graphical-disabled.conf \ scripts/no-accounts-service.conf \ scripts/no-config.conf \ - scripts/no-console-kit.conf \ - scripts/no-console-kit-or-login1.conf \ scripts/no-login1.conf \ scripts/open-file-descriptors.conf \ scripts/power.conf \ - scripts/power-no-console-kit.conf \ scripts/power-no-services.conf \ scripts/power-no-login1.conf \ scripts/plymouth-active-vt.conf \ diff --git a/tests/scripts/console-kit.conf b/tests/scripts/console-kit.conf deleted file mode 100644 index ac9ac828..00000000 --- a/tests/scripts/console-kit.conf +++ /dev/null @@ -1,33 +0,0 @@ -# -# Check ConsoleKit variable is set in session -# - -[test-runner-config] -disable-login1=true - -[SeatDefaults] -autologin-user=have-password1 -user-session=default - -#?*START-DAEMON -#?RUNNER DAEMON-START - -# X server starts -#?XSERVER-0 START VT=7 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-0 INDICATE-READY -#?XSERVER-0 INDICATE-READY -#?XSERVER-0 ACCEPT-CONNECT - -# Session starts -#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_COOKIE=ck-cookie-x:0 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0 -#?XSERVER-0 ACCEPT-CONNECT -#?SESSION-X-0 CONNECT-XSERVER - -# Cleanup -#?*STOP-DAEMON -#?SESSION-X-0 TERMINATE SIGNAL=15 -#?XSERVER-0 TERMINATE SIGNAL=15 -#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/scripts/lock-seat-console-kit.conf b/tests/scripts/lock-seat-console-kit.conf deleted file mode 100644 index 61bd8540..00000000 --- a/tests/scripts/lock-seat-console-kit.conf +++ /dev/null @@ -1,62 +0,0 @@ -# -# Check can lock a seat from D-Bus using ConsoleKit -# - -[test-runner-config] -disable-login1=true - -[SeatDefaults] -autologin-user=have-password1 -user-session=default - -#?*START-DAEMON -#?RUNNER DAEMON-START - -# X server starts -#?XSERVER-0 START VT=7 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-0 INDICATE-READY -#?XSERVER-0 INDICATE-READY -#?XSERVER-0 ACCEPT-CONNECT - -# Session starts -#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_COOKIE=ck-cookie-x:0 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0 -#?XSERVER-0 ACCEPT-CONNECT -#?SESSION-X-0 CONNECT-XSERVER - -# Lock the seat -#?*SESSION-X-0 LOCK-SEAT -#?SESSION-X-0 LOCK-SEAT - -# New X server starts -#?XSERVER-1 START VT=8 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-1 INDICATE-READY -#?XSERVER-1 INDICATE-READY -#?XSERVER-1 ACCEPT-CONNECT - -# Session is locked -#?CONSOLE-KIT LOCK-SESSION - -# Greeter starts -#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_COOKIE=ck-cookie-x:1 XDG_SESSION_CLASS=greeter -#?XSERVER-1 ACCEPT-CONNECT -#?GREETER-X-1 CONNECT-XSERVER -#?GREETER-X-1 CONNECT-TO-DAEMON -#?GREETER-X-1 CONNECTED-TO-DAEMON -#?GREETER-X-1 LOCK-HINT - -# Switch to greeter -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:1 -#?VT ACTIVATE VT=8 - -# Cleanup -#?*STOP-DAEMON -#?SESSION-X-0 TERMINATE SIGNAL=15 -#?XSERVER-0 TERMINATE SIGNAL=15 -#?GREETER-X-1 TERMINATE SIGNAL=15 -#?XSERVER-1 TERMINATE SIGNAL=15 -#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/scripts/lock-seat-return-session-console-kit.conf b/tests/scripts/lock-seat-return-session-console-kit.conf deleted file mode 100644 index fbe786ec..00000000 --- a/tests/scripts/lock-seat-return-session-console-kit.conf +++ /dev/null @@ -1,78 +0,0 @@ -# -# Check can lock a seat from D-Bus and can return to it when using ConsoleKit -# - -[test-runner-config] -disable-login1=true - -[SeatDefaults] -autologin-user=have-password1 -user-session=default - -#?*START-DAEMON -#?RUNNER DAEMON-START - -# X server starts -#?XSERVER-0 START VT=7 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-0 INDICATE-READY -#?XSERVER-0 INDICATE-READY -#?XSERVER-0 ACCEPT-CONNECT - -# Session starts -#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_COOKIE=ck-cookie-x:0 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0 -#?XSERVER-0 ACCEPT-CONNECT -#?SESSION-X-0 CONNECT-XSERVER - -# Lock the seat -#?*SESSION-X-0 LOCK-SEAT -#?SESSION-X-0 LOCK-SEAT - -# New X server starts -#?XSERVER-1 START VT=8 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-1 INDICATE-READY -#?XSERVER-1 INDICATE-READY -#?XSERVER-1 ACCEPT-CONNECT - -# Session is locked -#?CONSOLE-KIT LOCK-SESSION - -# Greeter starts -#?GREETER-X-1 START XDG_SEAT=seat0 XDG_VTNR=8 XDG_SESSION_COOKIE=ck-cookie-x:1 XDG_SESSION_CLASS=greeter -#?XSERVER-1 ACCEPT-CONNECT -#?GREETER-X-1 CONNECT-XSERVER -#?GREETER-X-1 CONNECT-TO-DAEMON -#?GREETER-X-1 CONNECTED-TO-DAEMON -#?GREETER-X-1 LOCK-HINT - -# Switch to greeter -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:1 -#?VT ACTIVATE VT=8 - -# Login as existing user -#?*GREETER-X-1 AUTHENTICATE USERNAME=have-password1 -#?GREETER-X-1 SHOW-PROMPT TEXT="Password:" -#?*GREETER-X-1 RESPOND TEXT="password" -#?GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE -#?*GREETER-X-1 START-SESSION - -# Old session is unlocked -#?CONSOLE-KIT UNLOCK-SESSION - -# Return to session -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0 -#?VT ACTIVATE VT=7 - -# Greeter and X server stop -#?GREETER-X-1 TERMINATE SIGNAL=15 -#?XSERVER-1 TERMINATE SIGNAL=15 - -# Cleanup -#?*STOP-DAEMON -#?SESSION-X-0 TERMINATE SIGNAL=15 -#?XSERVER-0 TERMINATE SIGNAL=15 -#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/scripts/no-console-kit-or-login1.conf b/tests/scripts/no-console-kit-or-login1.conf deleted file mode 100644 index 4449fd5f..00000000 --- a/tests/scripts/no-console-kit-or-login1.conf +++ /dev/null @@ -1,33 +0,0 @@ -# -# Check still works when neither ConsoleKit or login1 is available -# - -[test-runner-config] -disable-console-kit=true -disable-login1=true - -[SeatDefaults] -autologin-user=have-password1 -user-session=default - -#?*START-DAEMON -#?RUNNER DAEMON-START - -# X server starts -#?XSERVER-0 START VT=7 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-0 INDICATE-READY -#?XSERVER-0 INDICATE-READY -#?XSERVER-0 ACCEPT-CONNECT - -# Session starts -#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 -#?XSERVER-0 ACCEPT-CONNECT -#?SESSION-X-0 CONNECT-XSERVER - -# Cleanup -#?*STOP-DAEMON -#?SESSION-X-0 TERMINATE SIGNAL=15 -#?XSERVER-0 TERMINATE SIGNAL=15 -#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/scripts/no-console-kit.conf b/tests/scripts/no-console-kit.conf deleted file mode 100644 index ae08ddcd..00000000 --- a/tests/scripts/no-console-kit.conf +++ /dev/null @@ -1,33 +0,0 @@ -# -# Check still works when ConsoleKit is not available -# - -[test-runner-config] -disable-console-kit=true - -[SeatDefaults] -autologin-user=have-password1 -user-session=default - -#?*START-DAEMON -#?RUNNER DAEMON-START - -# X server starts -#?XSERVER-0 START VT=7 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-0 INDICATE-READY -#?XSERVER-0 INDICATE-READY -#?XSERVER-0 ACCEPT-CONNECT - -# Session starts -#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 -#?LOGIN1 ACTIVATE-SESSION SESSION=c0 -#?XSERVER-0 ACCEPT-CONNECT -#?SESSION-X-0 CONNECT-XSERVER - -# Cleanup -#?*STOP-DAEMON -#?SESSION-X-0 TERMINATE SIGNAL=15 -#?XSERVER-0 TERMINATE SIGNAL=15 -#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/scripts/no-login1.conf b/tests/scripts/no-login1.conf index 4a283038..75c30732 100644 --- a/tests/scripts/no-login1.conf +++ b/tests/scripts/no-login1.conf @@ -21,8 +21,7 @@ user-session=default #?XSERVER-0 ACCEPT-CONNECT # Session starts -#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_COOKIE=ck-cookie-x:0 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0 +#?SESSION-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_GREETER_DATA_DIR=.*/have-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1 #?XSERVER-0 ACCEPT-CONNECT #?SESSION-X-0 CONNECT-XSERVER diff --git a/tests/scripts/power-no-console-kit.conf b/tests/scripts/power-no-console-kit.conf deleted file mode 100644 index 9d3b6060..00000000 --- a/tests/scripts/power-no-console-kit.conf +++ /dev/null @@ -1,67 +0,0 @@ -# -# Check can do power operations from the greeter when no ConsoleKit service -# - -[test-runner-config] -disable-console-kit=true - -#?*START-DAEMON -#?RUNNER DAEMON-START - -# X server starts -#?XSERVER-0 START VT=7 SEAT=seat0 - -# Daemon connects when X server is ready -#?*XSERVER-0 INDICATE-READY -#?XSERVER-0 INDICATE-READY -#?XSERVER-0 ACCEPT-CONNECT - -# Greeter starts -#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter -#?LOGIN1 ACTIVATE-SESSION SESSION=c0 -#?XSERVER-0 ACCEPT-CONNECT -#?GREETER-X-0 CONNECT-XSERVER -#?GREETER-X-0 CONNECT-TO-DAEMON -#?GREETER-X-0 CONNECTED-TO-DAEMON - -# See if can suspend -#?*GREETER-X-0 GET-CAN-SUSPEND -#?LOGIN1 CAN-SUSPEND -#?GREETER-X-0 CAN-SUSPEND ALLOWED=TRUE - -# Suspend -#?*GREETER-X-0 SUSPEND -#?LOGIN1 SUSPEND - -# See if can hibernate -#?*GREETER-X-0 GET-CAN-HIBERNATE -#?LOGIN1 CAN-HIBERNATE -#?GREETER-X-0 CAN-HIBERNATE ALLOWED=TRUE - -# Hibernate -#?*GREETER-X-0 HIBERNATE -#?LOGIN1 HIBERNATE - -# See if can restart -#?*GREETER-X-0 GET-CAN-RESTART -#?LOGIN1 CAN-REBOOT -#?GREETER-X-0 CAN-RESTART ALLOWED=TRUE - -# Restart -#?*GREETER-X-0 RESTART -#?LOGIN1 REBOOT - -# See if can shutdown -#?*GREETER-X-0 GET-CAN-SHUTDOWN -#?LOGIN1 CAN-POWER-OFF -#?GREETER-X-0 CAN-SHUTDOWN ALLOWED=TRUE - -# Shutdown -#?*GREETER-X-0 SHUTDOWN -#?LOGIN1 POWER-OFF - -# Cleanup -#?*STOP-DAEMON -#?GREETER-X-0 TERMINATE SIGNAL=15 -#?XSERVER-0 TERMINATE SIGNAL=15 -#?RUNNER DAEMON-EXIT STATUS=0 diff --git a/tests/scripts/power-no-login1.conf b/tests/scripts/power-no-login1.conf index 79df9b4c..fc55d05f 100644 --- a/tests/scripts/power-no-login1.conf +++ b/tests/scripts/power-no-login1.conf @@ -1,5 +1,5 @@ # -# Check can do power operations from the greeter when no login1 service (falls back to ConsoleKit) +# Check powe operations marked as disabled when no login1 service # [test-runner-config] @@ -17,8 +17,7 @@ disable-login1=true #?XSERVER-0 ACCEPT-CONNECT # Greeter starts -#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_COOKIE=ck-cookie-x:0 XDG_SESSION_CLASS=greeter -#?CONSOLE-KIT ACTIVATE-SESSION SESSION=ck-cookie-x:0 +#?GREETER-X-0 START XDG_SEAT=seat0 XDG_VTNR=7 XDG_SESSION_CLASS=greeter #?XSERVER-0 ACCEPT-CONNECT #?GREETER-X-0 CONNECT-XSERVER #?GREETER-X-0 CONNECT-TO-DAEMON @@ -44,21 +43,11 @@ disable-login1=true # See if can restart #?*GREETER-X-0 GET-CAN-RESTART -#?CONSOLE-KIT CAN-RESTART -#?GREETER-X-0 CAN-RESTART ALLOWED=TRUE - -# Restart -#?*GREETER-X-0 RESTART -#?CONSOLE-KIT RESTART +#?GREETER-X-0 CAN-RESTART ALLOWED=FALSE # See if can shutdown #?*GREETER-X-0 GET-CAN-SHUTDOWN -#?CONSOLE-KIT CAN-STOP -#?GREETER-X-0 CAN-SHUTDOWN ALLOWED=TRUE - -# Shutdown -#?*GREETER-X-0 SHUTDOWN -#?CONSOLE-KIT STOP +#?GREETER-X-0 CAN-SHUTDOWN ALLOWED=FALSE # Cleanup #?*STOP-DAEMON diff --git a/tests/scripts/power-no-services.conf b/tests/scripts/power-no-services.conf index 0180459d..f0d9b046 100644 --- a/tests/scripts/power-no-services.conf +++ b/tests/scripts/power-no-services.conf @@ -4,7 +4,6 @@ [test-runner-config] disable-upower=true -disable-console-kit=true disable-login1=true #?*START-DAEMON diff --git a/tests/src/test-gobject-greeter.c b/tests/src/test-gobject-greeter.c index 76d4df21..927586cd 100644 --- a/tests/src/test-gobject-greeter.c +++ b/tests/src/test-gobject-greeter.c @@ -407,7 +407,7 @@ connect_finished (GObject *object, GAsyncResult *result, gpointer data) int main (int argc, char **argv) { - gchar *display, *xdg_seat, *xdg_vtnr, *xdg_session_cookie, *xdg_session_class, *mir_socket, *mir_vt, *mir_id, *path; + gchar *display, *xdg_seat, *xdg_vtnr, *xdg_session_class, *mir_socket, *mir_vt, *mir_id, *path; GString *status_text; #if !defined(GLIB_VERSION_2_36) @@ -417,7 +417,6 @@ main (int argc, char **argv) display = getenv ("DISPLAY"); xdg_seat = getenv ("XDG_SEAT"); xdg_vtnr = getenv ("XDG_VTNR"); - xdg_session_cookie = getenv ("XDG_SESSION_COOKIE"); xdg_session_class = getenv ("XDG_SESSION_CLASS"); mir_socket = getenv ("MIR_SOCKET"); mir_vt = getenv ("MIR_SERVER_VT"); @@ -449,8 +448,6 @@ main (int argc, char **argv) g_string_append_printf (status_text, " XDG_SEAT=%s", xdg_seat); if (xdg_vtnr) g_string_append_printf (status_text, " XDG_VTNR=%s", xdg_vtnr); - if (xdg_session_cookie) - g_string_append_printf (status_text, " XDG_SESSION_COOKIE=%s", xdg_session_cookie); if (xdg_session_class) g_string_append_printf (status_text, " XDG_SESSION_CLASS=%s", xdg_session_class); if (mir_vt > 0) diff --git a/tests/src/test-python-greeter b/tests/src/test-python-greeter index 18385817..cf3d45c7 100755 --- a/tests/src/test-python-greeter +++ b/tests/src/test-python-greeter @@ -12,7 +12,6 @@ from gi.repository import LightDM display = os.getenv ('DISPLAY'); xdg_seat = os.getenv ('XDG_SEAT'); xdg_vtnr = os.getenv ('XDG_VTNR'); -xdg_session_cookie = os.getenv ('XDG_SESSION_COOKIE'); xdg_session_class = os.getenv ('XDG_SESSION_CLASS'); if display is not None: if display.startswith (':'): @@ -222,8 +221,6 @@ if xdg_seat is not None: status_text += ' XDG_SEAT=%s' % xdg_seat if xdg_vtnr is not None: status_text += ' XDG_VTNR=%s' % xdg_vtnr -if xdg_session_cookie is not None: - status_text += ' XDG_SESSION_COOKIE=%s' % xdg_session_cookie if xdg_session_class is not None: status_text += ' XDG_SESSION_CLASS=%s' % xdg_session_class status_notify (status_text) diff --git a/tests/src/test-qt-greeter.cpp b/tests/src/test-qt-greeter.cpp index 6c6e4cab..5a9806f5 100644 --- a/tests/src/test-qt-greeter.cpp +++ b/tests/src/test-qt-greeter.cpp @@ -245,7 +245,7 @@ request_cb (const gchar *name, GHashTable *params) int main(int argc, char *argv[]) { - gchar *display, *xdg_seat, *xdg_vtnr, *xdg_session_cookie, *xdg_session_class; + gchar *display, *xdg_seat, *xdg_vtnr, *xdg_session_class; GString *status_text; #if !defined(GLIB_VERSION_2_36) @@ -255,7 +255,6 @@ main(int argc, char *argv[]) display = getenv ("DISPLAY"); xdg_seat = getenv ("XDG_SEAT"); xdg_vtnr = getenv ("XDG_VTNR"); - xdg_session_cookie = getenv ("XDG_SESSION_COOKIE"); xdg_session_class = getenv ("XDG_SESSION_CLASS"); if (display) { @@ -285,8 +284,6 @@ main(int argc, char *argv[]) g_string_append_printf (status_text, " XDG_SEAT=%s", xdg_seat); if (xdg_vtnr) g_string_append_printf (status_text, " XDG_VTNR=%s", xdg_vtnr); - if (xdg_session_cookie) - g_string_append_printf (status_text, " XDG_SESSION_COOKIE=%s", xdg_session_cookie); if (xdg_session_class) g_string_append_printf (status_text, " XDG_SESSION_CLASS=%s", xdg_session_class); status_notify ("%s", status_text->str); diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c index dc12d475..356458bc 100644 --- a/tests/src/test-runner.c +++ b/tests/src/test-runner.c @@ -81,28 +81,6 @@ static const GDBusInterfaceVTable user_vtable = handle_user_call, handle_user_get_property, }; -static GDBusNodeInfo *ck_session_info; -typedef struct -{ - gchar *cookie; - gchar *path; - guint id; - gboolean locked; -} CKSession; -static GList *ck_sessions = NULL; -static gint ck_session_index = 0; -static void handle_ck_session_call (GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *method_name, - GVariant *parameters, - GDBusMethodInvocation *invocation, - gpointer user_data); -static const GDBusInterfaceVTable ck_session_vtable = -{ - handle_ck_session_call, -}; typedef struct { @@ -1208,249 +1186,6 @@ start_upower_daemon (void) NULL); } -static CKSession * -open_ck_session (GDBusConnection *connection, GVariant *params) -{ - CKSession *session; - GString *cookie; - GVariantIter *iter; - const gchar *name; - GVariant *value; - GError *error = NULL; - - session = g_malloc0 (sizeof (CKSession)); - ck_sessions = g_list_append (ck_sessions, session); - - cookie = g_string_new ("ck-cookie"); - g_variant_get (params, "a(sv)", &iter); - while (g_variant_iter_loop (iter, "(&sv)", &name, &value)) - { - if (strcmp (name, "x11-display") == 0) - { - const gchar *display; - g_variant_get (value, "&s", &display); - g_string_append_printf (cookie, "-x%s", display); - } - } - - session->cookie = cookie->str; - g_string_free (cookie, FALSE); - session->path = g_strdup_printf ("/org/freedesktop/ConsoleKit/Session%d", ck_session_index++); - session->id = g_dbus_connection_register_object (connection, - session->path, - ck_session_info->interfaces[0], - &ck_session_vtable, - session, - NULL, - &error); - if (error) - g_warning ("Failed to register CK Session: %s", error->message); - g_clear_error (&error); - - return session; -} - -static void -handle_ck_call (GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *method_name, - GVariant *parameters, - GDBusMethodInvocation *invocation, - gpointer user_data) -{ - if (strcmp (method_name, "CanRestart") == 0) - { - check_status ("CONSOLE-KIT CAN-RESTART"); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE)); - } - else if (strcmp (method_name, "CanStop") == 0) - { - check_status ("CONSOLE-KIT CAN-STOP"); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE)); - } - else if (strcmp (method_name, "CloseSession") == 0) - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(b)", TRUE)); - else if (strcmp (method_name, "OpenSession") == 0) - { - GVariantBuilder params; - g_variant_builder_init (¶ms, G_VARIANT_TYPE ("a(sv)")); - CKSession *session = open_ck_session (connection, g_variant_builder_end (¶ms)); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", session->cookie)); - } - else if (strcmp (method_name, "OpenSessionWithParameters") == 0) - { - CKSession *session = open_ck_session (connection, g_variant_get_child_value (parameters, 0)); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(s)", session->cookie)); - } - else if (strcmp (method_name, "GetSessionForCookie") == 0) - { - GList *link; - gchar *cookie; - - g_variant_get (parameters, "(&s)", &cookie); - - for (link = ck_sessions; link; link = link->next) - { - CKSession *session = link->data; - if (strcmp (session->cookie, cookie) == 0) - { - g_dbus_method_invocation_return_value (invocation, g_variant_new ("(o)", session->path)); - return; - } - } - - g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "Unable to find session for cookie"); - } - else if (strcmp (method_name, "Restart") == 0) - { - check_status ("CONSOLE-KIT RESTART"); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); - } - else if (strcmp (method_name, "Stop") == 0) - { - check_status ("CONSOLE-KIT STOP"); - g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); - } - else - g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name); -} - -static void -handle_ck_session_call (GDBusConnection *connection, - const gchar *sender, - const gchar *object_path, - const gchar *interface_name, - const gchar *method_name, - GVariant *parameters, - GDBusMethodInvocation *invocation, - gpointer user_data) -{ - CKSession *session = user_data; - - if (strcmp (method_name, "Lock") == 0) - { - if (!session->locked) - check_status ("CONSOLE-KIT LOCK-SESSION"); - session->locked = TRUE; - g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); - } - else if (strcmp (method_name, "Unlock") == 0) - { - if (session->locked) - check_status ("CONSOLE-KIT UNLOCK-SESSION"); - session->locked = FALSE; - g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); - } - else if (strcmp (method_name, "Activate") == 0) - { - gchar *status = g_strdup_printf ("CONSOLE-KIT ACTIVATE-SESSION SESSION=%s", session->cookie); - check_status (status); - g_free (status); - - g_dbus_method_invocation_return_value (invocation, g_variant_new ("()")); - } - else - g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED, "No such method: %s", method_name); -} - -static void -ck_name_acquired_cb (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - const gchar *ck_interface = - "<node>" - " <interface name='org.freedesktop.ConsoleKit.Manager'>" - " <method name='CanRestart'>" - " <arg name='can_restart' direction='out' type='b'/>" - " </method>" - " <method name='CanStop'>" - " <arg name='can_stop' direction='out' type='b'/>" - " </method>" - " <method name='CloseSession'>" - " <arg name='cookie' direction='in' type='s'/>" - " <arg name='result' direction='out' type='b'/>" - " </method>" - " <method name='OpenSession'>" - " <arg name='cookie' direction='out' type='s'/>" - " </method>" - " <method name='OpenSessionWithParameters'>" - " <arg name='parameters' direction='in' type='a(sv)'/>" - " <arg name='cookie' direction='out' type='s'/>" - " </method>" - " <method name='GetSessionForCookie'>" - " <arg name='cookie' direction='in' type='s'/>" - " <arg name='ssid' direction='out' type='o'/>" - " </method>" - " <method name='Restart'/>" - " <method name='Stop'/>" - " <signal name='SeatAdded'>" - " <arg name='seat' type='o'/>" - " </signal>" - " <signal name='SeatRemoved'>" - " <arg name='seat' type='o'/>" - " </signal>" - " </interface>" - "</node>"; - static const GDBusInterfaceVTable ck_vtable = - { - handle_ck_call, - }; - const gchar *ck_session_interface = - "<node>" - " <interface name='org.freedesktop.ConsoleKit.Session'>" - " <method name='Lock'/>" - " <method name='Unlock'/>" - " <method name='Activate'/>" - " </interface>" - "</node>"; - GDBusNodeInfo *ck_info; - GError *error = NULL; - - ck_info = g_dbus_node_info_new_for_xml (ck_interface, &error); - if (error) - g_warning ("Failed to parse D-Bus interface: %s", error->message); - g_clear_error (&error); - if (!ck_info) - return; - ck_session_info = g_dbus_node_info_new_for_xml (ck_session_interface, &error); - if (error) - g_warning ("Failed to parse D-Bus interface: %s", error->message); - g_clear_error (&error); - if (!ck_session_info) - return; - g_dbus_connection_register_object (connection, - "/org/freedesktop/ConsoleKit/Manager", - ck_info->interfaces[0], - &ck_vtable, - NULL, NULL, - &error); - if (error) - g_warning ("Failed to register console kit service: %s", error->message); - g_clear_error (&error); - g_dbus_node_info_unref (ck_info); - - service_count--; - if (service_count == 0) - ready (); -} - -static void -start_console_kit_daemon (void) -{ - service_count++; - g_bus_own_name (G_BUS_TYPE_SYSTEM, - "org.freedesktop.ConsoleKit", - G_BUS_NAME_OWNER_FLAGS_NONE, - NULL, - ck_name_acquired_cb, - NULL, - NULL, - NULL); -} - static void handle_login1_seat_call (GDBusConnection *connection, const gchar *sender, @@ -2798,8 +2533,6 @@ main (int argc, char **argv) /* Start D-Bus services */ if (!g_key_file_get_boolean (config, "test-runner-config", "disable-upower", NULL)) start_upower_daemon (); - if (!g_key_file_get_boolean (config, "test-runner-config", "disable-console-kit", NULL)) - start_console_kit_daemon (); if (!g_key_file_get_boolean (config, "test-runner-config", "disable-login1", NULL)) start_login1_daemon (); if (!g_key_file_get_boolean (config, "test-runner-config", "disable-accounts-service", NULL)) diff --git a/tests/src/test-session.c b/tests/src/test-session.c index 24cc2862..00b983c7 100644 --- a/tests/src/test-session.c +++ b/tests/src/test-session.c @@ -229,7 +229,7 @@ request_cb (const gchar *name, GHashTable *params) int main (int argc, char **argv) { - gchar *display, *xdg_seat, *xdg_vtnr, *xdg_current_desktop, *xdg_greeter_data_dir, *xdg_session_cookie, *xdg_session_class, *xdg_session_type, *xdg_session_desktop, *mir_socket, *mir_vt, *mir_id; + gchar *display, *xdg_seat, *xdg_vtnr, *xdg_current_desktop, *xdg_greeter_data_dir, *xdg_session_class, *xdg_session_type, *xdg_session_desktop, *mir_socket, *mir_vt, *mir_id; GString *status_text; int fd, open_max; @@ -238,7 +238,6 @@ main (int argc, char **argv) xdg_vtnr = getenv ("XDG_VTNR"); xdg_current_desktop = getenv ("XDG_CURRENT_DESKTOP"); xdg_greeter_data_dir = getenv ("XDG_GREETER_DATA_DIR"); - xdg_session_cookie = getenv ("XDG_SESSION_COOKIE"); xdg_session_class = getenv ("XDG_SESSION_CLASS"); xdg_session_type = getenv ("XDG_SESSION_TYPE"); xdg_session_desktop = getenv ("XDG_SESSION_DESKTOP"); @@ -290,8 +289,6 @@ main (int argc, char **argv) g_string_append_printf (status_text, " XDG_CURRENT_DESKTOP=%s", xdg_current_desktop); if (xdg_greeter_data_dir) g_string_append_printf (status_text, " XDG_GREETER_DATA_DIR=%s", xdg_greeter_data_dir); - if (xdg_session_cookie) - g_string_append_printf (status_text, " XDG_SESSION_COOKIE=%s", xdg_session_cookie); if (xdg_session_class) g_string_append_printf (status_text, " XDG_SESSION_CLASS=%s", xdg_session_class); if (xdg_session_type) diff --git a/tests/test-console-kit b/tests/test-console-kit deleted file mode 100755 index 1d7b34d6..00000000 --- a/tests/test-console-kit +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner console-kit test-gobject-greeter diff --git a/tests/test-lock-seat-console-kit b/tests/test-lock-seat-console-kit deleted file mode 100755 index 8e709687..00000000 --- a/tests/test-lock-seat-console-kit +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner lock-seat-console-kit test-gobject-greeter diff --git a/tests/test-lock-seat-return-session-console-kit b/tests/test-lock-seat-return-session-console-kit deleted file mode 100755 index 2a1df670..00000000 --- a/tests/test-lock-seat-return-session-console-kit +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner lock-seat-return-session-console-kit test-gobject-greeter diff --git a/tests/test-no-console-kit b/tests/test-no-console-kit deleted file mode 100755 index 6d1fd506..00000000 --- a/tests/test-no-console-kit +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner no-console-kit test-gobject-greeter diff --git a/tests/test-no-console-kit-or-login1 b/tests/test-no-console-kit-or-login1 deleted file mode 100755 index 9963ffc4..00000000 --- a/tests/test-no-console-kit-or-login1 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner no-console-kit-or-login1 test-gobject-greeter diff --git a/tests/test-power-no-console-kit-gobject b/tests/test-power-no-console-kit-gobject deleted file mode 100755 index 3bd175c3..00000000 --- a/tests/test-power-no-console-kit-gobject +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner power-no-console-kit test-gobject-greeter diff --git a/tests/test-power-no-console-kit-python b/tests/test-power-no-console-kit-python deleted file mode 100755 index 71361084..00000000 --- a/tests/test-power-no-console-kit-python +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner power-no-console-kit test-python-greeter diff --git a/tests/test-power-no-console-kit-qt4 b/tests/test-power-no-console-kit-qt4 deleted file mode 100755 index 91df1a1c..00000000 --- a/tests/test-power-no-console-kit-qt4 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner power-no-console-kit test-qt4-greeter diff --git a/tests/test-power-no-console-kit-qt5 b/tests/test-power-no-console-kit-qt5 deleted file mode 100755 index f8d2718f..00000000 --- a/tests/test-power-no-console-kit-qt5 +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -./src/dbus-env ./src/test-runner power-no-console-kit test-qt5-greeter |