--- lib/system_smbd.c.orig 2015-02-23 01:11:32.000000000 +1100 +++ lib/system_smbd.c 2017-11-06 14:40:13.000000000 +1100 @@ -210,7 +210,14 @@ bool getgroups_unix_user(TALLOC_CTX *mem gid_t *groups; int i; +#ifdef DARWINOS + /* getgrouplist() can return a lot more than NGROUPS_MAX groups + (which is what groups_max() uses) and will fail if the array is + too small to hold all the groups. */ + max_grp = 128; +#else max_grp = MIN(128, groups_max()); +#endif temp_groups = SMB_MALLOC_ARRAY(gid_t, max_grp); if (! temp_groups) { return False;