From: Alejandro Colomar Date: Sat, 16 Nov 2024 12:08:12 +0000 (+0100) Subject: configure.ac, lib/, src/: Use gid_t instead of GETGROUPS_T X-Git-Tag: 4.17.3~32 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e083b380188ca361d4d965db36744e2328071c4e;p=thirdparty%2Fshadow.git configure.ac, lib/, src/: Use gid_t instead of GETGROUPS_T Autoconf's NEWS file says *** AC_FUNC_GETGROUPS and AC_TYPE_GETGROUPS no longer run test programs. These macros were testing for OS bugs that we believe are at least twenty years in the past. Most operating systems are now trusted to provide an accurate prototype for getgroups in unistd.h, and to implement it as specified in POSIX. Reviewed-by: Serge Hallyn Signed-off-by: Alejandro Colomar --- diff --git a/configure.ac b/configure.ac index 5281fa4f4..6c19eedef 100644 --- a/configure.ac +++ b/configure.ac @@ -66,7 +66,6 @@ AC_CHECK_MEMBERS([struct utmpx.ut_name, struct utmpx.ut_xtime],,,[[#include ]]) dnl Checks for library functions. -AC_TYPE_GETGROUPS AC_FUNC_UTIME_NULL AC_REPLACE_FUNCS(putgrent putpwent putspent) AC_REPLACE_FUNCS(sgetgrent sgetpwent sgetspent) diff --git a/lib/addgrps.c b/lib/addgrps.c index 29cb1f232..bfdaf2edc 100644 --- a/lib/addgrps.c +++ b/lib/addgrps.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "alloc/malloc.h" #include "alloc/reallocf.h" @@ -33,9 +34,9 @@ int add_groups(const char *list) { - GETGROUPS_T *gids; char *g, *p, *dup; FILE *shadow_logfd = log_get_logfd(); + gid_t *gids; size_t n; ssize_t n0; @@ -43,7 +44,7 @@ add_groups(const char *list) if (n0 == -1) return -1; - gids = MALLOC(n0, GETGROUPS_T); + gids = MALLOC(n0, gid_t); if (gids == NULL) return -1; @@ -51,7 +52,7 @@ add_groups(const char *list) if (n0 == -1) goto free_gids; - gids = REALLOCF(gids, n0 + strchrscnt(list, ",:") + 1, GETGROUPS_T); + gids = REALLOCF(gids, n0 + strchrscnt(list, ",:") + 1, gid_t); if (gids == NULL) return -1; diff --git a/src/newgrp.c b/src/newgrp.c index 7a4e1a8ad..ee31b56b2 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -14,7 +14,7 @@ #include #include #include -#include +#include #include "agetpass.h" #include "alloc/x/xmalloc.h" @@ -31,6 +31,8 @@ #include "string/strcmp/streq.h" #include "string/strdup/xstrdup.h" +#include + /* * Global variables @@ -40,7 +42,7 @@ static const char *Prog; extern char **newenvp; static size_t ngroups; -static /*@null@*/ /*@only@*/GETGROUPS_T *gids; +static /*@null@*/ /*@only@*/gid_t *gids; static bool is_newgrp; @@ -560,7 +562,7 @@ int main (int argc, char **argv) if (ngroups == -1) goto fail_gg; - gids = XMALLOC(ngroups, GETGROUPS_T); + gids = XMALLOC(ngroups, gid_t); ngroups = getgroups(ngroups, gids); if (ngroups == -1) { @@ -681,7 +683,7 @@ fail_gg: * If the group doesn't fit, I'll complain loudly and skip this * part. */ - gids = XREALLOC(gids, ngroups + 1, GETGROUPS_T); + gids = XREALLOC(gids, ngroups + 1, gid_t); LSEARCH(&gid, gids, &ngroups);