summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Ancell <robert.ancell@canonical.com>2018-01-11 16:32:35 +1300
committerRobert Ancell <robert.ancell@canonical.com>2018-01-15 13:44:04 +1300
commit47998ee18211fdea1302803bfca891cf444289c0 (patch)
treed3e322b8bd5f9bd29669d50c660fe7a702c6a6a5
parent3f2ae0ead5b17927e2d5c459355d41e78ab741dd (diff)
downloadlightdm-git-47998ee18211fdea1302803bfca891cf444289c0.tar.gz
Fix LightDM failing to start greeters on remote X servers.
This change caused the VNC support to break, so contains some logic fixes for that.
-rw-r--r--src/seat.c11
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/scripts/xremote-login-logout.conf60
-rwxr-xr-xtests/test-xremote-login-logout2
4 files changed, 69 insertions, 6 deletions
diff --git a/src/seat.c b/src/seat.c
index d4a46319..48be9d4e 100644
--- a/src/seat.c
+++ b/src/seat.c
@@ -769,11 +769,6 @@ session_stopped_cb (Session *session, Seat *seat)
g_clear_object (&seat->priv->session_to_activate);
display_server = session_get_display_server (session);
- if (!display_server)
- {
- g_object_unref (session);
- return;
- }
/* Cleanup */
if (!IS_GREETER_SESSION (session))
@@ -1482,7 +1477,7 @@ seat_switch_to_greeter (Seat *seat)
g_return_val_if_fail (seat != NULL, FALSE);
- if (!seat_get_can_switch (seat))
+ if (!seat_get_can_switch (seat) && seat->priv->sessions != NULL)
return FALSE;
/* Switch to greeter if one open */
@@ -1502,6 +1497,10 @@ seat_switch_to_greeter (Seat *seat)
seat->priv->session_to_activate = g_object_ref (greeter_session);
display_server = create_display_server (seat, SESSION (greeter_session));
+ if (!display_server) {
+ g_clear_object (&seat->priv->session_to_activate);
+ return FALSE;
+ }
session_set_display_server (SESSION (greeter_session), display_server);
return start_display_server (seat, display_server);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3bc2cc13..63289fa0 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -186,6 +186,7 @@ TESTS = \
test-vnc-guest \
test-xremote-autologin \
test-xremote-login \
+ test-xremote-login-logout \
test-xdmcp-client \
test-xdmcp-client-xorg-1.16 \
test-xdmcp-server-autologin \
@@ -665,6 +666,7 @@ EXTRA_DIST = \
scripts/xdmcp-server-xdm-authentication-short-data.conf \
scripts/xremote-autologin.conf \
scripts/xremote-login.conf \
+ scripts/xremote-login-logout.conf \
scripts/xserver-config.conf \
scripts/xserver-fail-start.conf \
scripts/xserver-no-share.conf \
diff --git a/tests/scripts/xremote-login-logout.conf b/tests/scripts/xremote-login-logout.conf
new file mode 100644
index 00000000..4daffaf0
--- /dev/null
+++ b/tests/scripts/xremote-login-logout.conf
@@ -0,0 +1,60 @@
+#
+# Check logging out with a remote X server switches back to a greeter
+#
+
+[Seat:*]
+type=xremote
+user-session=default
+xserver-hostname=127.0.0.1
+xserver-display-number=98
+
+# Start a remote X server to use
+#?*START-XSERVER ARGS=":98 -listen tcp"
+#?XSERVER-98 START LISTEN-TCP
+
+#?*START-DAEMON
+#?RUNNER DAEMON-START
+
+# LightDM connects to X server
+#?XSERVER-98 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-127.0.0.1:98 START XDG_SEAT=seat0 XDG_SESSION_CLASS=greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c0
+#?XSERVER-98 ACCEPT-CONNECT
+#?GREETER-X-127.0.0.1:98 CONNECT-XSERVER
+#?GREETER-X-127.0.0.1:98 CONNECT-TO-DAEMON
+#?GREETER-X-127.0.0.1:98 CONNECTED-TO-DAEMON
+
+# Log into account with a password
+#?*GREETER-X-127.0.0.1:98 AUTHENTICATE USERNAME=have-password1
+#?GREETER-X-127.0.0.1:98 SHOW-PROMPT TEXT="Password:"
+#?*GREETER-X-127.0.0.1:98 RESPOND TEXT="password"
+#?GREETER-X-127.0.0.1:98 AUTHENTICATION-COMPLETE USERNAME=have-password1 AUTHENTICATED=TRUE
+#?*GREETER-X-127.0.0.1:98 START-SESSION
+#?GREETER-X-127.0.0.1:98 TERMINATE SIGNAL=15
+
+# Session starts
+#?SESSION-X-127.0.0.1:98 START XDG_SEAT=seat0 XDG_SESSION_TYPE=x11 XDG_SESSION_DESKTOP=default USER=have-password1
+#?LOGIN1 ACTIVATE-SESSION SESSION=c1
+#?XSERVER-98 ACCEPT-CONNECT
+#?SESSION-X-127.0.0.1:98 CONNECT-XSERVER
+
+# Logout session
+#?*SESSION-X-127.0.0.1:98 LOGOUT
+
+# LightDM connects to X server
+#?XSERVER-98 ACCEPT-CONNECT
+
+# Greeter starts
+#?GREETER-X-127.0.0.1:98 START XDG_SEAT=seat0 XDG_SESSION_CLASS=greeter
+#?LOGIN1 ACTIVATE-SESSION SESSION=c2
+#?XSERVER-98 ACCEPT-CONNECT
+#?GREETER-X-127.0.0.1:98 CONNECT-XSERVER
+#?GREETER-X-127.0.0.1:98 CONNECT-TO-DAEMON
+#?GREETER-X-127.0.0.1:98 CONNECTED-TO-DAEMON
+
+# Cleanup
+#?*STOP-DAEMON
+#?GREETER-X-127.0.0.1:98 TERMINATE SIGNAL=15
+#?RUNNER DAEMON-EXIT STATUS=0
diff --git a/tests/test-xremote-login-logout b/tests/test-xremote-login-logout
new file mode 100755
index 00000000..37698e1e
--- /dev/null
+++ b/tests/test-xremote-login-logout
@@ -0,0 +1,2 @@
+#!/bin/sh
+./src/dbus-env ./src/test-runner xremote-login-logout test-gobject-greeter