1 This patch disable supplementary groups handling in id with uClibc versions
2 prior to v0.9.30, which are lacking the 'getgrouplist' function.
4 Signed-off-by: Nicolas Thill <nico@openwrt.org>
10 /* This is a NOEXEC applet. Be very careful! */
12 +#define HAVE_GETGROUPLIST 1
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
22 @@ -84,7 +86,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);
31 /* I guess *n < 0 might indicate error. Anyway,
32 * malloc'ing -1 bytes won't be good, so: */
34 @@ -156,6 +162,7 @@ int id_main(int argc UNUSED_PARAM, char
36 status |= print_group(egid, " ");
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 @@ -183,6 +190,7 @@ int id_main(int argc UNUSED_PARAM, char
44 if (ENABLE_FEATURE_CLEAN_UP)
48 if (is_selinux_enabled()) {
49 if (getcon(&scontext) == 0)