]> git.ipfire.org Git - thirdparty/systemd.git/commit
pam_systemd_home: clean up sd-bus when called about something else's user
authorLuca Boccassi <bluca@debian.org>
Thu, 20 Apr 2023 11:58:18 +0000 (12:58 +0100)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Apr 2023 12:18:22 +0000 (14:18 +0200)
commitdb0c0f5e003b0a0e202dbc399d35db36087c641c
treea143a58311fcd651ee0560440d8b63e1c1ceb861
parentd5ada52fc4b5cfa54cbca7254b96ca20f4130794
pam_systemd_home: clean up sd-bus when called about something else's user

acquire_home() takes a reference to a sd-bus object, which the open_session
hook cleans on success. But only when handling a user actually owned by homed,
it did not clean it up when skipping because it is being invoked on a system
user.
We need to be careful with sd-bus here as pam_sm_open_session is the last
hook before forking, and we want to clean up sd-bus before that happens, or
we'll have a broken reference (FDs are cloexec) in the child process, which
will then assert when attempting to close them, or leak the bus connection
which causes dbus to complain loudly:

 dbus-daemon[62]: [system] Connection has not authenticated soon enough, closing it (auth_timeout=30000ms, elapsed: 30020ms)
src/home/pam_systemd_home.c