]> 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 21:53:54 +0000 (22:53 +0100)
commitbec925d29db92f71494df41849b23123bd669a6c
treea32c5f0620409003bd01e5473c20335b1a487e7d
parent2128715ede4334ac05fa9783b24b091eb371bd4c
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>
Cherry-picked-from: 64bcb54fa962 ("lib/, src/, configure.ac: Use utmpx instead of utmp")
Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
lib/log.c
lib/user_busy.c
lib/utmp.c
src/logoutd.c