setegid bug

Stanislav Sedov stas at FreeBSD.org
Thu Jun 7 19:32:50 UTC 2007


Hi!

Recently several FreeBSD samba users reported a scary problem with
samba (http://bugzilla.samba.org/?id=3990). Further research in
cooperation with Timur Bakeyev (timur) showed, that we have a little
problem with setegid implementation. In FreeBSD (and even in
4.4BSD-Lite2) egid of the process is merely groups[0], so calling
seteuid function we simply override the first of supplementary groups.
However, POSIX says that not rgid, not any of supplementary groups
should bot be rewritten in setegid call.

There's some comments about optimizations which caused so scary
implementation, but I can't get what these optimizations are. Our first
cvs revision of kern_prot.c already contains similar implementation
with egid being effectively groups[0].

Probably, some of old-school committers remembered the initial
intention of making egid equal to groups[0]? Probably, I have missed
something?

Thanks a lot!

-- 
Stanislav Sedov
ST4096-RIPE
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-arch/attachments/20070607/52297e7b/attachment.pgp


More information about the freebsd-arch mailing list