Date: Mon, 9 Feb 2004 17:10:59 +0100 From: Andre Albsmeier <andre.albsmeier@siemens.com> To: freebsd-hackers@freebsd.org Cc: Andre.Albsmeier@siemens.com Subject: Making inheritance of group ID configurable Message-ID: <20040209161059.GA732@curry.mchp.siemens.de>
next in thread | raw e-mail | index | archive | help
New items created on an ufs normally inherit their group ID from the parent directory. I have the need for making this configurable. Since the set-group-ID bit is not used for directories on BSD, I would like to use it to decide on this: If it is set, the group ID of the newly created item corresponds to the one of the creating process. (Yeah, this is exactly the wrong way around compared to what "the Others" do but I don't want to change the BSD default). I am currently using this patch. It seems to work great but I would like to know if I have forgotten something ;-) --- sys/ufs/ufs/ufs_vnops.c.ORI Fri Jan 3 08:41:47 2003 +++ sys/ufs/ufs/ufs_vnops.c Mon Feb 9 16:32:46 2004 @@ -1276,6 +1276,11 @@ if (error) goto out; ip = VTOI(tvp); +#ifdef ANDRE + if( (dp->i_mode & ISGID) ) + ip->i_gid = cnp->cn_cred->cr_gid; + else +#endif ip->i_gid = dp->i_gid; #ifdef SUIDDIR { @@ -2070,6 +2075,11 @@ if (error) return (error); ip = VTOI(tvp); +#ifdef ANDRE + if( (pdir->i_mode & ISGID) ) + ip->i_gid = cnp->cn_cred->cr_gid; + else +#endif ip->i_gid = pdir->i_gid; #ifdef SUIDDIR { Any hints are welcome. Thanks, -Andre
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040209161059.GA732>