chiark / gitweb /
logind: allow sessions to share a VT if it's a greeter
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 7 Jul 2015 17:13:52 +0000 (19:13 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:06:00 +0000 (10:06 +0100)
Old gdm and lightdm start the user-session during login before they
destroy the greeter-session. Therefore, the user-session will take over
the VT from the greeter. We recently prevented this by never allowing
multiple sessions on the same VT. Fix this now, by explicitly allowing
this if the owning session is a GREETER.

Note that gdm no longer behaves like this. Instead, due to wayland, they
always use a different VT for each session. All other login-managers are
highly encouraged to destroy the greeter-session _before_ starting the
user-session. We now work around this, but this will probably not last
forever (and will already have nasty side-effects on the greeter-session).

src/login/logind-dbus.c

index dbe8cae6061088f3d6d060f24968c40d387b8b98..e1476c9dba832395d9ea60ffb48d199b05f7a0fc 100644 (file)
@@ -690,8 +690,19 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus
         }
 
         manager_get_session_by_pid(m, leader, &session);
         }
 
         manager_get_session_by_pid(m, leader, &session);
-        if (!session && vtnr > 0 && vtnr < m->seat0->position_count)
+        if (!session && vtnr > 0 && vtnr < m->seat0->position_count) {
                 session = m->seat0->positions[vtnr];
                 session = m->seat0->positions[vtnr];
+                /*
+                 * Old gdm and lightdm start the user-session on the same VT as
+                 * the greeter session. But they destroy the greeter session
+                 * after the user-session and want the user-session to take
+                 * over the VT. We need to support this for
+                 * backwards-compatibility, so make sure we allow new sessions
+                 * on a VT that a greeter is running on.
+                 */
+                if (session && session->class == SESSION_GREETER)
+                        session = NULL;
+        }
         if (session) {
                 _cleanup_free_ char *path = NULL;
                 _cleanup_close_ int fifo_fd = -1;
         if (session) {
                 _cleanup_free_ char *path = NULL;
                 _cleanup_close_ int fifo_fd = -1;