From: Todd C. Miller Date: Tue, 16 Nov 2004 23:59:56 +0000 (+0000) Subject: Add configure check for getgroups() X-Git-Tag: SUDO_1_7_0~813 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f7f282ba13a4fb45b003171917051d55618d97bb;p=sudo Add configure check for getgroups() --- diff --git a/config.h.in b/config.h.in index 7935afdde..c60cbc6b1 100644 --- a/config.h.in +++ b/config.h.in @@ -125,6 +125,9 @@ /* Define to 1 if you have the `getdomainname' function. */ #undef HAVE_GETDOMAINNAME +/* Define to 1 if you have the `getgroups' function. */ +#undef HAVE_GETGROUPS + /* Define to 1 if you have the `getifaddrs' function. */ #undef HAVE_GETIFADDRS diff --git a/configure b/configure index 84a4e4422..3d3abf638 100755 --- a/configure +++ b/configure @@ -25609,8 +25609,9 @@ esac + for ac_func in strchr strrchr memchr memcpy memset sysconf tzset \ - strftime setrlimit initgroups fstat + strftime setrlimit initgroups getgroups fstat do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` echo "$as_me:$LINENO: checking for $ac_func" >&5 diff --git a/configure.in b/configure.in index 3bdd03cfb..62cf1d702 100644 --- a/configure.in +++ b/configure.in @@ -1674,7 +1674,7 @@ dnl dnl Function checks dnl AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \ - strftime setrlimit initgroups fstat) + strftime setrlimit initgroups getgroups fstat) if test -z "$SKIP_SETRESUID"; then AC_CHECK_FUNCS(setresuid, [SKIP_SETREUID=yes]) fi diff --git a/sudo.c b/sudo.c index bc40007a5..940275081 100644 --- a/sudo.c +++ b/sudo.c @@ -553,11 +553,13 @@ init_vars(sudo_mode) /* It is now safe to use log_error() and set_perms() */ +#ifdef HAVE_GETGROUPS if ((user_ngroups = getgroups(0, NULL)) > 0) { user_groups = emalloc2(user_ngroups, sizeof(gid_t)); if (getgroups(user_ngroups, user_groups) < 0) log_error(USE_ERRNO|MSG_ONLY, "can't get group vector"); } +#endif if (def_fqdn) set_fqdn(); /* may call log_error() */