summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Disable user switching if logind says it isn't supportedRichard Hansen2023-04-281-5/+3
| | | | | | | | | | This should work now that seat_local_get_active_session returns the proper value for non-seat0 seats. Note: systemd-logind v245 and older erroneously report CanMultiSession=no on non-seat0 seats even when it is supported. This change will break those users. See <https://github.com/systemd/systemd/pull/15337>.
* Move supports_multi_session initialization to initRichard Hansen2023-04-283-17/+3
| | | | | | This makes it possible to use seat_set_supports_multi_session to change the support status after the seat is created but before it is started.
* Consolidate Seat.setup and Seat.start for readabilityRichard Hansen2023-04-285-25/+11
| | | | | The name "setup" implies early initialization, when it was actually run just before start.
* Try activating an existing greeter before checking for switch supportRichard Hansen2023-04-281-6/+6
| | | | | | | If the seat has an existing greeter session then we should activate it regardless of whether the seat supports user switching. (If the seat does not support user switching then there shouldn't be an existing greeter session, I think. Either way, it doesn't hurt to try.)
* Improve debug logging when seat_switch_to_greeter failsRichard Hansen2023-04-281-1/+14
| | | | This will make it easier to troubleshoot multiseat issues.
* Use systemd-logind to discover active session on non-seat0 seatsRichard Hansen2023-04-281-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before, `seat_local_get_active_session` would always return `NULL` for non-`seat0` seats. This broke Wayland sessions on non-`seat0` seats: 1. User logged in to a Wayland session on `seat1`. 2. LightDM properly terminated the X server to allow Wayland to take over the seat's hardware. (See the side note below.) 3. Wayland session started. 4. The X server termination triggered a call to `display_server_stopped_cb`. 5. `display_server_stopped_cb` called `seat_get_active_session` to see if it needed to start a greeter to replace a terminated session associated with the terminated display. 6. `seat_get_active_session` called `seat_local_get_active_session`. 7. `seat_local_get_active_session` erroneously probed the active VT even though VTs are only associated with `seat0`. 8. After finding no matching session associated with both `seat1` and the active VT, `seat_local_get_active_session` returned `NULL` when it should have returned the new Wayland session. 9. Due to the `NULL` response, `display_server_stopped_cb` erroneously arrived at the conclusion that a greeter must be started on `seat1`. 10. LightDM started a new X server and greeter on `seat1`, stomping on the newly created Wayland session. Side note: I don't think that terminating X to allow Wayland to take over the seat's hardware is required because I believe X and most?/all? Wayland compositors cooperatively share the devices via systemd-logind or maybe libseat. When switching sessions, logind uses a hand-off protocol to smoothly change which process is allowed to access the devices. This makes session switching possible even without virtual terminals. For details, see <https://dvdhrm.wordpress.com/2013/08/25/sane-session-switching/>. The above sequence of events is apparent in the debug log from a minimal script (the script is not included in this commit; the relevant lines from the log are copied below, with annotations): # # User logs in to seat1 with a Wayland session: # GREETER-X-1 AUTHENTICATION-COMPLETE USERNAME=no-password2 AUTHENTICATED=TRUE *GREETER-X-1 START-SESSION [+0.32s] DEBUG: Seat seat1: Creating display server of type wayland [+0.32s] DEBUG: Seat seat1: Display server ready, running session [+0.32s] DEBUG: Registering session with bus path /org/freedesktop/DisplayManager/Session0 [+0.32s] DEBUG: Session pid=1309577: Running command /home/rhansen/floss/lightdm/tests/src/lightdm-session test-session # # LightDM starts shutting down X+greeter for seat1 while # concurrently activating the new Wayland session (c1 = the # stopping seat1 greeter session, c2 = the starting Wayland # session). # [+0.33s] DEBUG: Seat seat1: Stopping greeter [+0.33s] DEBUG: Terminating login1 session c1 [+0.33s] DEBUG: Session pid=1309572: Sending SIGTERM [+0.33s] DEBUG: Activating login1 session c2 GREETER-X-1 TERMINATE SIGNAL=15 LOGIN1 ACTIVATE-SESSION SESSION=c2 # # The greeter session and X exit. # [+0.33s] DEBUG: Session pid=1309572: Exited with return value 0 [+0.33s] DEBUG: Seat seat1: Session stopped [+0.33s] DEBUG: Seat seat1: Stopping display server, no sessions require it [+0.33s] DEBUG: Sending signal 15 to process 1309569 XSERVER-1 TERMINATE SIGNAL=15 [+0.33s] DEBUG: Process 1309569 exited with return value 0 [+0.33s] DEBUG: XServer 1: X server stopped [+0.33s] DEBUG: Seat seat1: Display server stopped # # The start of the problem: LightDM should not restart the greeter # until the Wayland session terminates: # [+0.33s] DEBUG: Seat seat1: Active display server stopped, starting greeter [+0.33s] DEBUG: Seat seat1: Creating greeter session [+0.33s] DEBUG: Seat seat1: Creating display server of type x [+0.33s] DEBUG: Seat seat1: Starting local X display [+0.33s] DEBUG: XServer 1: Launching X Server [+0.33s] DEBUG: Launching process 1309583: /home/rhansen/floss/lightdm/tests/src/X :1 -seat seat1 -auth /var/run/lightdm/root/:1 -nolisten tcp [+0.33s] DEBUG: XServer 1: Waiting for ready signal from X server :1 XSERVER-1 START SEAT=seat1 # # The Wayland session has started concurrently with the # replacement X+greeter. # SESSION-WAYLAND START XDG_SEAT=seat1 XDG_GREETER_DATA_DIR=/var/lib/lightdm-data/no-password2 XDG_SESSION_TYPE=wayland XDG_SESSION_DESKTOP=wayland USER=no-password2 *XSERVER-1 INDICATE-READY XSERVER-1 INDICATE-READY [+0.34s] DEBUG: Got signal 10 from process 1309583 [+0.34s] DEBUG: XServer 1: Got signal from X server :1 [+0.34s] DEBUG: XServer 1: Connecting to XServer :1 XSERVER-1 ACCEPT-CONNECT [+0.34s] DEBUG: Seat seat1: Display server ready, starting session authentication [+0.34s] DEBUG: Session pid=1309587: Started with service 'lightdm-greeter', username 'lightdm' [+0.40s] DEBUG: Session pid=1309587: Running command /home/rhansen/floss/lightdm/tests/src/.libs/test-gobject-greeter # # Finally, the replacement greeter stomps on the new Wayland # session. # [+0.40s] DEBUG: Locking login1 session c2 LOGIN1 LOCK-SESSION SESSION=c2
* Initialize WaylandSessionPrivate.vt to -1Richard Hansen2023-04-281-0/+2
| | | | | | | | | | | This matters when starting a Wayland session on a non-seat0 seat: * It eliminates an erroneous attempt to switch to VT 0. * The XDG_VTNR environment variable is no longer set. Also add a multiseat test. A similar change for XServerLocalPrivate is not needed because its vt field is already initialized to -1.
* Delete redundant cleanup codeRichard Hansen2023-04-281-5/+2
|
* x-server: Avoid reusing the local X server if the hostname has changedCorentin Noël2023-04-266-17/+34
| | | | | If the hostname has changed while using a local seat, we will fail to connect and return to the greeter. Avoid this behavior by recreating the server.
* Fix: Don't disconnect signals on cancel before the session actually endsPaul Wolneykien2022-11-211-1/+14
| | | | | | | Otherwise, no completion message is sent to the greeter leaving it in the 'in_authentication' state Signed-off-by: Paul Wolneykien <manowar@altlinux.org>
* x-server-xvnc: Adjust default color depth to match upstream TigerVNC.Maxim Cournoyer2022-08-261-1/+1
| | | | | | | | | | | | | There is no longer support for 8 bit color depth in TigerVNC (see: https://github.com/TigerVNC/tigervnc/commit/e86d8720ba1e79b486ca29a5c2b27fa25811e6a2); using it causes a fatal error. * src/x-server-xvnc.c (x_server_xvnc_init): Set default depth to 24 bit. * tests/scripts/vnc-command.conf (command): Adjust accordingly. * tests/scripts/vnc-guest.conf (user-session): Likewise. * tests/scripts/vnc-login.conf (user-session): Likewise. * tests/scripts/vnc-open-file-descriptors.conf (user-session): Likewise. * data/lightdm.conf: Likewise.
* x-server-local: Correctly order command line arguments.Maxim Cournoyer2022-08-261-1/+13
| | | | | | | | | | | | When providing the VNCServer command as 'Xvnc -SecurityTypes None', the formatted command line used would look like: Xvnc -SecurityTypes None :1 -auth /var/run/lightdm/root/:1 which is invalid (the display number must appear first). * src/x-server-local.c (x_server_local_start): Format the command placing the display number before any other provided arguments.
* lightdm: Honor VNCServer's command in sanity check.Maxim Cournoyer2022-08-261-14/+29
| | | | | | | Fixes #264. * src/lightdm.c (start_display_manager): Validate if the VNCServer command provided binary is available; fallback to 'Xvnc' otherwise.
* Fix crash due to using wrong method to set configurationRobert Ancell2022-07-111-1/+1
| | | | Regression introduced in 77a7c6b7b8ca896b98ef43826641bdd520650bfb
* Work around a race with password-less logins and double clicksEdgar Fuß2022-07-041-0/+17
| | | | | | | | | | | | | There is a race in the greeter (greeter as in lightdm-gtk-greeter) easily triggered by double-clicking on the login button (or clicking it with a bouncing mouse button) with a password-less login. The problem arises when the daemon has already sent SERVER_MESSAGE_END_AUTHENTICATION to the greeter, but before it digests it, it handles more X11 events (e.g. the second click), sending the daemon a GREETER_MESSAGE_CONTINUE_AUTHENTICATION (before the GREETER_MESSAGE_START_SESSION) which will confuse handle_continue_authentication(), making it call session_respond_error(), which then sends a PAM_CONV_ERR to the session child, which will in turn get confused because it's expecting the (length of the) session error file name. As I don't really know how to avoid the race in the greeter (you would need to teach it prioritizing messages from the master over messages from X11), work around it by setting a flag in GreeterPrivate if SERVER_MESSAGE_END_AUTHENTICATION has been sent and ignore GREETER_MESSAGE_CONTINUE_AUTHENTICATION if that flag is set. The change was verified on 1.18.3 and then adopted to HEAD.
* config: set `logind-check-graphical=True` per defaultsilvan2022-06-291-0/+2
| | | | Without `logind-check-graphical=True` beeing set, lightdm is prone to a race condition, where lightdm has started before the graphics driver was loaded.
* Don't call setenv with a NULL value - the behaviour is undefined.Robert Ancell2022-06-271-1/+7
|
* Update x-authority.csinirajapan2022-04-261-1/+1
| | | | No O_TRUNC causes the xauthority file corruption. In case the address of XDMCP DISPLAY length differs.
* Use a size_t to resolve a compile warningRobert Ancell2021-02-164-11/+12
|
* Make some private functions staticRobert Ancell2020-08-072-12/+4
|
* Determine a session is wayland with a better heuristicworldofpeace2019-12-102-2/+1
| | | | | | | | | Using the compiled in string WAYLAND_SESSIONS_DIR had some problems. In environments like NixOS, which install packages under their own immutable prefix under /nix/store. this assumption that the package would be compiled with `datadir=/usr/share` will break down. Checking if the directory contains the appropriate string is much simpler and will work with platforms like NixOS (or others as this setup popularizes).
* On systems without clearenv() the environ variable must be imported as ↵Guido Falsi2019-06-101-0/+4
| | | | | | external before it can be manipulated to reset the environment. This is, for example, necessary on FreeBSD, otherwise the effect of "environ = NULL" is a compiler error or in some cases to create a new local variable.
* Use g_autoptr with GVariantIterRobert Ancell2018-08-301-8/+4
|
* Fix double free of GVariantIterRobert Ancell2018-08-301-2/+0
| | | | Bug introduced in a95eded63
* Remove Unity System Compositor support - it is a dead projectRobert Ancell2018-08-3010-1430/+19
|
* Use more modern *_get_instance_private() method for storing private dataRobert Ancell2018-08-3059-1576/+1964
|
* Fix small leak in XDMCP serverRobert Ancell2018-08-301-1/+1
|
* Remove use of deprecated g_type_class_add_privateRobert Ancell2018-08-3028-83/+30
|
* Set XDG_SEAT env variable in script hooksRobert Ancell2018-08-211-0/+2
|
* Fix compile warning and unfreed GError from 733d175Robert Ancell2018-05-111-1/+2
|
* in Remove X authority: Ignore any error & don't exit, continue closing the ↵Ivan Zakharyaschev2018-03-261-2/+1
| | | | session
* x-authority: Remove incorrect use of constBjörn Esser2018-01-191-1/+1
|
* Move variable declarations from the start of function blocks.Robert Ancell2018-01-1241-2003/+1219
| | | | It's well past 1999...
* Ensure XDMP X sever shuts down when session closesRobert Ancell2018-01-122-8/+15
| | | | | | | | Previously we were attempting to reconnect a greeter, however we can't trust the X server after the session is run, so we should instead close the connection. The XDMCP client is expected to reconnect again. https://bugs.launchpad.net/bugs/1739787
* Fix LightDM failing to start greeters on remote X servers.Robert Ancell2018-01-111-6/+5
| | | | | This change caused the VNC support to break, so contains some logic fixes for that.
* Ensure only one Xvnc server is run.Robert Ancell2018-01-111-2/+18
| | | | We only have one VNC connection - so make sure we don't try and use it twice.
* Set names for XDMCP and VNC seatsRobert Ancell2018-01-113-13/+37
|
* Fix warnings with new g_object_ref type checking in GLibRobert Ancell2017-12-113-7/+7
|
* Remove incorrect use of constRobert Ancell2017-12-111-1/+1
|
* Remove unnecessary semicolons on the end of macrosRobert Ancell2017-12-1138-40/+40
|
* Fix VNC connection not being closed on session exitRobert Ancell2017-12-081-1/+1
|
* Fix GError being overwrittenRobert Ancell2017-12-081-0/+3
|
* Fix typos in code commentsRobert Ancell2017-11-222-2/+2
|
* Use g_auto to automatically free memoryRobert Ancell2017-09-2738-879/+604
|
* Fix timed autologins not using autologin-session when no session specifiedRobert Ancell2017-09-211-0/+7
|
* Expose autologin-session as a hint to the greeterRobert Ancell2017-09-211-0/+6
| | | | Based on a patch by Roland Tapken.
* Fix logic that checked if a session was being stoppedRobert Ancell2017-02-221-4/+4
|
* Retry VT_WAITACTIVE if we get EINTRobert Ancell2017-02-131-2/+11
|
* Update code commentRobert Ancell2017-01-271-1/+2
|
* Ignore SIGHUP by default and use SA_RESTART with SIGPIPERobert Ancell2017-01-272-2/+6
|