]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/, src/: Fix utmp update: use initial PID
authorEvgeny Grin (Karlson2k) <k2k@drgrin.dev>
Mon, 14 Jul 2025 18:57:03 +0000 (20:57 +0200)
committerAlejandro Colomar <foss+github@alejandro-colomar.es>
Fri, 18 Jul 2025 19:55:10 +0000 (21:55 +0200)
commit06cdfd27a47748b5d74b9e5d475e1640019ede3b
treeb3ed9109fe3e138739f14fd50ccb30870974a2c7
parentec5a5a549cf43c265752b0b754737dec27c333e1
lib/, src/: Fix utmp update: use initial PID

The correct utmp update functionality was broken mainly by commit
91fc51387ca5341e1a1f778a967886c5fe589cb8, which moved update of utmp
after forking (when PAM is used).  It was also misinterpretation of
GNU/Linux utmp specifications, where is specified that ut_pid must be
the PID of the **login** process (not a PID of any forked process).
Wrong ut_pid also prevents utmp cleanup, which performed by init process
and should clean entry with the same ut_pid as started login process.
GNU/Linux description of utmp updates can be found at the next url:
https://man7.org/linux/man-pages/man5/utmp.5.html

Signed-off-by: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
lib/logind.c
lib/prototypes.h
lib/utmp.c
src/login.c