wrap internals of sys_setgroups() so the sys_XX() call can be done unconditionally...
authorGerald Carter <jerry@samba.org>
Wed, 1 Oct 2003 17:01:21 +0000 (17:01 +0000)
committerGerald Carter <jerry@samba.org>
Wed, 1 Oct 2003 17:01:21 +0000 (17:01 +0000)
source/lib/system.c
source/lib/system_smbd.c

index b020a20373054b8233fe4a09409598f4fe30b29b..2e95efec79b4f08c14bb08b92a8f6f15a8c5bd93 100644 (file)
@@ -693,7 +693,6 @@ int sys_getgroups(int setlen, gid_t *gidset)
 #endif /* HAVE_BROKEN_GETGROUPS */
 }
 
-#ifdef HAVE_SETGROUPS
 
 /**************************************************************************
  Wrapper for setgroups. Deals with broken (int) case. Automatically used
@@ -702,6 +701,11 @@ int sys_getgroups(int setlen, gid_t *gidset)
 
 int sys_setgroups(int setlen, gid_t *gidset)
 {
+#if !defined(HAVE_SETGROUPS)
+       errno = ENOSYS;
+       return -1;
+#endif /* HAVE_SETGROUPS */
+
 #if !defined(HAVE_BROKEN_GETGROUPS)
        return setgroups(setlen, gidset);
 #else
@@ -742,8 +746,6 @@ int sys_setgroups(int setlen, gid_t *gidset)
 #endif /* HAVE_BROKEN_GETGROUPS */
 }
 
-#endif /* HAVE_SETGROUPS */
-
 /**************************************************************************
  Wrappers for setpwent(), getpwent() and endpwent()
 ****************************************************************************/
index bcbc8c61e6418acaa852ce818e50a8461d0001c4..73c910e631d2e261317ba3d8f44acbc0a1b9b5cc 100644 (file)
@@ -92,7 +92,7 @@ static int getgrouplist_internals(const char *user, gid_t gid, gid_t *groups, in
 
        restore_re_gid();
 
-       if (setgroups(ngrp_saved, gids_saved) != 0) {
+       if (sys_setgroups(ngrp_saved, gids_saved) != 0) {
                /* yikes! */
                DEBUG(0,("ERROR: getgrouplist: failed to reset group list!\n"));
                smb_panic("getgrouplist: failed to reset group list!\n");