diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-12-11 03:16:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-12-11 03:16:35 +0000 |
commit | 58a4d7ed2739686c242e647e74e4949f97b3c005 (patch) | |
tree | ed31b1300078e0691c8b5260e76ec63bdf58dd21 | |
parent | 63a7bcbff2f66cf45657f39ad0bb9bba1fd57b5f (diff) |
do not clear setuid/setgid for *chmod(-1,-1); pointed out by provos
-rw-r--r-- | sys/kern/vfs_syscalls.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 64243fe3bcf..f02a8855628 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfs_syscalls.c,v 1.34 1997/12/09 09:34:36 deraadt Exp $ */ +/* $OpenBSD: vfs_syscalls.c,v 1.35 1997/12/11 03:16:34 deraadt Exp $ */ /* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */ /* @@ -1645,8 +1645,8 @@ sys_chown(p, v, retval) if (vp->v_mount->mnt_flag & MNT_RDONLY) error = EROFS; else { - if (suser(p->p_ucred, &p->p_acflag) || - suid_clear) { + if ((SCARG(uap, uid) != -1 || SCARG(uap, gid) != -1) && + (suser(p->p_ucred, &p->p_acflag) || suid_clear)) { error = VOP_GETATTR(vp, &vattr, p->p_ucred, p); if (error) goto out; @@ -1697,8 +1697,8 @@ sys_lchown(p, v, retval) if (vp->v_mount->mnt_flag & MNT_RDONLY) error = EROFS; else { - if (suser(p->p_ucred, &p->p_acflag) || - suid_clear) { + if ((SCARG(uap, uid) != -1 || SCARG(uap, gid) != -1) && + (suser(p->p_ucred, &p->p_acflag) || suid_clear)) { error = VOP_GETATTR(vp, &vattr, p->p_ucred, p); if (error) goto out; @@ -1748,8 +1748,8 @@ sys_fchown(p, v, retval) if (vp->v_mount->mnt_flag & MNT_RDONLY) error = EROFS; else { - if (suser(p->p_ucred, &p->p_acflag) || - suid_clear) { + if ((SCARG(uap, uid) != -1 || SCARG(uap, gid) != -1) && + (suser(p->p_ucred, &p->p_acflag) || suid_clear)) { error = VOP_GETATTR(vp, &vattr, p->p_ucred, p); if (error) goto out; |