summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/display.c6
-rw-r--r--src/display.h2
-rw-r--r--src/seat.c18
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/scripts/lock-seat-return-session.conf61
-rw-r--r--tests/scripts/lock-seat.conf18
-rw-r--r--tests/scripts/lock-session-return-session.conf61
-rw-r--r--tests/scripts/lock-session.conf18
-rwxr-xr-xtests/test-lock-seat-return-session2
-rwxr-xr-xtests/test-lock-session-return-session2
10 files changed, 150 insertions, 42 deletions
diff --git a/src/display.c b/src/display.c
index 4cf88a34..92c25dba 100644
--- a/src/display.c
+++ b/src/display.c
@@ -85,6 +85,7 @@ struct DisplayPrivate
/* Hint to select user in greeter */
gchar *select_user_hint;
gboolean select_guest_hint;
+ gboolean select_user_attempt_login;
/* TRUE if allowed to log into guest account */
gboolean allow_guest;
@@ -188,12 +189,13 @@ display_set_autologin_user (Display *display, const gchar *username, gboolean is
}
void
-display_set_select_user_hint (Display *display, const gchar *username, gboolean is_guest)
+display_set_select_user_hint (Display *display, const gchar *username, gboolean is_guest, gboolean attempt_login)
{
g_return_if_fail (display != NULL);
g_free (display->priv->select_user_hint);
display->priv->select_user_hint = g_strdup (username);
display->priv->select_guest_hint = is_guest;
+ display->priv->select_user_attempt_login = attempt_login;
}
void
@@ -783,7 +785,7 @@ display_server_ready_cb (DisplayServer *display_server, Display *display)
g_debug ("Automatically logging in user %s", display->priv->autologin_user);
result = autologin (display, display->priv->autologin_user, AUTOLOGIN_SERVICE, TRUE, FALSE);
}
- else if (display->priv->select_user_hint)
+ else if (display->priv->select_user_hint && display->priv->select_user_attempt_login)
{
g_debug ("Logging in user %s", display->priv->select_user_hint);
result = autologin (display, display->priv->select_user_hint, USER_SERVICE, TRUE, FALSE);
diff --git a/src/display.h b/src/display.h
index 6da1b1a5..e5724fb4 100644
--- a/src/display.h
+++ b/src/display.h
@@ -68,7 +68,7 @@ void display_set_greeter_allow_guest (Display *display, gboolean greeter_allow_g
void display_set_autologin_user (Display *display, const gchar *username, gboolean is_guest, gint timeout);
-void display_set_select_user_hint (Display *display, const gchar *username, gboolean is_guest);
+void display_set_select_user_hint (Display *display, const gchar *username, gboolean is_guest, gboolean attempt_login);
void display_set_hide_users_hint (Display *display, gboolean hide_users);
diff --git a/src/seat.c b/src/seat.c
index c75e85d5..3d72718a 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -475,7 +475,7 @@ display_stopped_cb (Display *display, Seat *seat)
}
static gboolean
-switch_to_user_or_start_greeter (Seat *seat, const gchar *username, gboolean use_existing, gboolean is_guest, const gchar *session_name, gboolean is_lock, gboolean autologin, int autologin_timeout)
+switch_to_user_or_start_greeter (Seat *seat, const gchar *username, gboolean use_existing, gboolean is_guest, const gchar *session_name, gboolean is_lock, gboolean attempt_login, gboolean autologin, int autologin_timeout)
{
Display *display;
DisplayServer *display_server;
@@ -532,7 +532,7 @@ switch_to_user_or_start_greeter (Seat *seat, const gchar *username, gboolean use
if (autologin)
display_set_autologin_user (display, username, is_guest, autologin_timeout);
else
- display_set_select_user_hint (display, username, is_guest);
+ display_set_select_user_hint (display, username, is_guest, attempt_login);
if (!session_name)
session_name = seat_get_string_property (seat, "user-session");
display_set_user_session (display, SESSION_TYPE_LOCAL, session_name);
@@ -556,7 +556,7 @@ seat_switch_to_greeter (Seat *seat)
return FALSE;
g_debug ("Switching to greeter");
- return switch_to_user_or_start_greeter (seat, NULL, TRUE, FALSE, NULL, FALSE, FALSE, 0);
+ return switch_to_user_or_start_greeter (seat, NULL, TRUE, FALSE, NULL, FALSE, FALSE, FALSE, 0);
}
gboolean
@@ -569,7 +569,7 @@ seat_switch_to_user (Seat *seat, const gchar *username, const gchar *session_nam
return FALSE;
g_debug ("Switching to user %s", username);
- return switch_to_user_or_start_greeter (seat, username, TRUE, FALSE, session_name, FALSE, FALSE, 0);
+ return switch_to_user_or_start_greeter (seat, username, TRUE, FALSE, session_name, FALSE, TRUE, FALSE, 0);
}
gboolean
@@ -584,7 +584,7 @@ seat_switch_to_guest (Seat *seat, const gchar *session_name)
g_debug ("Switching to existing guest account %s", seat->priv->guest_username);
else
g_debug ("Switching to new guest account");
- return switch_to_user_or_start_greeter (seat, seat->priv->guest_username, TRUE, TRUE, session_name, FALSE, TRUE, 0);
+ return switch_to_user_or_start_greeter (seat, seat->priv->guest_username, TRUE, TRUE, session_name, FALSE, FALSE, TRUE, 0);
}
gboolean
@@ -596,7 +596,7 @@ seat_lock (Seat *seat, const gchar *username)
return FALSE;
g_debug ("Locking seat");
- return switch_to_user_or_start_greeter (seat, username, FALSE, FALSE, NULL, TRUE, FALSE, 0);
+ return switch_to_user_or_start_greeter (seat, username, FALSE, FALSE, NULL, TRUE, FALSE, FALSE, 0);
}
void
@@ -639,11 +639,11 @@ seat_real_start (Seat *seat)
autologin_timeout = seat_get_integer_property (seat, "autologin-user-timeout");
if (autologin_username)
- return switch_to_user_or_start_greeter (seat, autologin_username, TRUE, FALSE, NULL, FALSE, TRUE, autologin_timeout);
+ return switch_to_user_or_start_greeter (seat, autologin_username, TRUE, FALSE, NULL, FALSE, FALSE, TRUE, autologin_timeout);
else if (seat_get_boolean_property (seat, "autologin-guest"))
- return switch_to_user_or_start_greeter (seat, NULL, TRUE, TRUE, NULL, FALSE, TRUE, autologin_timeout);
+ return switch_to_user_or_start_greeter (seat, NULL, TRUE, TRUE, NULL, FALSE, FALSE, TRUE, autologin_timeout);
else
- return switch_to_user_or_start_greeter (seat, NULL, TRUE, FALSE, NULL, FALSE, FALSE, 0);
+ return switch_to_user_or_start_greeter (seat, NULL, TRUE, FALSE, NULL, FALSE, FALSE, FALSE, 0);
}
static void
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 1b4bc54e..221ad651 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -109,7 +109,9 @@ TESTS = \
test-script-hook-fail-greeter-setup \
test-script-hook-fail-session-setup \
test-lock-seat \
+ test-lock-seat-return-session \
test-lock-session \
+ test-lock-session-return-session \
test-switch-to-greeter \
test-switch-to-greeter-new-session \
test-switch-to-greeter-new-session-logout-new \
@@ -239,7 +241,9 @@ EXTRA_DIST = \
scripts/language.conf \
scripts/language-no-accounts-service.conf \
scripts/lock-seat.conf \
+ scripts/lock-seat-return-session.conf \
scripts/lock-session.conf \
+ scripts/lock-session-return-session.conf \
scripts/login.conf \
scripts/login-crash-authenticate.conf \
scripts/login-guest.conf \
diff --git a/tests/scripts/lock-seat-return-session.conf b/tests/scripts/lock-seat-return-session.conf
new file mode 100644
index 00000000..ad9a7684
--- /dev/null
+++ b/tests/scripts/lock-seat-return-session.conf
@@ -0,0 +1,61 @@
+#
+# Check can lock a seat from D-Bus and can return to it
+#
+
+[LightDM]
+minimum-display-number=50
+
+[SeatDefaults]
+autologin-user=have-password1
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER :50 START
+#?XSERVER :50 INDICATE-READY
+
+# LightDM connects to X server
+#?XSERVER :50 ACCEPT-CONNECT
+
+# Session starts
+#?SESSION :50 START USER=have-password1
+#?XSERVER :50 ACCEPT-CONNECT
+#?SESSION :50 CONNECT-XSERVER
+
+# Lock the seat
+#?*SESSION :50 LOCK-SEAT
+#?SESSION :50 LOCK-SEAT
+
+# New X server starts
+#?XSERVER :51 START
+#?XSERVER :51 INDICATE-READY
+
+# LightDM connects to X server
+#?XSERVER :51 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER :51 START
+#?XSERVER :51 ACCEPT-CONNECT
+#?GREETER :51 CONNECT-XSERVER
+#?GREETER :51 CONNECT-TO-DAEMON
+#?GREETER :51 CONNECTED-TO-DAEMON
+#?GREETER :51 LOCK-HINT
+
+
+# Login as existing user
+#?*GREETER :51 AUTHENTICATE USERNAME=have-password1
+#?GREETER :51 SHOW-PROMPT TEXT="Password:"
+#?*GREETER :51 RESPOND TEXT="password"
+#?GREETER :51 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
+#?*GREETER :51 START-SESSION
+
+# Greeter and X server stop
+#?GREETER :51 TERMINATE SIGNAL=15
+#?XSERVER :51 TERMINATE SIGNAL=15
+
+# Cleanup
+#?*STOP-DAEMON
+# Don't know what order they will terminate
+#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
+#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/lock-seat.conf b/tests/scripts/lock-seat.conf
index 85376aa9..fd9fece0 100644
--- a/tests/scripts/lock-seat.conf
+++ b/tests/scripts/lock-seat.conf
@@ -5,6 +5,9 @@
[LightDM]
minimum-display-number=50
+[SeatDefaults]
+autologin-user=have-password1
+
#?RUNNER DAEMON-START
# X server starts
@@ -14,21 +17,6 @@ minimum-display-number=50
# LightDM connects to X server
#?XSERVER :50 ACCEPT-CONNECT
-# Greeter starts
-#?GREETER :50 START
-#?XSERVER :50 ACCEPT-CONNECT
-#?GREETER :50 CONNECT-XSERVER
-#?GREETER :50 CONNECT-TO-DAEMON
-#?GREETER :50 CONNECTED-TO-DAEMON
-
-# Login
-#?*GREETER :50 AUTHENTICATE USERNAME=have-password1
-#?GREETER :50 SHOW-PROMPT TEXT="Password:"
-#?*GREETER :50 RESPOND TEXT="password"
-#?GREETER :50 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
-#?*GREETER :50 START-SESSION
-#?GREETER :50 TERMINATE SIGNAL=15
-
# Session starts
#?SESSION :50 START USER=have-password1
#?XSERVER :50 ACCEPT-CONNECT
diff --git a/tests/scripts/lock-session-return-session.conf b/tests/scripts/lock-session-return-session.conf
new file mode 100644
index 00000000..4580b995
--- /dev/null
+++ b/tests/scripts/lock-session-return-session.conf
@@ -0,0 +1,61 @@
+#
+# Check can lock a session from D-Bus and can return to it
+#
+
+[LightDM]
+minimum-display-number=50
+
+[SeatDefaults]
+autologin-user=have-password1
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER :50 START
+#?XSERVER :50 INDICATE-READY
+
+# LightDM connects to X server
+#?XSERVER :50 ACCEPT-CONNECT
+
+# Session starts
+#?SESSION :50 START USER=have-password1
+#?XSERVER :50 ACCEPT-CONNECT
+#?SESSION :50 CONNECT-XSERVER
+
+# Lock the session
+#?*SESSION :50 LOCK-SESSION
+#?SESSION :50 LOCK-SESSION
+
+# New X server starts
+#?XSERVER :51 START
+#?XSERVER :51 INDICATE-READY
+
+# LightDM connects to X server
+#?XSERVER :51 ACCEPT-CONNECT
+
+# Greeter starts with session user selected
+#?GREETER :51 START
+#?XSERVER :51 ACCEPT-CONNECT
+#?GREETER :51 CONNECT-XSERVER
+#?GREETER :51 CONNECT-TO-DAEMON
+#?GREETER :51 CONNECTED-TO-DAEMON
+#?GREETER :51 SELECT-USER-HINT USERNAME=have-password1
+#?GREETER :51 LOCK-HINT
+
+# Login as existing user
+#?*GREETER :51 AUTHENTICATE USERNAME=have-password1
+#?GREETER :51 SHOW-PROMPT TEXT="Password:"
+#?*GREETER :51 RESPOND TEXT="password"
+#?GREETER :51 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
+#?*GREETER :51 START-SESSION
+
+# Greeter and X server stop
+#?GREETER :51 TERMINATE SIGNAL=15
+#?XSERVER :51 TERMINATE SIGNAL=15
+
+# Cleanup
+#?*STOP-DAEMON
+# Don't know what order they will terminate
+#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
+#?(SESSION :50 TERMINATE SIGNAL=15|XSERVER :50 TERMINATE SIGNAL=15)
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/scripts/lock-session.conf b/tests/scripts/lock-session.conf
index 4bc5527b..e95bc1d6 100644
--- a/tests/scripts/lock-session.conf
+++ b/tests/scripts/lock-session.conf
@@ -5,6 +5,9 @@
[LightDM]
minimum-display-number=50
+[SeatDefaults]
+autologin-user=have-password1
+
#?RUNNER DAEMON-START
# X server starts
@@ -14,21 +17,6 @@ minimum-display-number=50
# LightDM connects to X server
#?XSERVER :50 ACCEPT-CONNECT
-# Greeter starts
-#?GREETER :50 START
-#?XSERVER :50 ACCEPT-CONNECT
-#?GREETER :50 CONNECT-XSERVER
-#?GREETER :50 CONNECT-TO-DAEMON
-#?GREETER :50 CONNECTED-TO-DAEMON
-
-# Login
-#?*GREETER :50 AUTHENTICATE USERNAME=have-password1
-#?GREETER :50 SHOW-PROMPT TEXT="Password:"
-#?*GREETER :50 RESPOND TEXT="password"
-#?GREETER :50 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
-#?*GREETER :50 START-SESSION
-#?GREETER :50 TERMINATE SIGNAL=15
-
# Session starts
#?SESSION :50 START USER=have-password1
#?XSERVER :50 ACCEPT-CONNECT
diff --git a/tests/test-lock-seat-return-session b/tests/test-lock-seat-return-session
new file mode 100755
index 00000000..047e6070
--- /dev/null
+++ b/tests/test-lock-seat-return-session
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner lock-seat-return-session test-gobject-greeter
diff --git a/tests/test-lock-session-return-session b/tests/test-lock-session-return-session
new file mode 100755
index 00000000..5a8e1495
--- /dev/null
+++ b/tests/test-lock-session-return-session
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner lock-session-return-session test-gobject-greeter