diff -up sudo-1.7.4p4/configure.in.getgrouplist sudo-1.7.4p4/configure.in --- sudo-1.7.4p4/configure.in.getgrouplist 2011-01-11 10:45:49.170262147 +0100 +++ sudo-1.7.4p4/configure.in 2011-01-11 10:45:49.176261407 +0100 @@ -1913,7 +1913,7 @@ AC_FUNC_GETGROUPS AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \ strftime setrlimit initgroups getgroups fstat gettimeofday \ regcomp setlocale getaddrinfo setenv vhangup \ - mbr_check_membership setrlimit64) + mbr_check_membership setrlimit64 getgrouplist) AC_CHECK_FUNCS(getline, [], [ AC_LIBOBJ(getline) AC_CHECK_FUNCS(fgetln) diff -up sudo-1.7.4p4/pwutil.c.getgrouplist sudo-1.7.4p4/pwutil.c --- sudo-1.7.4p4/pwutil.c.getgrouplist 2010-08-06 15:44:30.000000000 +0200 +++ sudo-1.7.4p4/pwutil.c 2011-01-11 11:42:16.771282451 +0100 @@ -628,5 +628,26 @@ user_in_group(pw, group) } #endif /* HAVE_MBR_CHECK_MEMBERSHIP */ +#ifdef HAVE_GETGROUPLIST + if (user_ngroups >= 0 && + strcmp(pw->pw_name, list_pw ? list_pw->pw_name : user_name) == 0) + { + 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 /* HAVE_GETGROUPLIST */ + return(FALSE); }