-
Notifications
You must be signed in to change notification settings - Fork 235
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lib/, src/, configure.ac: Use utmpx instead of utmp #954
lib/, src/, configure.ac: Use utmpx instead of utmp #954
Conversation
I suggest reviewing with
|
24522aa
to
af1b9f4
Compare
v1b changes:
|
I will have to test this, though I don't see any changes being made to |
Please, and thanks!
No, the changes are in the library code. login.c doesn't seem to be using utmp directly. $ grep -rn utmp src/login.c
689: * information coming from login or from the caller (e.g. no utmp)
1178: * The utmp entry needs to be updated to indicate the new status
1181: err = update_utmp (username, tty, hostname);
1183: SYSLOG ((LOG_WARN, "Unable to update utmp entry for %s", username)); @awilfox , would you mind testing it too for your distribution? |
af1b9f4
to
595c690
Compare
v2 changes:
|
v3 changes:
|
Ok I tried the ...
checking for library containing readpassphrase... no
configure: error: readpassphrase() is missing, either from libc or libbsd
... |
You need to either install libbsd, or autogen with See:
|
Silly me, I already had that disabled, but perhaps dropped it after downgrading. Thanks for the reminder! |
And I can confirm it is working as intended! |
e9255d0
to
64d45e9
Compare
v4 changes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good!
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: 170b76c ("Disable utmpx permanently") Closes: <shadow-maint#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>
This silences a warning about an unused variable. Tested-by: Firas Khalil Khana <firasuke@gmail.com> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
This macro is useful to get the size of a member of a structure without having a variable of that type. Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
A difference between 'struct utmp' and 'struct utmpx' is that the former uses UT_LINESIZE for the size of its array members, while the latter doesn't have a standard variable to get its size. Therefore, we need to get the number of elements in the array with NITEMS(). Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
64d45e9
to
7e72c19
Compare
v4b changes:
|
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <shadow-maint#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <shadow-maint#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <shadow-maint#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Cc: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <shadow-maint#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <shadow-maint#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org>
Recently, we started using utmpx instead of utmp, and we updated <./configure.ac> to do the checks for 'struct utmpx' instead of 'struct utmp'. However, I forgot to update the preprocessor conditionals accordingly. Fixes: 64bcb54 ("lib/, src/, configure.ac: Use utmpx instead of utmp") Link: <#954> Cc: Firas Khalil Khana <firasuke@gmail.com> Cc: "A. Wilfox" <https://github.com/awilfox> Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com> Signed-off-by: Alejandro Colomar <alx@kernel.org> Cherry-picked-from: 1af6b68 ("lib/utmp.c: Use the appropriate autotools macros for struct utmpx") Signed-off-by: Alejandro Colomar <alx@kernel.org>
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:
So, rely on them unconditionally.
Fixes: 170b76c ("Disable utmpx permanently")
Closes: #945
Reported-by: @firasuke
Reported-by: @awilfox