]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/, src/, configure.ac: Use utmpx instead of utmp
authorAlejandro Colomar <alx@kernel.org>
Sat, 17 Feb 2024 14:15:38 +0000 (15:15 +0100)
committerAlejandro Colomar <alx@kernel.org>
Tue, 20 Feb 2024 17:53:53 +0000 (18:53 +0100)
commit64bcb54fa9621a73075249c75081b056512baa52
treeedc8ccc2e58ed573a49b2ae25b58c94607e22b8e
parent4d139ca466820b9a5fe8f75b9a0bee6a922d906a
lib/, src/, configure.ac: Use utmpx instead of utmp

utmpx is specified by POSIX as an XSI extension.  That's more portable
than utmp, which is unavailable for example in musl libc.  The manual
page specifies that in Linux (but it probably means in glibc), utmp and
utmpx (and the functions that use them) are identical, so this commit
shouldn't affect glibc systems.

Assume utmpx is always present.

Also, if utmpx is present, POSIX guarantees that some members exist:

-  ut_user
-  ut_id
-  ut_line
-  ut_pid
-  ut_type
-  ut_tv

So, rely on them unconditionally.

Fixes: 170b76cdd1a9 ("Disable utmpx permanently")
Closes: <https://github.com/shadow-maint/shadow/issues/945>
Reported-by: Firas Khalil Khana <firasuke@gmail.com>
Reported-by: "A. Wilfox" <https://github.com/awilfox>
Tested-by: Firas Khalil Khana <firasuke@gmail.com>
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
lib/log.c
lib/user_busy.c
lib/utmp.c
src/logoutd.c