package/busybox: revert config defaults inadvertently changed in [28513] (thanks...
[openwrt.git] / package / busybox / patches / 803-id_getgrouplist.patch
1 This patch disable supplementary groups handling in id with uClibc versions
2 prior to v0.9.30, which are lacking the 'getgrouplist' function.
3
4 Signed-off-by: Nicolas Thill <nico@openwrt.org>
5
6 --- a/coreutils/id.c
7 +++ b/coreutils/id.c
8 @@ -63,10 +63,12 @@
9
10 /* This is a NOEXEC applet. Be very careful! */
11
12 +#define HAVE_GETGROUPLIST 1
13 +
14 #if !ENABLE_USE_BB_PWD_GRP
15 #if defined(__UCLIBC_MAJOR__) && (__UCLIBC_MAJOR__ == 0)
16 #if (__UCLIBC_MINOR__ < 9) || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 30)
17 -#error "Sorry, you need at least uClibc version 0.9.30 for id applet to build"
18 +#undef HAVE_GETGROUPLIST
19 #endif
20 #endif
21 #endif
22 @@ -128,7 +130,11 @@ static int get_groups(const char *userna
23 /* If the user is a member of more than
24 * *n groups, then -1 is returned. Otherwise >= 0.
25 * (and no defined way of detecting errors?!) */
26 +#if HAVE_GETGROUPLIST
27 m = getgrouplist(username, rgid, groups, n);
28 +#else
29 + *n = -1;
30 +#endif
31 /* I guess *n < 0 might indicate error. Anyway,
32 * malloc'ing -1 bytes won't be good, so: */
33 if (*n < 0)
34 @@ -210,6 +216,7 @@ int id_main(int argc UNUSED_PARAM, char
35 if (egid != rgid)
36 status |= print_group(egid, " ");
37 }
38 +#if HAVE_GETGROUPLIST
39 /* We are supplying largish buffer, trying
40 * to not run get_groups() twice. That might be slow
41 * ("user database in remote SQL server" case) */
42 @@ -236,6 +243,7 @@ int id_main(int argc UNUSED_PARAM, char
43 }
44 if (ENABLE_FEATURE_CLEAN_UP)
45 free(groups);
46 +#endif
47 #if ENABLE_SELINUX
48 if (is_selinux_enabled()) {
49 if (getcon(&scontext) == 0)
This page took 0.045179 seconds and 5 git commands to generate.