1 |
diff -up sudo-1.7.4p4/configure.in.getgrouplist sudo-1.7.4p4/configure.in |
2 |
--- sudo-1.7.4p4/configure.in.getgrouplist 2010-09-07 15:53:38.400260828 +0200 |
3 |
+++ sudo-1.7.4p4/configure.in 2010-09-07 15:54:48.751188374 +0200 |
4 |
@@ -1913,7 +1913,7 @@ AC_FUNC_GETGROUPS |
5 |
AC_CHECK_FUNCS(strchr strrchr memchr memcpy memset sysconf tzset \ |
6 |
strftime setrlimit initgroups getgroups fstat gettimeofday \ |
7 |
regcomp setlocale getaddrinfo setenv vhangup \ |
8 |
- mbr_check_membership setrlimit64) |
9 |
+ mbr_check_membership setrlimit64 getgrouplist) |
10 |
AC_CHECK_FUNCS(getline, [], [ |
11 |
AC_LIBOBJ(getline) |
12 |
AC_CHECK_FUNCS(fgetln) |
13 |
diff -up sudo-1.7.4p4/pwutil.c.getgrouplist sudo-1.7.4p4/pwutil.c |
14 |
--- sudo-1.7.4p4/pwutil.c.getgrouplist 2010-09-07 15:53:26.816198477 +0200 |
15 |
+++ sudo-1.7.4p4/pwutil.c 2010-09-07 15:54:16.990188543 +0200 |
16 |
@@ -628,5 +628,23 @@ user_in_group(pw, group) |
17 |
} |
18 |
#endif /* HAVE_MBR_CHECK_MEMBERSHIP */ |
19 |
|
20 |
+#ifdef HAVE_GETGROUPLIST |
21 |
+ { |
22 |
+ gid_t *grouplist, grouptmp; |
23 |
+ int n_groups, i; |
24 |
+ n_groups = 1; |
25 |
+ if (getgrouplist(user_name, user_gid, &grouptmp, &n_groups) == -1) { |
26 |
+ grouplist = (gid_t *) emalloc(sizeof(gid_t) * (n_groups + 1)); |
27 |
+ if (getgrouplist(user_name, user_gid, grouplist, &n_groups) > 0) |
28 |
+ for (i = 0; i < n_groups; i++) |
29 |
+ if (grouplist[i] == grp->gr_gid) { |
30 |
+ free(grouplist); |
31 |
+ return(TRUE); |
32 |
+ } |
33 |
+ free(grouplist); |
34 |
+ } |
35 |
+ } |
36 |
+#endif /* HAVE_GETGROUPLIST */ |
37 |
+ |
38 |
return(FALSE); |
39 |
} |