summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/seat.c15
-rw-r--r--tests/Makefile.am4
-rw-r--r--tests/scripts/autologin-invalid-greeter.conf30
-rw-r--r--tests/scripts/login-invalid-greeter.conf7
-rwxr-xr-xtests/test-autologin-invalid-greeter2
-rwxr-xr-xtests/test-login-invalid-greeter2
6 files changed, 58 insertions, 2 deletions
diff --git a/src/seat.c b/src/seat.c
index 5ca69de0..1596a3da 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -392,7 +392,11 @@ display_server_stopped_cb (DisplayServer *display_server, Seat *seat)
if (!active_session || session_get_display_server (active_session) == display_server)
{
l_debug (seat, "Active display server stopped, starting greeter");
- seat_switch_to_greeter (seat);
+ if (!seat_switch_to_greeter (seat))
+ {
+ l_debug (seat, "Stopping; failed to start a greeter");
+ seat_stop (seat);
+ }
}
}
@@ -671,7 +675,11 @@ session_stopped_cb (Session *session, Seat *seat)
else if (!IS_GREETER (session) && session == seat_get_active_session (seat))
{
l_debug (seat, "Active session stopped, starting greeter");
- seat_switch_to_greeter (seat);
+ if (!seat_switch_to_greeter (seat))
+ {
+ l_debug (seat, "Stopping; failed to start a greeter");
+ seat_stop (seat);
+ }
}
/* Stop the display server if no-longer required */
@@ -1241,6 +1249,9 @@ seat_switch_to_greeter (Seat *seat)
}
greeter_session = create_greeter_session (seat);
+ if (!greeter_session)
+ return FALSE;
+
if (seat->priv->session_to_activate)
g_object_unref (seat->priv->session_to_activate);
seat->priv->session_to_activate = g_object_ref (greeter_session);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index c121d6dd..92014235 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -22,6 +22,7 @@ TESTS = \
test-autologin-guest-in-background \
test-autologin-timeout-in-background \
test-autologin-invalid-user \
+ test-autologin-invalid-greeter \
test-autologin-invalid-session \
test-crash-authenticate \
test-autologin-xserver-crash \
@@ -72,6 +73,7 @@ TESTS = \
test-language \
test-language-no-accounts-service \
test-login-crash-authenticate \
+ test-login-invalid-greeter \
test-login-gobject \
test-login-gobject-manual \
test-login-gobject-manual-previous-session \
@@ -307,6 +309,7 @@ EXTRA_DIST = \
scripts/autologin-guest-logout.conf \
scripts/autologin-guest-timeout.conf \
scripts/autologin-in-background.conf \
+ scripts/autologin-invalid-greeter.conf \
scripts/autologin-guest-in-background.conf \
scripts/autologin-timeout-in-background.conf \
scripts/autologin-invalid-session.conf \
@@ -362,6 +365,7 @@ EXTRA_DIST = \
scripts/login-guest-logout.conf \
scripts/login-guest-no-setup-script.conf \
scripts/login-info-prompt.conf \
+ scripts/login-invalid-greeter.conf \
scripts/login-invalid-session.conf \
scripts/login-invalid-user.conf \
scripts/login-logout.conf \
diff --git a/tests/scripts/autologin-invalid-greeter.conf b/tests/scripts/autologin-invalid-greeter.conf
new file mode 100644
index 00000000..31616422
--- /dev/null
+++ b/tests/scripts/autologin-invalid-greeter.conf
@@ -0,0 +1,30 @@
+#
+# Check quits if autologin session ends and no valid greeter
+#
+
+[SeatDefaults]
+autologin-user=have-password1
+user-session=default
+
+#?RUNNER DAEMON-START
+
+# X server starts
+#?XSERVER-0 START VT=7
+
+# 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 DESKTOP_SESSION=default USER=have-password1
+#?XSERVER-0 ACCEPT-CONNECT
+#?SESSION-X-0 CONNECT-XSERVER
+
+# Logout session
+#?*SESSION-X-0 LOGOUT
+
+# X server stops
+#?XSERVER-0 TERMINATE SIGNAL=15
+
+#?RUNNER DAEMON-EXIT STATUS=1
diff --git a/tests/scripts/login-invalid-greeter.conf b/tests/scripts/login-invalid-greeter.conf
new file mode 100644
index 00000000..8efa0ceb
--- /dev/null
+++ b/tests/scripts/login-invalid-greeter.conf
@@ -0,0 +1,7 @@
+#
+# Check fails to start if invalid greeter
+#
+
+#?RUNNER DAEMON-START
+
+#?RUNNER DAEMON-EXIT STATUS=1
diff --git a/tests/test-autologin-invalid-greeter b/tests/test-autologin-invalid-greeter
new file mode 100755
index 00000000..5489c7a5
--- /dev/null
+++ b/tests/test-autologin-invalid-greeter
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner autologin-invalid-greeter INVALID
diff --git a/tests/test-login-invalid-greeter b/tests/test-login-invalid-greeter
new file mode 100755
index 00000000..ad572e6e
--- /dev/null
+++ b/tests/test-login-invalid-greeter
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner login-invalid-greeter INVALID