-
Notifications
You must be signed in to change notification settings - Fork 240
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
configure.ac, lib/, src/: Presume working shadow group support in libc #1111
base: master
Are you sure you want to change the base?
configure.ac, lib/, src/: Presume working shadow group support in libc #1111
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
7abca5a
to
545bd8d
Compare
545bd8d
to
f7071ba
Compare
d8090da
to
679d755
Compare
679d755
to
4a78c9c
Compare
0f40b17
to
4d42143
Compare
Queued after the release of 4.17.0. |
If the title stays "presume working shadow group support in libc", then the |
I presume it works if it's there, but I consider the possibility that it doesn't exist. musl libc for example doesn't have gshadow.h at all. |
The existing code was assuming that libc's <shadow.h> includes <gshadow.h>. That's not true. alx@debian:~$ find /usr/include/shadow.h /usr/include/shadow.h alx@debian:~$ find /usr/include/gshadow.h /usr/include/gshadow.h alx@debian:~$ grep include.*gshadow /usr/include/shadow.h alx@debian:~$ As a result, we were unconditionally including our own "gshadow_.h". Fix that incorrect assumption, and do the following instead: - Include unconditionally our own "gshadow_.h". - Make our "gshadow_.h" include <gshadow.h> if it exists, and only provide the declarations otherwise. While at it, fix the include guard to be consistent with the project. Signed-off-by: Alejandro Colomar <alx@kernel.org>
…libc This check was testing a specific bug in a prehistoric libc version. Red Hat 3 is long dead, and it doesn't make sense to test for that specific bug. Signed-off-by: Alejandro Colomar <alx@kernel.org>
The name of the first field was different. Rename for compatiblity with libc. $ diff -wU10 \ <(grepc sgrp . | sed_rm_ccomments) \ <(grepc sgrp /usr/include/ | sed_rm_ccomments); --- /dev/fd/63 2024-11-06 14:49:03.287204461 +0100 +++ /dev/fd/62 2024-11-06 14:49:03.287204461 +0100 @@ -1,6 +1,7 @@ -./lib/gshadow_.h:struct sgrp { - char *sg_name; +/usr/include/gshadow.h:struct sgrp + { + char *sg_namp; char *sg_passwd; char **sg_adm; char **sg_mem; }; This originates from a typo in this project, which was later copied by glibc, and so the typo was set in stone. The typo was eventually fixed in shadow, but glibc had already set the name in stone, so we should just learn to live with it. $ grep -rn -C3 sg_name ChangeLog 1607- 1608-2011-07-30 Nicolas François <nicolas.francois@centraliens.net> 1609- 1610: * src/chgpasswd.c: Fix typo sp -> sg. sg_namp -> sg_name 1611- * src/chgpasswd.c: Always update the group file when SHADOWGRP is 1612- not enabled. 1613- This is a scripted change: $ find lib* src -type f \ | xargs sed -i 's/\<sg_name\>/sg_namp/g'; Signed-off-by: Alejandro Colomar <alx@kernel.org>
4d42143
to
0f45349
Compare
This check was testing a specific bug in a prehistoric libc version. Red Hat 3 is long dead, and it doesn't make sense to test for that specific bug.
Revisions:
v2
lib/shadow.c
for musl, which doesn't have these APIs.<gshadow.h>
if available.v2b
v3
v3b
v3c
v3d
v3e
v3f
v3g
v3h
v3i
v3j