sudo/sudo-1.7.1-getgrouplist.patch

41 lines
1.3 KiB
Diff

diff -up sudo-1.7.1/check.c.getgrouplist sudo-1.7.1/check.c
--- sudo-1.7.1/check.c.getgrouplist 2009-05-02 21:48:17.000000000 +0200
+++ sudo-1.7.1/check.c 2009-05-02 21:49:04.000000000 +0200
@@ -353,6 +353,24 @@ user_is_exempt()
return(TRUE);
}
+#ifdef HAVE_GETGROUPLIST
+ {
+ gid_t *grouplist, grouptmp;
+ int n_groups, i;
+ n_groups = 1;
+ if (getgrouplist(user_name, user_gid, &grouptmp, &n_groups) == -1) {
+ grouplist = (gid_t *) emalloc(sizeof(gid_t) * (n_groups + 1));
+ if (getgrouplist(user_name, user_gid, grouplist, &n_groups) > 0)
+ for (i = 0; i < n_groups; i++)
+ if (grouplist[i] == grp->gr_gid) {
+ free(grouplist);
+ return(TRUE);
+ }
+ free(grouplist);
+ }
+ }
+#endif
+
return(FALSE);
}
diff -up sudo-1.7.1/configure.in.getgrouplist sudo-1.7.1/configure.in
--- sudo-1.7.1/configure.in.getgrouplist 2009-05-02 21:48:13.000000000 +0200
+++ sudo-1.7.1/configure.in 2009-05-02 21:50:05.000000000 +0200
@@ -1809,7 +1809,7 @@ dnl
AC_FUNC_GETGROUPS
AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \
strftime setrlimit initgroups getgroups fstat gettimeofday \
- setlocale getaddrinfo setsid setenv)
+ setlocale getaddrinfo setsid setenv getgrouplist)
AC_CHECK_FUNCS(unsetenv, SUDO_FUNC_UNSETENV_VOID)
SUDO_FUNC_PUTENV_CONST
if test -z "$SKIP_SETRESUID"; then