summaryrefslogtreecommitdiff
path: root/daemon/gdm-manager.c
Commit message (Collapse)AuthorAgeFilesLines
* manager: Clean up user session when finished with displayRay Strode2020-11-021-0/+2
| | | | | | | | | The display object stores its associated user session with it as object data. It never clears this session from its object data when its done with it however, leading to the session leaking. This commit plugs the leak and an associated file descriptor leak at logout.
* manager: Don't leak session objectsRay Strode2020-11-021-8/+7
| | | | | | | | The create_user_session_for_display function returns a new reference to the GdmSession object it creates. The callers don't expect this, and most of the callers don't even look at the return value at all. This commit makes it return void instead.
* daemon: quit Plymouth without transition if only XDMCP is allowedPetr Pavlu2020-09-091-1/+1
| | | | | | | | | | | | When GDM is configured as a standalone XDMCP server, the manager quits Plymouth by running 'plymouth quit --retain-splash'. This is not ideal because there is no transition to a local X server. The terminal can be then left from the Plymouth run in the graphics mode with no getty prompt and also disallowing switching to another VT. The patch fixes the problem by instead running 'plymouth quit' which always switches the terminal to the text mode. https://gitlab.gnome.org/GNOME/gdm/-/merge_requests/101
* manager: Always write out parameterBenjamin Berg2020-09-091-1/+2
| | | | | | | | | | The get_display_and_details_for_bus_sender function does not return a proper error value. Due to this, it makes sense to always write the out parameters (though, I expect we have still more that we might need to write). This is just slightly safer, but the function probably isn't great as is.
* manager: Fix possible crash by initializing displayBenjamin Berg2020-09-091-1/+1
| | | | | | | | | | | Some people insist on running sessions in ways where we cannot detect them properly. In that case, we shouldn't find a display, but the variable was not initialized and we could end up accessing random memory resulting in a crash. Fix it by adding the missing initializer. Closes: #555
* manager: don't kill initial-setup right away with Xorg eitherRay Strode2020-07-131-18/+2
| | | | | | | | | The login screen for both Xorg and wayland sessions is now silently killed in the background post login. We still kill initial-setup for Xorg sessions up front, though. This commit fixes that.
* gdm-manager: just call Plymouth to rely on PATH env to support different ↵Zhao Qiang2020-04-281-4/+4
| | | | distributions' directory architecture.
* manager: Try looking up session based on PID firstBenjamin Berg2020-04-221-1/+1
| | | | | | | | | | | | | | Unfortunately, GDM may be running multiple greeters, and each greeter is currently using the same user. So while in a lot of setups each user should only have one graphical session and also only one DBus session bus, this is not true for the gdm greeter. Lacking another solution (e.g. separate users), we need to be able to correctly lookup the session information for all greeter instances. We can do so by using sd_pid_get_session and using this information is safe if it does return something. See: #526
* gdm-manager: fix a couple of compile warningsRay Strode2019-08-131-3/+3
|
* gdm-manager: Replace deprecated g_type_class_add_private()Robert Mader2019-08-131-3/+2
|
* gdm-manager: Remove unnecessary cast to GDestroyNotifyRobert Mader2019-08-131-2/+0
|
* manager: Chown initial-setup homedir on REUSE_VTDaniel García Moreno2019-08-131-2/+3
| | | | | | | | | | | | | | | The initial setup home dir should be owned by the initial user created during the gnome-initial-setup to be able to copy all config to the new user with the gnome-initial-setup-copy-worker. The owner of this homedir is been changed if the session is different from GDM_SESSION_DISPLAY_MODE_REUSE_VT but in this case the manager is not calling this function. This patch moves the call to this function outside the if-else to fix the gnome-initial-setup process in the first case. https://gitlab.gnome.org/GNOME/gdm/merge_requests/70
* manager: Find user's current graphical session, not session of callerwip/benzea/systemd-userIain Lane2019-08-051-5/+6
| | | | | | | If (e.g.) gnome-shell is started as a systemd --user unit, it won't be part of the login session. We should instead look through all of the user's sessions until we find the login session, and take that as our session.
* GdmManager, GdmDisplay: Add RegisterSession methodIain Lane2019-05-291-0/+30
| | | | | Window managers can use this to register with GDM when they've finished starting up and started displaying.
* manager: don't return value from listify_display_idsRay Strode2019-02-211-4/+1
| | | | | | | | The manager code is returning FALSE from its listify_display_ids foreach function, which is useless since commit 47d01abe. This commit makes it return void instead.
* GdmManager: Don't perform timed login if session gets startedIain Lane2019-02-071-0/+8
| | | | | | | | | | | | | | | | | | | | | | At the moment it's possible for the login screen to initiate a timed login operation shortly after a user successfully starts their session. GDM won't complete the timed login operation, since a session is already running, but will erroneously overwrite the username associated with the session, misattributing the users session to the timed login user. Later, attempts to log in as the timed user will instead unlock the session for the other user, since that session is now associated with the timed login user. This commit refuses timed login requests on sessions that are already running, so the username doesn't get corrupted. CVE-2019-3825 Closes https://gitlab.gnome.org/GNOME/gdm/issues/460
* manager,session: Add some debugging around starting reauthenticationIain Lane2019-02-061-6/+40
| | | | | | | | There's a bug right now dealing with timed login and reauthentication, but it's not clear what's going on by looking at the logs. This commit sprinkles some more logging throughout the code, to make the bug easier to track.
* manager: don't kill timed login session immediately after it startsRay Strode2019-02-061-1/+2
| | | | | | | | | At the moment GDM is misidentifying timed login sessions as if they are automatic login sessions. That leads to their displays getting killed sometimes shortly after log in. This commit corrects the check, so that timed login sessions aren't treated as autologin sessions.
* Use G_PARAM_STATIC_STRIGS on propertiesNiels De Graef2019-01-071-1/+1
| | | | This prevents strings from being unnecessarily copied.
* manager: do initial-setup post work in manager codeRay Strode2018-10-061-0/+132
| | | | | | | | | | | | Right now we do the initial-setup related post work when stopping the greeter, but the problem is we delay stopping the greeter now until after the user session is started. That post-work needs to be done before the user session is started. This commit moves the code to a more logical place.
* manager: correct display confusionRay Strode2018-10-011-2/+2
| | | | | | | | | commit c5c5bf1f reworked autologin and broke it. This commit addresses the breakage by accessing the proper display variable. Closes https://gitlab.gnome.org/GNOME/gdm/issues/426
* manager: don't run autologin display on tty1Ray Strode2018-09-251-3/+1
| | | | | | | | | | tty1 is really meant for the login screen. If a user autologins on it and we need a login screen later, then the login screen has to go in some auxiliary VT which isn't very nice. This commit changes autologin to not use the initial vt.
* manager: rework how autologin is figured outRay Strode2018-09-251-11/+35
| | | | | | | | | | | | At the moment we decide whether or not to perform autologin, by looking at if the display is the initial VT display and if autologin hasn't been started before. That isn't going to work in the future when autologin is started on a non-initial vt. This commit changes GDM to instead check if the seat is seat0, and if autologin hasn't run before, before deciding to do autologin.
* manager: fix build with --without-plymouthRay Strode2018-09-011-2/+2
| | | | | | | | | | | commit 80b46e2 accidentally put the `doing_initial_setup` boolean declaration inside a plymouth-enabled code path. That broke the build for non-plymouth users. This commit moves the declaration and the subsequent initialization to unconditionalized code.
* manager: don't kill initial-setup before starting user session on waylandRay Strode2018-08-311-5/+21
| | | | | | | | | | Right now we kill initial-setup before starting the session for the user initial-setup created. This is the right thing to do for Xorg, since Xorg can't be killed in the background, but it adds unncessary flicker for wayland. This commit checks if it's wayland and avoids killing it right away in that case.
* manager: start initial setup right awayRay Strode2018-08-311-66/+1
| | | | | | | | | | | | | | We no longer restart the greeter as soon as it dies, since we start the greeter on demand. This means, we no longer need to defer starting initial setup until after the greeter respawns. Furthermore, it doesn't work anymore since it relied on the respawn to trigger. This commit removes that code and scaffolding and just starts initial setup directly. https://gitlab.gnome.org/GNOME/gdm/issues/415
* manager: don't set ran_once after running initial-setupRay Strode2018-08-311-1/+3
| | | | | | | | | | | GdmManager tracks whether or not the user session has ran once, so it won't autologin a user again after logout. Unfortunately the initial-setup session was counting toward the ran_once count preventing initial-setup from logging the user in afterward. This commit prevents ran_once from getting set in that case.
* manager: better logind handlingRay Strode2018-08-311-3/+3
| | | | | | | | commit 9ee68d5c8 highlights we've incorrectly used ENOENT instead of ENXIO when checking for non-existing sessions/seats with logind. This commit mops up all the other cases.
* manager: plug leakRay Strode2018-08-311-1/+1
| | | | | We're quering the session-type of a display and not freeing the result.
* display-store: Pass the display object rather than the id in the removed signalChris Coulson2018-08-131-10/+9
| | | | | | | | | | | | | By the time GdmDisplayStore emits the "display-removed" signal, the display is no longer in the store and gdm_display_store_lookup will not work in signal handlers. Change the "display-removed" parameter from the display id to the GdmDisplay object, so that signal handers can perform any cleanup they need to do CVE-2018-14424 Closes: https://gitlab.gnome.org/GNOME/gdm/issues/401
* daemon: try harder to get to a login screen at logoutRay Strode2018-08-021-48/+0
| | | | | | | | | | | | | commit 22c332ba and some follow up commits try to ensure the user never stays on a blank VT by jumping to a login screen in the event they'd end up on one. Unfortunately, that part of the code can't start a login screen if there's not one running at all. This commit moves the code to GdmLocalDisplyFactory where the login screens are created, so users won't end up on a blank VT even if no login screen is yet running.
* common: dedupe activate_session_idRay Strode2018-08-021-33/+2
| | | | | | Right now there are three copies of activate_session_id. This commit consolidates the code to gdm-common.c
* common: dedupe gdm_get_login_window_session_idRay Strode2018-08-021-97/+2
| | | | | | | | Right now there are two slightly different cut-and-pastes of the function to get the session id of the login session in the code. This commit deduplicates them.
* manager: make get_login_window_session_id fail if no login screenRay Strode2018-08-021-2/+2
| | | | | | | Right now we oddly succeed from get_login_window_session_id if we can't find a login window. None of the caller expect that, so fail instead.
* manager: don't bail if session disappears out from under usRay Strode2018-06-221-0/+10
| | | | | | | | | | | | | | | It's entirely possible for a session returned by sd_seat_get_sessions to disappear immediately after the sd_seat_get_sessions call returns. This is especially likely at logout time where the session will briefly be in the "closing" state before getting reaped. If that happens when we're looking for a greeter session, we stop looking for a greeter session and bail out all confused. This commit fixes the confusion by gracefully handling the session disappearing by just proceeding to the next session in the list.
* manager: start login screen if old one is finishedRay Strode2018-06-221-1/+1
| | | | | | | | | | | | | | | | Since commit 22c332ba we try to start a login screen if we end up on an empty VT and there isn't one running. Unfortunately the check for "is on an empty VT" is a little busted. It counts the VT has non-empty if there's a display associated with it, even if that display is in the FINISHED state about to be reaped. That means, in some cases, we'll still leave the user on an empty VT with no login screen. This commit addresses the problem by explicitly checking for FINISHED displays, and proceeding even in their presense.
* manager: plug leak in maybe_activate_other_sessionRay Strode2018-06-221-1/+3
| | | | | | | The function asks logind what the currently active session is on the given seat. It then leaks the response. This commit plugs the leak.
* manager: gracefully handle the case of no session for login windowLubomir Rintel2018-06-221-2/+4
| | | | | | | | get_login_window_session_id() will return TRUE with session_id=NULL when there's no session. This restults in an assertion failure on constructing the o.fd.login1.Manager.ActivateSessionOnSeat() arguments: GLib: g_variant_new_string: assertion 'string != NULL' failed
* manager: avoid leaking session_idLubomir Rintel2018-06-221-0/+1
| | | | get_login_window_session_id() duplicates the session id.
* daemon/gdm-manager.c: quit plymouth when xdmcp is the only allowed connection.Yifan J2018-04-101-0/+7
| | | | | | | | | | | | | | | | | | | | | | | gdm is responsible to kill plymouth by spawning the "plymouth quit" subprocesses in gdm-manager.c. The current code pathes of quiting plymouth can never be reached when xdmcp is the only connection allowed. Consequently in the case of !show_local_greeter && xdmcp_enabled the plymouth-quit-wait.service will never quit and the login prompt will not popup without manual interference. This issue could be more obviously observed when a downstream like openSUSE which allows a customized sysconfig to switch the corresponding two options on a headless server (s390), where the setup is usually: DISPLAYMANAGER_REMOTE_ACCESS="yes" DISPLAYMANAGER_STARTS_XSERVER="no" The proposed patch handles this edge case by quit plymouth immediately when the condition is detected. https://bugzilla.gnome.org/show_bug.cgi?id=795120
* Remove unused variablesRobert Ancell2018-01-101-2/+0
|
* manager: fix compile warningRay Strode2017-10-131-2/+2
| | | | | | | | | | commit 7e8243eecd0233f7ab92519207f2520794439b11 introduced a compiler warning if gdm is built with --enable-wayland and --disable-user-display-server This commit fixes that. https://bugzilla.gnome.org/show_bug.cgi?id=788963
* manager: don't record wtmp entries when user unknownRay Strode2017-10-101-0/+5
| | | | | | | | | | | | | Right now we end up writing wtmp entries for the login screen user into /var/log/wtmp, but with a funky username of "(unknown)". The login screen session shouldn't get a wtmp entry, and we shouldn't ever add wtmp entries for sessions we don't know the username for. This commit fixes that. https://bugzilla.gnome.org/show_bug.cgi?id=788784
* Use standard exit codes.Robert Ancell2017-10-031-2/+2
| | | | | | | | | Use EXIT_ defines for readibility. There were some exit codes > 1, but they don't seem to be checked by any of the parent process code. This does mean that the logs might have changed, but modern logging techniques have probably made this obsolete. https://bugzilla.gnome.org/show_bug.cgi?id=788307
* daemon,libgdm: allow wayland sessions with --disable-user-display-serverRay Strode2017-09-191-1/+1
| | | | | | | | | | | | Right now we hide wayland sessions from the list if the greeter isn't wayland. The greeter is never wayland if built with --disable-user-display-server. This commit allows wayland sessions for the user session, when --disable-user-display-server --enable-wayland-support is specified, even though the greeter won't use wayland itself. https://bugzilla.gnome.org/show_bug.cgi?id=787899
* manager: don't allow autologin from transient displaysRay Strode2017-09-121-1/+4
| | | | | | | | | | | | | | | In theory, we're only only supposed to allow autologin the first time a session is run, but we only count a session run, once it's finished. This means that if a user creates a transient session to user switch, before they've logged out the first time at boot up, that transient session will begin autologin as well (which actually gets treated as an auto unlock). This commit makes sure autologin is only ever run on the initial display. https://bugzilla.gnome.org/show_bug.cgi?id=783779
* manager: fix dangling pointer freeRay Strode2017-08-231-1/+1
| | | | | | | | | | | | When reauthenticating, we can crash if no login screen is running on the seat (for instance, when building with --disable-user-display-server, and not user switching). The crash is due to a dangling pointer. This commit fixes that. https://bugzilla.gnome.org/show_bug.cgi?id=786656
* manager: make sure a session's display knows about the sessionRay Strode2017-08-181-1/+6
| | | | | | | | | | | | When logging into a session that runs on another VT, we create a new display object for it. That display object needs to know about the session, so we can find the session when reauthenticating against the display. The code that links the two together was missing. This commit adds it. https://bugzilla.gnome.org/show_bug.cgi?id=784555
* manager: rename embryonic-user-session to user sessionRay Strode2017-08-181-18/+18
| | | | | | | | | | | The user session exists and gets used after it's fully grown, (when reauthenticating), so calling it an embryonic session is weird. The word embryonic is weird anyway. Previously, we called it a seed session, and that was weird, too, for the same reason. Before that we just called it a user session, so let's come around full circle and name it user session again. https://bugzilla.gnome.org/show_bug.cgi?id=784555
* manager: rename get_user_session_for_display to find_user…Ray Strode2017-08-181-3/+3
| | | | | | | This function iterates through a list so calling the action find is more appropriate. https://bugzilla.gnome.org/show_bug.cgi?id=784555