[MacPorts] #34572: samba3 @3.6.5 fails to initialize on startup
MacPorts
noreply at macports.org
Sun Jul 29 21:25:53 PDT 2012
#34572: samba3 @3.6.5 fails to initialize on startup
-------------------------+--------------------------------------------------
Reporter: jim@… | Owner: mww@…
Type: defect | Status: new
Priority: Normal | Milestone:
Component: ports | Version: 2.1.1
Keywords: | Port: samba3
-------------------------+--------------------------------------------------
Comment(by ayearout@…):
The problem with the original patch, as far as I can tell, is that the
'''SYS_initgroups()''' system call in '''smbd/sec_ctx.c''' requires that
'''groups_max()''' return the correct value. If it is greater than the
system defined '''NGROUPS_MAX''', '''SYS_initgroups()''' throws an
"Invalid argument" error and returns -1, causing the smbd process to bail.
The below patch solves the problem by going a different route:
{{{
--- lib/system_smbd.c.orig 2012-07-29 19:48:57.000000000 -0700
+++ lib/system_smbd.c 2012-07-29 19:49:09.000000000 -0700
@@ -210,7 +210,11 @@
gid_t *groups;
int i;
+#if defined(DARWINOS)
+ 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;
}}}
I modified the '''getgroups_unix_user()''' call in '''lib/system_smbd.c'''
to allow users to be in more than the 16 group maximum if compiled on
Darwin platforms. The patch specifies a static value of 128, which should
work in most cases. This still functions correctly because Darwin's
'''getgroups()''' call will happily return more groups than what is
defined in '''NGROUPS_MAX''' if the correct macros are defined. It's only
when using '''setgroups()''' or the '''SYS_initgroups()''' system call
that you run into the limit problems.
I've tested the patch on my system using Samba 3.6.6 with no issues. A
user in 20 groups correctly resolves all groups. I also configured a test
share with 20 individual folders, each with different group permissions,
and Samba correctly resolved the permissions for all folders.
I hope this helps others! I've attached the patch as a file as well.
--
Ticket URL: <https://trac.macports.org/ticket/34572#comment:4>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list