diff options
Diffstat (limited to 'sys/ntfs/ntfs_vnops.c')
-rw-r--r-- | sys/ntfs/ntfs_vnops.c | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/sys/ntfs/ntfs_vnops.c b/sys/ntfs/ntfs_vnops.c index e3db31f8d3ab..06dab1c50c27 100644 --- a/sys/ntfs/ntfs_vnops.c +++ b/sys/ntfs/ntfs_vnops.c @@ -450,10 +450,7 @@ ntfs_access(ap) { struct vnode *vp = ap->a_vp; struct ntnode *ip = VTONT(vp); - struct ucred *cred = ap->a_cred; - mode_t mask, mode = ap->a_mode; - register gid_t *gp; - int i; + mode_t mode = ap->a_mode; #ifdef QUOTA int error; #endif @@ -480,44 +477,9 @@ ntfs_access(ap) } } - /* Otherwise, user id 0 always gets access. */ - if (cred->cr_uid == 0) - return (0); - - mask = 0; - - /* Otherwise, check the owner. */ - if (cred->cr_uid == ip->i_mp->ntm_uid) { - if (mode & VEXEC) - mask |= S_IXUSR; - if (mode & VREAD) - mask |= S_IRUSR; - if (mode & VWRITE) - mask |= S_IWUSR; - return ((ip->i_mp->ntm_mode & mask) == mask ? 0 : EACCES); - } - - /* Otherwise, check the groups. */ - for (i = 0, gp = cred->cr_groups; i < cred->cr_ngroups; i++, gp++) - if (ip->i_mp->ntm_gid == *gp) { - if (mode & VEXEC) - mask |= S_IXGRP; - if (mode & VREAD) - mask |= S_IRGRP; - if (mode & VWRITE) - mask |= S_IWGRP; - return ((ip->i_mp->ntm_mode&mask) == mask ? 0 : EACCES); - } - - /* Otherwise, check everyone else. */ - if (mode & VEXEC) - mask |= S_IXOTH; - if (mode & VREAD) - mask |= S_IROTH; - if (mode & VWRITE) - mask |= S_IWOTH; - return ((ip->i_mp->ntm_mode & mask) == mask ? 0 : EACCES); -} + return (vaccess(vp->v_type, ip->i_mp->ntm_mode, ip->i_mp->ntm_uid, + ip->i_mp->ntm_gid, ap->a_mode, ap->a_cred)); +} /* * Open called. |