diff options
author | imp <imp@FreeBSD.org> | 1999-08-04 04:52:18 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 1999-08-04 04:52:18 +0000 |
commit | 54b72818fb6a387f752eaac619145951eecebb66 (patch) | |
tree | 91f15a309ab41e17919927f35eca31b6ee90cde6 | |
parent | 9e1a007dbf407fe2b5b22c6416a08a5b7656369a (diff) | |
download | FreeBSD-src-54b72818fb6a387f752eaac619145951eecebb66.zip FreeBSD-src-54b72818fb6a387f752eaac619145951eecebb66.tar.gz |
o Typo in prior version kept it from compiling (blush).
Noticed by: Nobody!
o Add comment about why we restrict chflags to root for devices.
o nit noticed by bde wrt return values.
-rw-r--r-- | sys/kern/vfs_extattr.c | 15 | ||||
-rw-r--r-- | sys/kern/vfs_syscalls.c | 15 |
2 files changed, 18 insertions, 12 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index cf096f1..3617bfd 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.126 1999/08/02 21:34:46 imp Exp $ + * $Id: vfs_syscalls.c,v 1.127 1999/08/03 17:07:04 imp Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -1893,11 +1893,14 @@ setfflags(p, vp, flags) struct vattr vattr; /* - * Don't allow setting of flags on devices for non-root users. + * Prevent non-root users from setting flags on devices. When + * a device is reused, users can retain ownership of the device + * if they are allowed to set flags and programs assume that + * chown can't fail when done as root. */ - if ((vp->va_type == VCHR || vp->va_type == VBLK) && - (error = suser_xxx(p->ucred, p, PRISON_ROOT))) - return error; + if ((vp->v_type == VCHR || vp->v_type == VBLK) && + ((error = suser_xxx(p->p_ucred, p, PRISON_ROOT)) != 0)) + return (error); VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); @@ -1905,7 +1908,7 @@ setfflags(p, vp, flags) vattr.va_flags = flags; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return error; + return (error); } /* diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index cf096f1..3617bfd 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_syscalls.c 8.13 (Berkeley) 4/15/94 - * $Id: vfs_syscalls.c,v 1.126 1999/08/02 21:34:46 imp Exp $ + * $Id: vfs_syscalls.c,v 1.127 1999/08/03 17:07:04 imp Exp $ */ /* For 4.3 integer FS ID compatibility */ @@ -1893,11 +1893,14 @@ setfflags(p, vp, flags) struct vattr vattr; /* - * Don't allow setting of flags on devices for non-root users. + * Prevent non-root users from setting flags on devices. When + * a device is reused, users can retain ownership of the device + * if they are allowed to set flags and programs assume that + * chown can't fail when done as root. */ - if ((vp->va_type == VCHR || vp->va_type == VBLK) && - (error = suser_xxx(p->ucred, p, PRISON_ROOT))) - return error; + if ((vp->v_type == VCHR || vp->v_type == VBLK) && + ((error = suser_xxx(p->p_ucred, p, PRISON_ROOT)) != 0)) + return (error); VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); @@ -1905,7 +1908,7 @@ setfflags(p, vp, flags) vattr.va_flags = flags; error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); VOP_UNLOCK(vp, 0, p); - return error; + return (error); } /* |