<pre style='margin:0'>
Christopher Nielsen (mascguy) pushed a commit to branch master
in repository macports-ports.
</pre>
<p><a href="https://github.com/macports/macports-ports/commit/76525fd13b5487b8ef4f676aebb79f38a9e2f41e">https://github.com/macports/macports-ports/commit/76525fd13b5487b8ef4f676aebb79f38a9e2f41e</a></p>
<pre style="white-space: pre; background: #F8F8F8"><span style='display:block; white-space:pre;color:#808000;'>commit 76525fd13b5487b8ef4f676aebb79f38a9e2f41e
</span>Author: Phil <ph7@github.com>
AuthorDate: Sun Dec 12 21:22:04 2021 -0800
<span style='display:block; white-space:pre;color:#404040;'> samba4: fix get_user_groups issue.
</span><span style='display:block; white-space:pre;color:#404040;'> Add patch to resolve error: "get_user_groups: failed to get the unix group list"
</span>---
net/samba4/Portfile | 18 +++++++-
net/samba4/files/patch-macos-grouplimit.diff | 63 ++++++++++++++++++++++++++++
2 files changed, 80 insertions(+), 1 deletion(-)
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/samba4/Portfile b/net/samba4/Portfile
</span><span style='display:block; white-space:pre;color:#808080;'>index 82a51ffdde5..240042c05b6 100644
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>--- a/net/samba4/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/samba4/Portfile
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -42,7 +42,23 @@ patch.pre_args -p1
</span> platform darwin {
# fix missing header
patchfiles-append patch-fix-debug.diff
<span style='display:block; white-space:pre;background:#ffe0e0;'>-}
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # patch "get_user_groups: failed to get the unix group list" on
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # macOS
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # Samba fails on macOS when current user belows to more than 16
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # groups.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # The 16 group limit is returned by sysconf when asked for
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # _SC_NGROUPS_MAX; this is apparently due to OS X's nested groups;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # while the call to getgrouplist returns a flat (not nested) group
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # list. getgrouplist will happily return the first 16 groups but
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # still return a -1 return code, indicating failure. Hence the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # strange maximum of 16 groups on OS X.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ # https://github.com/Homebrew/legacy-homebrew/issues/5954
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ patchfiles-append patch-macos-grouplimit.diff
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ }
</span>
# patch to disable building documentation on MacOS
# this enables us to have a working samba4 port without docs,
<span style='display:block; white-space:pre;color:#808080;'>diff --git a/net/samba4/files/patch-macos-grouplimit.diff b/net/samba4/files/patch-macos-grouplimit.diff
</span>new file mode 100644
<span style='display:block; white-space:pre;color:#808080;'>index 00000000000..3768c8502c8
</span><span style='display:block; white-space:pre;background:#ffe0e0;'>--- /dev/null
</span><span style='display:block; white-space:pre;background:#e0e0ff;'>+++ b/net/samba4/files/patch-macos-grouplimit.diff
</span><span style='display:block; white-space:pre;background:#e0e0e0;'>@@ -0,0 +1,63 @@
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/source3/lib/system.c b/source3/lib/system.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index f1265e0..a02055a 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/source3/lib/system.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/source3/lib/system.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -844,7 +844,25 @@ void sys_srandom(unsigned int seed)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int groups_max(void)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+-#if defined(SYSCONF_SC_NGROUPS_MAX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(DARWINOS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Fixes the Grouplimit of 16 users os OS X
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Bug has been raised upstream: https://bugzilla.samba.org/show_bug.cgi?id=8773
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * "https://raw.github.com/gist/1892831/af9ac310b5bd2ffafc79a6ae04d6f9e23e3593ee/samba.3.6.3.osx-getgrouplist.patch"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * On OS X, sysconf(_SC_NGROUPS_MAX) returns 16 due to OS X's group nesting
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * and getgrouplist will return a flat list; users do almost always exceed the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * maximum of 16 groups.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://bugzilla.samba.org/show_bug.cgi?id=8773
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://github.com/mxcl/homebrew/issues/5954
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://serverfault.com/questions/414908/osx-10-7-4-samba3-6-6-get-user-groups-failed-to-get-the-unix-group-list
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://gist.github.com/lasombra/1888778
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://github.com/Homebrew/legacy-homebrew/pull/10311
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ return 128;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#elif defined(SYSCONF_SC_NGROUPS_MAX)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int ret = sysconf(_SC_NGROUPS_MAX);
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ return (ret == -1) ? NGROUPS_MAX : ret;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ #else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+diff --git a/source3/lib/system_smbd.c b/source3/lib/system_smbd.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+index 3b1ac9c..748c788 100644
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+--- a/source3/lib/system_smbd.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++++ b/source3/lib/system_smbd.c
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+@@ -205,7 +205,27 @@ bool getgroups_unix_user(TALLOC_CTX *mem_ctx, const char *user,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gid_t primary_gid,
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gid_t **ret_groups, uint32_t *p_ngroups)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ {
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#if defined(DARWINOS)
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ /*
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Fixes the Grouplimit of 16 users os OS X
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * Bug has been raised upstream: https://bugzilla.samba.org/show_bug.cgi?id=8773
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * "https://raw.github.com/gist/1892831/af9ac310b5bd2ffafc79a6ae04d6f9e23e3593ee/samba.3.6.3.osx-getgrouplist.patch"
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * On OS X, sysconf(_SC_NGROUPS_MAX) returns 16 due to OS X's group nesting
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * and getgrouplist will return a flat list; users do almost always exceed the
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * maximum of 16 groups.
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ *
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://bugzilla.samba.org/show_bug.cgi?id=8773
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://github.com/mxcl/homebrew/issues/5954
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://serverfault.com/questions/414908/osx-10-7-4-samba3-6-6-get-user-groups-failed-to-get-the-unix-group-list
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://gist.github.com/lasombra/1888778
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ * https://github.com/Homebrew/legacy-homebrew/pull/10311
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ */
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++ int max_grp = 128;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#else
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ int max_grp = MIN(128, groups_max());
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>++#endif
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gid_t stack_groups[max_grp];
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ uint32_t ngrp;
</span><span style='display:block; white-space:pre;background:#e0ffe0;'>+ gid_t *temp_groups = stack_groups;
</span></pre><pre style='margin:0'>
</pre>