summaryrefslogtreecommitdiff
path: root/buildtools
diff options
context:
space:
mode:
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>2018-10-05 09:35:40 +0100
committerJeremy Allison <jra@samba.org>2021-09-09 17:43:19 +0000
commit2c18a982537ea1a62e4d802c9ae0ef06b36158dc (patch)
tree1852336c6539bee46544be147b9116bc23bd0ef6 /buildtools
parent9e7d2d9794af7251c42cb22f23ee9f86c6ea05c1 (diff)
downloadsamba-2c18a982537ea1a62e4d802c9ae0ef06b36158dc.tar.gz
Don't use sysconf(_SC_NGROUPS_MAX) on macOS for getgroups()
On MacOS sysconf(_SC_NGROUPS_MAX) always returns 16. However, this is not the value used by getgroups(2). MacOS uses nested groups but getgroups(2) will return the flattened list which can easily exceed 16 groups. In my testing getgroups() already returns 16 groups on a freshly installed system. And on a 10.14 system the root user is in more than 16 groups by default which makes it impossible to run smbd without this change. Setting _DARWIN_UNLIMITED_GETGROUPS allows getgroups() to return more than 16 groups. This also changes set_unix_security_ctx() to only set up to 16 groups since that is the limit for initgroups() according to the manpage. BUG: https://bugzilla.samba.org/show_bug.cgi?id=8773 Signed-off-by: Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Thu Sep 9 17:43:19 UTC 2021 on sn-devel-184
Diffstat (limited to 'buildtools')
-rw-r--r--buildtools/wafsamba/wscript5
1 files changed, 4 insertions, 1 deletions
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 7be61e80abb..d13dbd97912 100644
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -539,7 +539,10 @@ struct foo bar = { .y = 'X', .x = 1 };
conf.CHECK_HEADERS('strings.h inttypes.h stdint.h unistd.h minix/config.h', add_headers=True)
conf.CHECK_HEADERS('ctype.h', add_headers=True)
- if sys.platform != 'darwin':
+ if sys.platform == 'darwin':
+ conf.DEFINE('_DARWIN_C_SOURCE', 1, add_to_cflags=True)
+ conf.DEFINE('_DARWIN_UNLIMITED_GETGROUPS', 1, add_to_cflags=True)
+ else:
conf.CHECK_HEADERS('standards.h', add_headers=True)
conf.CHECK_HEADERS('stdbool.h stdint.h stdarg.h vararg.h', add_headers=True)