]> git.ipfire.org Git - thirdparty/shadow.git/commit
lib/gshadow_.h: Fix compatibility with libc's struct sgrp
authorAlejandro Colomar <alx@kernel.org>
Wed, 6 Nov 2024 13:51:06 +0000 (14:51 +0100)
committerAlejandro Colomar <alx@kernel.org>
Fri, 24 Jan 2025 11:10:15 +0000 (12:10 +0100)
commit7b8b416681dae6f551ccc009a0b6be7b90ea6080
tree0922c5bb3b3016e7eebdddc4740b96e4e8d68651
parentda6b9cff02d583ef169a0bc0c1014b19b5fad2fb
lib/gshadow_.h: Fix compatibility with libc's struct sgrp

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';

Reviewed-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
14 files changed:
lib/gshadow.c
lib/gshadow_.h
lib/sgroupio.c
src/chgpasswd.c
src/gpasswd.c
src/groupadd.c
src/groupmems.c
src/groupmod.c
src/grpck.c
src/grpconv.c
src/newusers.c
src/useradd.c
src/userdel.c
src/usermod.c