Return to BSD News archive
Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!headwall.Stanford.EDU!kithrup.com!sef
From: sef@kithrup.com (Sean Eric Fagan)
Subject: Re: bug with ufs file creation
Organization: Kithrup Enterprises, Ltd.
References: <CCyLF6.n6@kithrup.com> <322@rook.ukc.ac.uk>
Message-ID: <CD0H7I.GyE@kithrup.com>
Date: Wed, 8 Sep 1993 01:23:27 GMT
Lines: 69
In article <322@rook.ukc.ac.uk> dac@ukc.ac.uk (David Clear) writes:
>A better solution (personally I'd leave it as it is)
>would be the SunOS approach whereby the semantics you favour exist -
Fine. Actually, you have the semantics backwards: "mount -o grpid"
causes the BSD semantics, and I've kept it the same. However, it would
be trivial to change it.
*** sys.386bsd/sys/mount.h.~7~ Tue Aug 24 18:20:40 1993
--- sys.386bsd/sys/mount.h Tue Sep 7 13:09:17 1993
***************
*** 117,122 ****
--- 117,123 ----
#define MNT_NOSUID 0x00000008 /* don't honor setuid bits on fs */
#define MNT_NODEV 0x00000010 /* don't interpret special files */
#define MNT_UNION 0x00000020 /* union with underlying filesystem */
+ #define MNT_GRPID 0x00000040 /* files inheiret directory's gid */
/*
* exported mount flags.
*** sys.386bsd/ufs/ufs_vnops.c.~1~ Sat Jun 5 11:31:29 1993
--- sys.386bsd/ufs/ufs_vnops.c Tue Sep 7 13:13:42 1993
***************
*** 1623,1629 ****
}
ip = tip;
ip->i_uid = ndp->ni_cred->cr_uid;
! ip->i_gid = pdir->i_gid;
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ndp->ni_cred, 0))) {
--- 1623,1639 ----
}
ip = tip;
ip->i_uid = ndp->ni_cred->cr_uid;
! /*
! * If the SGID bit is set on the parent directory,
! * use its GID for the file; otherwise, use the 'default
! * group' of the creating process.
! */
! if ((pdir->i_mode & S_ISGID) ||
! (ip->i_vnode->v_mount &&
! ip->i_vnode->v_mount.mnt_flag & MNT_GRPID))
! ip->i_gid = pdir->i_gid;
! else
! ip->i_gid = ndp->ni_cred->cr_groups[0];
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ndp->ni_cred, 0))) {
*** sbin/mount/mount.c.~1~ Mon Feb 24 21:30:40 1992
--- sbin/mount/mount.c Tue Sep 7 13:07:39 1993
***************
*** 511,516 ****
--- 511,525 ----
*flagp &= ~MNT_SYNCHRONOUS;
continue;
}
+ #ifdef MNT_GRPID
+ if (!strcasecmp(opt, "grpid")) {
+ if (!negative)
+ *flagp |= MNT_GRPID;
+ else
+ *flagp &= ~MNT_GRPID;
+ continue;
+ }
+ #endif /* MNT_GRPID */
}
}