diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index 02e1f9eaa69b..e0b1275eac42 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vnops.c,v 1.52 2004/03/22 19:23:08 bouyer Exp $ */ +/* $NetBSD: ext2fs_vnops.c,v 1.53 2004/05/22 23:24:23 kleink Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.52 2004/03/22 19:23:08 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.53 2004/05/22 23:24:23 kleink Exp $"); #include #include @@ -496,7 +496,8 @@ ext2fs_chown(vp, uid, gid, cred, p) * the caller must be superuser or the call fails. */ if ((cred->cr_uid != ip->i_e2fs_uid || uid != ip->i_e2fs_uid || - (gid != ip->i_e2fs_gid && !groupmember((gid_t)gid, cred))) && + (gid != ip->i_e2fs_gid && + !(cred->cr_gid == gid || groupmember((gid_t)gid, cred)))) && (error = suser(cred, &p->p_acflag))) return (error); ogid = ip->i_e2fs_gid; diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 4780741cbbe6..bd9eb97ec832 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.113 2004/01/26 10:39:30 hannken Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.114 2004/05/22 23:24:23 kleink Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993, 1995 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.113 2004/01/26 10:39:30 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.114 2004/05/22 23:24:23 kleink Exp $"); #ifndef _LKM #include "opt_quota.h" @@ -533,7 +533,8 @@ ufs_chown(struct vnode *vp, uid_t uid, gid_t gid, struct ucred *cred, * or the call fails. */ if ((cred->cr_uid != ip->i_uid || uid != ip->i_uid || - (gid != ip->i_gid && !groupmember((gid_t)gid, cred))) && + (gid != ip->i_gid && + !(cred->cr_gid == gid || groupmember((gid_t)gid, cred)))) && ((error = suser(cred, &p->p_acflag)) != 0)) return (error);