From owner-freebsd-hackers@FreeBSD.ORG Mon Feb 9 08:11:03 2004 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1D9BC16A4CE for ; Mon, 9 Feb 2004 08:11:03 -0800 (PST) Received: from goliath.siemens.de (goliath.siemens.de [192.35.17.28]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6413743D1F for ; Mon, 9 Feb 2004 08:11:02 -0800 (PST) (envelope-from andre.albsmeier@siemens.com) Received: from mail3.siemens.de (mail3.siemens.de [139.25.208.14]) by goliath.siemens.de (8.11.7/8.11.7) with ESMTP id i19GB0M21173 for ; Mon, 9 Feb 2004 17:11:01 +0100 (MET) Received: from mars.cert.siemens.de (ust.mchp.siemens.de [139.23.201.17]) by mail3.siemens.de (8.11.7/8.11.7) with ESMTP id i19GAx319069 for ; Mon, 9 Feb 2004 17:11:00 +0100 (MET) Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.42.7]) mail/cert.mc.pre,v 1.56 2003/11/06 20:07:28 ust Exp $) with ESMTP id i19GAxx0017196 for ; Mon, 9 Feb 2004 17:10:59 +0100 (CET) Received: (from localhost) by curry.mchp.siemens.de (8.12.10/8.12.10) id i19GAxm7003079; Date: Mon, 9 Feb 2004 17:10:59 +0100 From: Andre Albsmeier To: freebsd-hackers@freebsd.org Message-ID: <20040209161059.GA732@curry.mchp.siemens.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Echelon: SEMTEX, 707, CERT, MI5, Secret Service X-Advice: Drop that crappy M$-Outlook, I'm tired of your viruses! User-Agent: Mutt/1.5.4i cc: Andre.Albsmeier@siemens.com Subject: Making inheritance of group ID configurable X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Feb 2004 16:11:03 -0000 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