o use suser_xxx rather than suser to support JAIL code.
	o KNF comment convention
	o use vp->type rather than vaddr.type and eliminate call to
	  VOP_GETATTR.  Bruce says that vp->type is valid at this
	  point.

Submitted by: bde.

Not fixed:
	o return (value)
	o Comment needs to be longer and more explicit.  It will be after
	  the advisory.
This commit is contained in:
Warner Losh 1999-08-03 17:07:04 +00:00
parent 93a25fb90a
commit e82ef978fe
2 changed files with 12 additions and 12 deletions

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.125 1999/07/29 17:02:56 green Exp $
* $Id: vfs_syscalls.c,v 1.126 1999/08/02 21:34:46 imp Exp $
*/
/* For 4.3 integer FS ID compatibility */
@ -1892,13 +1892,13 @@ setfflags(p, vp, flags)
int error;
struct vattr vattr;
if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)))
return error;
/*
* Don't allow setting of flags on devices for nonroot users
* Don't allow setting of flags on devices for non-root users.
*/
if ((vattr.va_type == VCHR || vattr.va_type == VBLK) && suser(p))
return 0;
if ((vp->va_type == VCHR || vp->va_type == VBLK) &&
(error = suser_xxx(p->ucred, p, PRISON_ROOT)))
return error;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
VATTR_NULL(&vattr);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94
* $Id: vfs_syscalls.c,v 1.125 1999/07/29 17:02:56 green Exp $
* $Id: vfs_syscalls.c,v 1.126 1999/08/02 21:34:46 imp Exp $
*/
/* For 4.3 integer FS ID compatibility */
@ -1892,13 +1892,13 @@ setfflags(p, vp, flags)
int error;
struct vattr vattr;
if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)))
return error;
/*
* Don't allow setting of flags on devices for nonroot users
* Don't allow setting of flags on devices for non-root users.
*/
if ((vattr.va_type == VCHR || vattr.va_type == VBLK) && suser(p))
return 0;
if ((vp->va_type == VCHR || vp->va_type == VBLK) &&
(error = suser_xxx(p->ucred, p, PRISON_ROOT)))
return error;
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
VATTR_NULL(&vattr);