update i_uid and i_gid after chown

This commit is contained in:
pooka 2009-10-21 17:37:21 +00:00
parent 6e3add81a1
commit 447898cbb0
3 changed files with 10 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_extern.h,v 1.41 2009/10/19 18:41:17 bouyer Exp $ */ /* $NetBSD: ext2fs_extern.h,v 1.42 2009/10/21 17:37:21 pooka Exp $ */
/*- /*-
* Copyright (c) 1991, 1993, 1994 * Copyright (c) 1991, 1993, 1994
@ -138,6 +138,7 @@ int ext2fs_mountfs(struct vnode *, struct mount *);
int ext2fs_flushfiles(struct mount *, int); int ext2fs_flushfiles(struct mount *, int);
int ext2fs_sbupdate(struct ufsmount *, int); int ext2fs_sbupdate(struct ufsmount *, int);
int ext2fs_cgupdate(struct ufsmount *, int); int ext2fs_cgupdate(struct ufsmount *, int);
void ext2fs_set_inode_guid(struct inode *);
/* ext2fs_readwrite.c */ /* ext2fs_readwrite.c */
int ext2fs_read(void *); int ext2fs_read(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vfsops.c,v 1.151 2009/10/19 18:41:17 bouyer Exp $ */ /* $NetBSD: ext2fs_vfsops.c,v 1.152 2009/10/21 17:37:21 pooka Exp $ */
/* /*
* Copyright (c) 1989, 1991, 1993, 1994 * Copyright (c) 1989, 1991, 1993, 1994
@ -60,7 +60,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.151 2009/10/19 18:41:17 bouyer Exp $"); __KERNEL_RCSID(0, "$NetBSD: ext2fs_vfsops.c,v 1.152 2009/10/21 17:37:21 pooka Exp $");
#if defined(_KERNEL_OPT) #if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h" #include "opt_compat_netbsd.h"
@ -106,7 +106,6 @@ MODULE(MODULE_CLASS_VFS, ext2fs, "ffs");
int ext2fs_sbupdate(struct ufsmount *, int); int ext2fs_sbupdate(struct ufsmount *, int);
static int ext2fs_checksb(struct ext2fs *, int); static int ext2fs_checksb(struct ext2fs *, int);
static void ext2fs_set_inode_guid(struct inode *);
static struct sysctllog *ext2fs_sysctl_log; static struct sysctllog *ext2fs_sysctl_log;
@ -164,7 +163,7 @@ static const struct ufs_ops ext2fs_ufsops = {
}; };
/* Fill in the inode uid/gid from ext2 halves. */ /* Fill in the inode uid/gid from ext2 halves. */
static void void
ext2fs_set_inode_guid(struct inode *ip) ext2fs_set_inode_guid(struct inode *ip)
{ {

View File

@ -1,4 +1,4 @@
/* $NetBSD: ext2fs_vnops.c,v 1.90 2009/10/19 18:41:17 bouyer Exp $ */ /* $NetBSD: ext2fs_vnops.c,v 1.91 2009/10/21 17:37:21 pooka Exp $ */
/* /*
* Copyright (c) 1982, 1986, 1989, 1993 * Copyright (c) 1982, 1986, 1989, 1993
@ -65,7 +65,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.90 2009/10/19 18:41:17 bouyer Exp $"); __KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.91 2009/10/21 17:37:21 pooka Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -502,8 +502,10 @@ ext2fs_chown(struct vnode *vp, uid_t uid, gid_t gid, kauth_cred_t cred,
ip->i_e2fs_gid_high = 0; ip->i_e2fs_gid_high = 0;
ip->i_e2fs_uid_high = 0; ip->i_e2fs_uid_high = 0;
} }
if (ouid != uid || ogid != gid) if (ouid != uid || ogid != gid) {
ext2fs_set_inode_guid(ip);
ip->i_flag |= IN_CHANGE; ip->i_flag |= IN_CHANGE;
}
if (ouid != uid && kauth_authorize_generic(cred, if (ouid != uid && kauth_authorize_generic(cred,
KAUTH_GENERIC_ISSUSER, NULL) != 0) KAUTH_GENERIC_ISSUSER, NULL) != 0)
ip->i_e2fs_mode &= ~ISUID; ip->i_e2fs_mode &= ~ISUID;