Created
January 4, 2012 11:09
-
-
Save angerman/1559603 to your computer and use it in GitHub Desktop.
_SC_NGROUPS_MAX cannot be used with getgrouplist on OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- a/source3/lib/system.c 2011-10-18 20:48:48.000000000 +0200 | |
+++ b/source3/lib/system.c 2012-01-04 11:57:25.000000000 +0100 | |
@@ -1159,6 +1159,13 @@ | |
int groups_max(void) | |
{ | |
+ /* On OS X, sysconf(_SC_NGROUPS_MAX) returns 16 | |
+ * due to OS X's group nesting and getgrouplist | |
+ * will return a flat list; users can exceed the | |
+ * maximum of 16 groups. And easily will. | |
+ */ | |
+ return 32; // NGROUPS_MAX is defined, hence the define above is void. | |
+ | |
#if defined(SYSCONF_SC_NGROUPS_MAX) | |
int ret = sysconf(_SC_NGROUPS_MAX); | |
return (ret == -1) ? NGROUPS_MAX : ret; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment