summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/lightdm.conf2
-rw-r--r--src/lightdm.c2
-rw-r--r--src/seat-surfaceflinger.c2
-rw-r--r--src/seat-unity.c2
-rw-r--r--src/seat-xlocal.c2
-rw-r--r--src/seat-xremote.c2
-rw-r--r--src/seat.c18
-rw-r--r--src/seat.h2
-rw-r--r--tests/Makefile.am6
-rw-r--r--tests/scripts/switch-to-greeter-disabled.conf39
-rw-r--r--tests/scripts/switch-to-greeter.conf4
-rw-r--r--tests/scripts/switch-to-guest-disabled.conf44
-rw-r--r--tests/scripts/switch-to-guest.conf8
-rw-r--r--tests/scripts/switch-to-user-disabled.conf40
-rw-r--r--tests/scripts/switch-to-user.conf4
-rw-r--r--tests/src/test-runner.c159
-rwxr-xr-xtests/test-switch-to-greeter-disabled2
-rwxr-xr-xtests/test-switch-to-guest-disabled2
-rwxr-xr-xtests/test-switch-to-user-disabled2
19 files changed, 286 insertions, 56 deletions
diff --git a/data/lightdm.conf b/data/lightdm.conf
index 8d2289fe..6bc0a0b5 100644
--- a/data/lightdm.conf
+++ b/data/lightdm.conf
@@ -56,6 +56,7 @@
# greeter-show-manual-login = True if the greeter should offer a manual login option
# greeter-show-remote-login = True if the greeter should offer a remote login option
# user-session = Session to load for users
+# allow-user-switching = True if allowed to switch users
# allow-guest = True if guest login is allowed
# guest-session = Session to load for guests (overrides user-session)
# session-wrapper = Wrapper script to run session with
@@ -97,6 +98,7 @@
#greeter-show-manual-login=false
#greeter-show-remote-login=true
#user-session=default
+#allow-user-switching=true
#allow-guest=true
#guest-session=
#session-wrapper=lightdm-session
diff --git a/src/lightdm.c b/src/lightdm.c
index 8642a8df..013a879a 100644
--- a/src/lightdm.c
+++ b/src/lightdm.c
@@ -1149,6 +1149,8 @@ main (int argc, char **argv)
config_set_string (config_get_instance (), "SeatDefaults", "unity-compositor-command", "unity-system-compositor");
if (!config_has_key (config_get_instance (), "SeatDefaults", "start-session"))
config_set_boolean (config_get_instance (), "SeatDefaults", "start-session", TRUE);
+ if (!config_has_key (config_get_instance (), "SeatDefaults", "allow-user-switching"))
+ config_set_boolean (config_get_instance (), "SeatDefaults", "allow-user-switching", TRUE);
if (!config_has_key (config_get_instance (), "SeatDefaults", "allow-guest"))
config_set_boolean (config_get_instance (), "SeatDefaults", "allow-guest", TRUE);
if (!config_has_key (config_get_instance (), "SeatDefaults", "greeter-allow-guest"))
diff --git a/src/seat-surfaceflinger.c b/src/seat-surfaceflinger.c
index f1338f5a..4bfdef15 100644
--- a/src/seat-surfaceflinger.c
+++ b/src/seat-surfaceflinger.c
@@ -20,7 +20,7 @@ G_DEFINE_TYPE (SeatSurfaceflinger, seat_surfaceflinger, SEAT_TYPE);
static void
seat_surfaceflinger_setup (Seat *seat)
{
- seat_set_can_switch (seat, FALSE);
+ seat_set_supports_multi_session (seat, FALSE);
SEAT_CLASS (seat_surfaceflinger_parent_class)->setup (seat);
}
diff --git a/src/seat-unity.c b/src/seat-unity.c
index fb2aafef..28a96f37 100644
--- a/src/seat-unity.c
+++ b/src/seat-unity.c
@@ -48,7 +48,7 @@ seat_unity_get_start_local_sessions (Seat *seat)
static void
seat_unity_setup (Seat *seat)
{
- seat_set_can_switch (seat, TRUE);
+ seat_set_supports_multi_session (seat, TRUE);
SEAT_CLASS (seat_unity_parent_class)->setup (seat);
}
diff --git a/src/seat-xlocal.c b/src/seat-xlocal.c
index 8dc9c66e..73cc1217 100644
--- a/src/seat-xlocal.c
+++ b/src/seat-xlocal.c
@@ -29,7 +29,7 @@ seat_xlocal_get_start_local_sessions (Seat *seat)
static void
seat_xlocal_setup (Seat *seat)
{
- seat_set_can_switch (seat, TRUE);
+ seat_set_supports_multi_session (seat, TRUE);
seat_set_share_display_server (seat, seat_get_boolean_property (seat, "xserver-share"));
SEAT_CLASS (seat_xlocal_parent_class)->setup (seat);
}
diff --git a/src/seat-xremote.c b/src/seat-xremote.c
index 63afa1a0..44cafc49 100644
--- a/src/seat-xremote.c
+++ b/src/seat-xremote.c
@@ -20,7 +20,7 @@ G_DEFINE_TYPE (SeatXRemote, seat_xremote, SEAT_TYPE);
static void
seat_xremote_setup (Seat *seat)
{
- seat_set_can_switch (seat, FALSE);
+ seat_set_supports_multi_session (seat, FALSE);
SEAT_CLASS (seat_xremote_parent_class)->setup (seat);
}
diff --git a/src/seat.c b/src/seat.c
index 41d6c38b..787e3c69 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -34,7 +34,7 @@ struct SeatPrivate
GHashTable *properties;
/* TRUE if able to switch users */
- gboolean can_switch;
+ gboolean supports_multi_session;
/* TRUE if display server can be shared for sessions */
gboolean share_display_server;
@@ -165,18 +165,16 @@ seat_get_name (Seat *seat)
}
void
-seat_set_can_switch (Seat *seat, gboolean can_switch)
+seat_set_supports_multi_session (Seat *seat, gboolean supports_multi_session)
{
g_return_if_fail (seat != NULL);
-
- seat->priv->can_switch = can_switch;
+ seat->priv->supports_multi_session = supports_multi_session;
}
void
seat_set_share_display_server (Seat *seat, gboolean share_display_server)
{
g_return_if_fail (seat != NULL);
-
seat->priv->share_display_server = share_display_server;
}
@@ -273,7 +271,7 @@ gboolean
seat_get_can_switch (Seat *seat)
{
g_return_val_if_fail (seat != NULL, FALSE);
- return seat->priv->can_switch;
+ return seat_get_boolean_property (seat, "allow-user-switching") && seat->priv->supports_multi_session;
}
gboolean
@@ -1359,7 +1357,7 @@ seat_switch_to_greeter (Seat *seat)
g_return_val_if_fail (seat != NULL, FALSE);
- if (!seat->priv->can_switch)
+ if (!seat_get_can_switch (seat))
return FALSE;
/* Switch to greeter if one open */
@@ -1465,7 +1463,7 @@ seat_switch_to_user (Seat *seat, const gchar *username, const gchar *session_nam
g_return_val_if_fail (seat != NULL, FALSE);
g_return_val_if_fail (username != NULL, FALSE);
- if (!seat->priv->can_switch)
+ if (!seat_get_can_switch (seat))
return FALSE;
/* If we're already on this session, then ignore */
@@ -1506,7 +1504,7 @@ seat_switch_to_guest (Seat *seat, const gchar *session_name)
g_return_val_if_fail (seat != NULL, FALSE);
- if (!seat->priv->can_switch || !seat_get_allow_guest (seat))
+ if (!seat_get_can_switch (seat) || !seat_get_allow_guest (seat))
return FALSE;
/* Switch to session if one open */
@@ -1542,7 +1540,7 @@ seat_lock (Seat *seat, const gchar *username)
g_return_val_if_fail (seat != NULL, FALSE);
- if (!seat->priv->can_switch)
+ if (!seat_get_can_switch (seat))
return FALSE;
l_debug (seat, "Locking");
diff --git a/src/seat.h b/src/seat.h
index 0a470bc4..093f26eb 100644
--- a/src/seat.h
+++ b/src/seat.h
@@ -75,7 +75,7 @@ gint seat_get_integer_property (Seat *seat, const gchar *name);
const gchar *seat_get_name (Seat *seat);
-void seat_set_can_switch (Seat *seat, gboolean can_switch);
+void seat_set_supports_multi_session (Seat *seat, gboolean supports_multi_session);
void seat_set_share_display_server (Seat *seat, gboolean share_display_server);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ad2d22ad..172d31f3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -138,14 +138,17 @@ TESTS = \
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 \
test-switch-to-greeter-resettable \
test-switch-to-greeter-return-session \
test-switch-to-greeter-return-session-pam \
test-switch-to-greeter-return-session-logout \
test-switch-to-guest \
+ test-switch-to-guest-disabled \
test-switch-to-guest-fail-resettable \
test-switch-to-user \
+ test-switch-to-user-disabled \
test-switch-to-user-no-password \
test-switch-to-user-active \
test-switch-to-user-existing \
@@ -473,16 +476,19 @@ EXTRA_DIST = \
scripts/session-stderr-backup.conf \
scripts/surfaceflinger-autologin.conf \
scripts/switch-to-greeter.conf \
+ scripts/switch-to-greeter-disabled.conf \
scripts/switch-to-greeter-new-session.conf \
scripts/switch-to-greeter-resettable.conf \
scripts/switch-to-greeter-return-session.conf \
scripts/switch-to-greeter-return-session-logout.conf \
scripts/switch-to-greeter-return-session-pam.conf \
scripts/switch-to-guest.conf \
+ scripts/switch-to-guest-disabled.conf \
scripts/switch-to-guest-fail-resettable.conf \
scripts/switch-to-user.conf \
scripts/switch-to-users.conf \
scripts/switch-to-user-active.conf \
+ scripts/switch-to-user-disabled.conf \
scripts/switch-to-user-existing.conf \
scripts/switch-to-user-existing-no-password.conf \
scripts/switch-to-user-existing-resettable.conf \
diff --git a/tests/scripts/switch-to-greeter-disabled.conf b/tests/scripts/switch-to-greeter-disabled.conf
new file mode 100644
index 00000000..23634f1b
--- /dev/null
+++ b/tests/scripts/switch-to-greeter-disabled.conf
@@ -0,0 +1,39 @@
+#
+# Check can't switch to greeter when disabled
+#
+
+[SeatDefaults]
+autologin-user=have-password1
+user-session=default
+allow-user-switching=false
+
+#?*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
+
+# Check daemon says we can't switch
+#?*SEAT-CAN-SWITCH
+#?RUNNER SEAT-CAN-SWITCH CAN-SWITCH=FALSE
+
+# Attempt to show the greeter
+#?*SWITCH-TO-GREETER
+#?RUNNER SWITCH-TO-GREETER FAILED
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/switch-to-greeter.conf b/tests/scripts/switch-to-greeter.conf
index d91bae5a..e3f6f752 100644
--- a/tests/scripts/switch-to-greeter.conf
+++ b/tests/scripts/switch-to-greeter.conf
@@ -23,6 +23,10 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
#?SESSION-X-0 CONNECT-XSERVER
+# Check daemon says we can switch
+#?*SEAT-CAN-SWITCH
+#?RUNNER SEAT-CAN-SWITCH CAN-SWITCH=TRUE
+
# Show the greeter
#?*SWITCH-TO-GREETER
#?RUNNER SWITCH-TO-GREETER
diff --git a/tests/scripts/switch-to-guest-disabled.conf b/tests/scripts/switch-to-guest-disabled.conf
new file mode 100644
index 00000000..ceca7096
--- /dev/null
+++ b/tests/scripts/switch-to-guest-disabled.conf
@@ -0,0 +1,44 @@
+#
+# Check can't switch to guest when disabled
+#
+
+[SeatDefaults]
+autologin-user=have-password1
+user-session=default
+allow-user-switching=false
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+#?*WAIT
+
+# 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
+
+# Default 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
+
+# Check daemon says we can't switch
+#?*SEAT-CAN-SWITCH
+#?RUNNER SEAT-CAN-SWITCH CAN-SWITCH=FALSE
+
+# Check daemon says we have a guest account
+#?*SEAT-HAS-GUEST-ACCOUNT
+#?RUNNER SEAT-HAS-GUEST-ACCOUNT HAS-GUEST-ACCOUNT=TRUE
+
+# Attempt to switch to guest
+#?*SWITCH-TO-GUEST
+#?RUNNER SWITCH-TO-GUEST FAILED
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/switch-to-guest.conf b/tests/scripts/switch-to-guest.conf
index b993af77..cc59cca1 100644
--- a/tests/scripts/switch-to-guest.conf
+++ b/tests/scripts/switch-to-guest.conf
@@ -24,6 +24,14 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
#?SESSION-X-0 CONNECT-XSERVER
+# Check daemon says we can switch
+#?*SEAT-CAN-SWITCH
+#?RUNNER SEAT-CAN-SWITCH CAN-SWITCH=TRUE
+
+# Check daemon says we have a guest account
+#?*SEAT-HAS-GUEST-ACCOUNT
+#?RUNNER SEAT-HAS-GUEST-ACCOUNT HAS-GUEST-ACCOUNT=TRUE
+
# Switch to guest
#?*SWITCH-TO-GUEST
#?RUNNER SWITCH-TO-GUEST
diff --git a/tests/scripts/switch-to-user-disabled.conf b/tests/scripts/switch-to-user-disabled.conf
new file mode 100644
index 00000000..c3fbc6b5
--- /dev/null
+++ b/tests/scripts/switch-to-user-disabled.conf
@@ -0,0 +1,40 @@
+#
+# Check that can't switch to a user when switching disabled
+#
+
+[SeatDefaults]
+autologin-user=no-password1
+user-session=default
+allow-user-switching=false
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+#?*WAIT
+
+# 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=.*/no-password1 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=no-password1
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Check daemon says we can't switch
+#?*SEAT-CAN-SWITCH
+#?RUNNER SEAT-CAN-SWITCH CAN-SWITCH=FALSE
+
+# Attempt to switch to an account
+#?*SWITCH-TO-USER USERNAME=have-password1
+#?RUNNER SWITCH-TO-USER USERNAME=have-password1 FAILED
+
+# Cleanup
+#?*STOP-DAEMON
+#?SESSION-X-0 TERMINATE SIGNAL=15
+#?XSERVER-0 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/switch-to-user.conf b/tests/scripts/switch-to-user.conf
index c6ea69ac..5789af4c 100644
--- a/tests/scripts/switch-to-user.conf
+++ b/tests/scripts/switch-to-user.conf
@@ -24,6 +24,10 @@ user-session=default
#?XSERVER-0 ACCEPT-CONNECT
#?SESSION-X-0 CONNECT-XSERVER
+# Check daemon says we can switch
+#?*SEAT-CAN-SWITCH
+#?RUNNER SEAT-CAN-SWITCH CAN-SWITCH=TRUE
+
# Switch to an account with a password
#?*SWITCH-TO-USER USERNAME=have-password1
#?RUNNER SWITCH-TO-USER USERNAME=have-password1
diff --git a/tests/src/test-runner.c b/tests/src/test-runner.c
index dc1a384d..f1792fc2 100644
--- a/tests/src/test-runner.c
+++ b/tests/src/test-runner.c
@@ -463,7 +463,7 @@ handle_command (const gchar *command)
g_variant_new ("(ss)", "org.freedesktop.DisplayManager", "Seats"),
G_VARIANT_TYPE ("(v)"),
G_DBUS_CALL_FLAGS_NONE,
- 1000,
+ G_MAXINT,
NULL,
NULL);
@@ -499,7 +499,7 @@ handle_command (const gchar *command)
g_variant_new ("(ss)", "org.freedesktop.DisplayManager", "Sessions"),
G_VARIANT_TYPE ("(v)"),
G_DBUS_CALL_FLAGS_NONE,
- 1000,
+ G_MAXINT,
NULL,
NULL);
@@ -519,55 +519,132 @@ handle_command (const gchar *command)
check_status (status->str);
g_string_free (status, TRUE);
}
+ else if (strcmp (name, "SEAT-CAN-SWITCH") == 0)
+ {
+ GVariant *result, *value;
+ gchar *status;
+
+ result = g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
+ "org.freedesktop.DisplayManager",
+ "/org/freedesktop/DisplayManager/Seat0",
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ g_variant_new ("(ss)", "org.freedesktop.DisplayManager.Seat", "CanSwitch"),
+ G_VARIANT_TYPE ("(v)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ NULL);
+
+ g_variant_get (result, "(v)", &value);
+ status = g_strdup_printf ("RUNNER SEAT-CAN-SWITCH CAN-SWITCH=%s", g_variant_get_boolean (value) ? "TRUE" : "FALSE");
+ g_variant_unref (value);
+ g_variant_unref (result);
+ check_status (status);
+ g_free (status);
+ }
+ else if (strcmp (name, "SEAT-HAS-GUEST-ACCOUNT") == 0)
+ {
+ GVariant *result, *value;
+ gchar *status;
+
+ result = g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
+ "org.freedesktop.DisplayManager",
+ "/org/freedesktop/DisplayManager/Seat0",
+ "org.freedesktop.DBus.Properties",
+ "Get",
+ g_variant_new ("(ss)", "org.freedesktop.DisplayManager.Seat", "HasGuestAccount"),
+ G_VARIANT_TYPE ("(v)"),
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ NULL);
+
+ g_variant_get (result, "(v)", &value);
+ status = g_strdup_printf ("RUNNER SEAT-HAS-GUEST-ACCOUNT HAS-GUEST-ACCOUNT=%s", g_variant_get_boolean (value) ? "TRUE" : "FALSE");
+ g_variant_unref (value);
+ g_variant_unref (result);
+ check_status (status);
+ g_free (status);
+ }
else if (strcmp (name, "SWITCH-TO-GREETER") == 0)
{
- g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
- "org.freedesktop.DisplayManager",
- "/org/freedesktop/DisplayManager/Seat0",
- "org.freedesktop.DisplayManager.Seat",
- "SwitchToGreeter",
- g_variant_new ("()"),
- G_VARIANT_TYPE ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- 1000,
- NULL,
- NULL);
- check_status ("RUNNER SWITCH-TO-GREETER");
+ GVariant *result;
+
+ result = g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
+ "org.freedesktop.DisplayManager",
+ "/org/freedesktop/DisplayManager/Seat0",
+ "org.freedesktop.DisplayManager.Seat",
+ "SwitchToGreeter",
+ g_variant_new ("()"),
+ G_VARIANT_TYPE ("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ NULL);
+ if (result)
+ {
+ check_status ("RUNNER SWITCH-TO-GREETER");
+ g_variant_unref (result);
+ }
+ else
+ check_status ("RUNNER SWITCH-TO-GREETER FAILED");
}
else if (strcmp (name, "SWITCH-TO-USER") == 0)
{
- gchar *status_text, *username;
+ GVariant *result;
+ const gchar *username;
username = g_hash_table_lookup (params, "USERNAME");
- g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
- "org.freedesktop.DisplayManager",
- "/org/freedesktop/DisplayManager/Seat0",
- "org.freedesktop.DisplayManager.Seat",
- "SwitchToUser",
- g_variant_new ("(ss)", username, ""),
- G_VARIANT_TYPE ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- 1000,
- NULL,
- NULL);
- status_text = g_strdup_printf ("RUNNER SWITCH-TO-USER USERNAME=%s", username);
- check_status (status_text);
- g_free (status_text);
+ result = g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
+ "org.freedesktop.DisplayManager",
+ "/org/freedesktop/DisplayManager/Seat0",
+ "org.freedesktop.DisplayManager.Seat",
+ "SwitchToUser",
+ g_variant_new ("(ss)", username, ""),
+ G_VARIANT_TYPE ("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ NULL);
+ if (result)
+ {
+ gchar *status_text;
+ status_text = g_strdup_printf ("RUNNER SWITCH-TO-USER USERNAME=%s", username);
+ check_status (status_text);
+ g_free (status_text);
+ g_variant_unref (result);
+ }
+ else
+ {
+ gchar *status_text;
+ status_text = g_strdup_printf ("RUNNER SWITCH-TO-USER USERNAME=%s FAILED", username);
+ check_status (status_text);
+ g_free (status_text);
+ }
}
else if (strcmp (name, "SWITCH-TO-GUEST") == 0)
{
- g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
- "org.freedesktop.DisplayManager",
- "/org/freedesktop/DisplayManager/Seat0",
- "org.freedesktop.DisplayManager.Seat",
- "SwitchToGuest",
- g_variant_new ("(s)", ""),
- G_VARIANT_TYPE ("()"),
- G_DBUS_CALL_FLAGS_NONE,
- 1000,
- NULL,
- NULL);
- check_status ("RUNNER SWITCH-TO-GUEST");
+ GVariant *result;
+
+ result = g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL),
+ "org.freedesktop.DisplayManager",
+ "/org/freedesktop/DisplayManager/Seat0",
+ "org.freedesktop.DisplayManager.Seat",
+ "SwitchToGuest",
+ g_variant_new ("(s)", ""),
+ G_VARIANT_TYPE ("()"),
+ G_DBUS_CALL_FLAGS_NONE,
+ G_MAXINT,
+ NULL,
+ NULL);
+ if (result)
+ {
+ check_status ("RUNNER SWITCH-TO-GUEST");
+ g_variant_unref (result);
+ }
+ else
+ check_status ("RUNNER SWITCH-TO-GUEST FAILED");
}
else if (strcmp (name, "STOP-DAEMON") == 0)
stop_process (lightdm_process);
diff --git a/tests/test-switch-to-greeter-disabled b/tests/test-switch-to-greeter-disabled
new file mode 100755
index 00000000..8f64682b
--- /dev/null
+++ b/tests/test-switch-to-greeter-disabled
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner switch-to-greeter-disabled test-gobject-greeter
diff --git a/tests/test-switch-to-guest-disabled b/tests/test-switch-to-guest-disabled
new file mode 100755
index 00000000..11e41c76
--- /dev/null
+++ b/tests/test-switch-to-guest-disabled
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner switch-to-guest-disabled test-gobject-greeter
diff --git a/tests/test-switch-to-user-disabled b/tests/test-switch-to-user-disabled
new file mode 100755
index 00000000..c2cd7494
--- /dev/null
+++ b/tests/test-switch-to-user-disabled
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner switch-to-user-disabled test-gobject-greeter