[MacPorts] #34572: samba3 @3.6.5 fails to initialize on startup
MacPorts
noreply at macports.org
Tue Aug 7 05:37:09 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 flexcode@…):
Replying to [comment:4 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.
Is there something else needed to patch with? I've tried following the
instructions but obviously I'm missing something here
{{{
osx:samba3 rick$ patch -p0 < ~/Downloads/patch-
source_lib_system_smbd_c.diff
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- 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
--------------------------
File to patch:
}}}
It just asks me what to patch and if I enter Portfile it fails
--
Ticket URL: <https://trac.macports.org/ticket/34572#comment:9>
MacPorts <http://www.macports.org/>
Ports system for Mac OS
More information about the macports-tickets
mailing list