diff options
author | Alex Richardson <Alexander.Richardson@cl.cam.ac.uk> | 2018-10-05 09:35:40 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2021-09-09 17:43:19 +0000 |
commit | 2c18a982537ea1a62e4d802c9ae0ef06b36158dc (patch) | |
tree | 1852336c6539bee46544be147b9116bc23bd0ef6 /testsuite | |
parent | 9e7d2d9794af7251c42cb22f23ee9f86c6ea05c1 (diff) | |
download | samba-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 'testsuite')
-rw-r--r-- | testsuite/smbd/sec_ctx_utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/testsuite/smbd/sec_ctx_utils.c b/testsuite/smbd/sec_ctx_utils.c index e72292b9864..3834cfd4a16 100644 --- a/testsuite/smbd/sec_ctx_utils.c +++ b/testsuite/smbd/sec_ctx_utils.c @@ -30,7 +30,7 @@ void get_random_grouplist(int *ngroups, gid_t **groups) { int i; - *ngroups = random() % groups_max(); + *ngroups = random() % setgroups_max(); *groups = malloc(*ngroups * sizeof(gid_t)); if (!groups) { |