diff options
author | Robert Ancell <robert.ancell@canonical.com> | 2014-10-01 10:11:16 +1300 |
---|---|---|
committer | Robert Ancell <robert.ancell@canonical.com> | 2014-10-01 10:11:16 +1300 |
commit | 2d206d412126971545ff9cb82351bfe4366b9c6d (patch) | |
tree | 52ec77f59d1a37ef7ca2785abf9ab41bf851c564 /tests/src | |
parent | 7ad9f9d8f3c389a0994d98b5cbf0dbf78b662791 (diff) | |
download | lightdm-2d206d412126971545ff9cb82351bfe4366b9c6d.tar.gz |
Remove ConsoleKit support since upstream is long dead. Please migrate to logind or use LightDM 1.10 if ConsoleKit support is required.
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/test-gobject-greeter.c | 5 | ||||
-rwxr-xr-x | tests/src/test-python-greeter | 3 | ||||
-rw-r--r-- | tests/src/test-qt-greeter.cpp | 5 | ||||
-rw-r--r-- | tests/src/test-runner.c | 267 | ||||
-rw-r--r-- | tests/src/test-session.c | 5 |
5 files changed, 3 insertions, 282 deletions
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) |