Forked from angerman/samba.3.6.1.osx-getgrouplist.patch
Created
February 23, 2012 00:45
-
-
Save lasombra/1888778 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
--- system.c.orig 2012-02-22 22:46:14.000000000 -0200 | |
+++ system.c 2012-02-22 22:47:51.000000000 -0200 | |
@@ -1161,7 +1161,14 @@ | |
int groups_max(void) | |
{ | |
-#if defined(SYSCONF_SC_NGROUPS_MAX) | |
+#if defined(DARWINOS) | |
+ /* 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. | |
+#elif defined(SYSCONF_SC_NGROUPS_MAX) | |
int ret = sysconf(_SC_NGROUPS_MAX); | |
return (ret == -1) ? NGROUPS_MAX : ret; | |
#else |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment