]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
configure.ac, lib/, src/: Assume setgroups(2) exists
authorAlejandro Colomar <alx@kernel.org>
Sat, 16 Nov 2024 12:23:54 +0000 (13:23 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 24 Jan 2025 01:50:01 +0000 (19:50 -0600)
It's available in every system I checked: glibc,musl,{Free,Net,Open}BSD.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
configure.ac
lib/addgrps.c
lib/prototypes.h
src/newgrp.c

index a7388e79bab8b53df639971d048e4f8b1ca22dc1..c6cdf8f23f5b0c5b1fa49ee5341ad732a1426754 100644 (file)
@@ -49,7 +49,7 @@ AC_CHECK_HEADER([shadow.h],,[AC_MSG_ERROR([You need a libc with shadow.h])])
 AC_CHECK_FUNCS(arc4random_buf futimes \
        getentropy getrandom getspnam getusershell \
        initgroups lckpwdf lutimes \
-       setgroups updwtmpx innetgr \
+       updwtmpx innetgr \
        getspnam_r \
        rpmatch \
        memset_explicit explicit_bzero stpecpy stpeprintf)
index 97c47e077f3b69a6e6b187b1a178e0513f65f4fa..9eb59c583b59d55e2d8b325544388e32d1a0e995 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <config.h>
 
-#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
+#if !defined(USE_PAM)
 
 #include "prototypes.h"
 #include "defines.h"
@@ -110,7 +110,6 @@ add_groups(const char *list)
        free (grouplist);
        return 0;
 }
-#else                          /* HAVE_SETGROUPS && !USE_PAM */
+#else                          /* !USE_PAM */
 extern int ISO_C_forbids_an_empty_translation_unit;
-#endif                         /* HAVE_SETGROUPS && !USE_PAM */
-
+#endif                         /* !USE_PAM */
index 6b978a97517a8a6b660c90c4ec0f4df8be898ab9..71bea819c9c506d99db6b4d4b506818aea62a834 100644 (file)
@@ -36,7 +36,7 @@
 #include "commonio.h"
 
 /* addgrps.c */
-#if defined (HAVE_SETGROUPS) && ! defined (USE_PAM)
+#if !defined(USE_PAM)
 extern int add_groups (const char *);
 #endif
 
index f73508663c8102c87d1874fd5ad4343eeba5acc2..11194c87319a768c0ba4a203f13a52f97391b6f5 100644 (file)
@@ -38,10 +38,8 @@ static const char *Prog;
 
 extern char **newenvp;
 
-#ifdef HAVE_SETGROUPS
 static int ngroups;
 static /*@null@*/ /*@only@*/GETGROUPS_T *grouplist;
-#endif
 
 static bool is_newgrp;
 
@@ -551,7 +549,6 @@ int main (int argc, char **argv)
                }
        }
 
-#ifdef HAVE_SETGROUPS
        /*
         * get the current user's groupset. The new group will be added to
         * the concurrent groupset if there is room, otherwise you get a
@@ -584,7 +581,6 @@ int main (int argc, char **argv)
 #endif
                exit (EXIT_FAILURE);
        }
-#endif                         /* HAVE_SETGROUPS */
 
        /*
         * now we put her in the new group. The password file entry for her
@@ -632,7 +628,6 @@ int main (int argc, char **argv)
                goto failure;
        }
 
-#ifdef HAVE_SETGROUPS
        /* when using pam_group, she will not be listed in the groups
         * database. However getgroups() will return the group. So
         * if she is listed there already it is ok to grant membership.
@@ -643,7 +638,7 @@ int main (int argc, char **argv)
                        break;
                }
        }
-#endif                          /* HAVE_SETGROUPS */
+
        /*
         * For split groups (due to limitations of NIS), check all
         * groups of the same GID like the requested group for
@@ -688,7 +683,6 @@ int main (int argc, char **argv)
 
        gid = grp->gr_gid;
 
-#ifdef HAVE_SETGROUPS
        /*
         * I am going to try to add her new group id to her concurrent group
         * set. If the group id is already present I'll just skip this part.
@@ -710,7 +704,6 @@ int main (int argc, char **argv)
                        }
                }
        }
-#endif
 
        /*
         * Close all files before changing the user/group IDs.