Root/package/busybox/patches/803-id_getgrouplist.patch

1This patch disable supplementary groups handling in id with uClibc versions
2prior to v0.9.30, which are lacking the 'getgrouplist' function.
3
4Signed-off-by: Nicolas Thill <nico@openwrt.org>
5
6--- a/coreutils/id.c
7+++ b/coreutils/id.c
8@@ -17,10 +17,12 @@
9 
10 #include "libbb.h"
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@@ -82,7 +84,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@@ -154,6 +160,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@@ -181,6 +188,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)
50

Archive Download this file



interactive