Patch for Samba 2.2.6 & 2.2.7 to work on OS X

Michael Bennett michaelb777 at
Thu Jan 16 06:08:00 GMT 2003

In version 2.2.6 there was a change in util_sec.c that causes Samba to fail 
on OS X due to use of setregid().  Previously, Samba worked flawlessly on 
OS X.  Apparently this is also a problem in other BSD-based operating 
systems, as this sparse bug report indicates in its headers:

The function setregid() does not work correctly on our platform.

The error message (log.smbd) is as follows:
Failed to set gid privileges to (0,32766) now set to (32766,32766) uid = (0,0)
PANIC: failed to set gid

According to the man page (man setregid):
This function did not work correctly, and its purpose is now better served 
by the use of the setegid() function."


The problem reported is identical to the one I am having on OS X (unable to 
browse or do anything requiring privs).  There is a patch included in the 
report that fixes the problem on OS X 10.2.3.  I have also tested it 
(successfully!) to make sure it doesn't break anything on Linux with 
Slackware 8.1 (upgraded to 2.4.20).

So... comments?  Does the patch Do The Right Thing?  Think this patch or 
something similar could get merged sometime? :)

Michael Bennett
mibenne2 at

More information about the samba-technical mailing list