diff options
author | tjr <tjr@FreeBSD.org> | 2003-02-27 07:46:01 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-02-27 07:46:01 +0000 |
commit | 6678adc1b5e270b4a7067d8ea10a2c0cb576b78c (patch) | |
tree | 9fd9781bf899bd2995bf113c1581351e0620757a /sys/fs/nwfs/nwfs_vnops.c | |
parent | f0a6146e921dcdf7d9b2a79eb0bd8ce0584f872c (diff) | |
download | FreeBSD-src-6678adc1b5e270b4a7067d8ea10a2c0cb576b78c.zip FreeBSD-src-6678adc1b5e270b4a7067d8ea10a2c0cb576b78c.tar.gz |
Sync nwfs_access() with smbfs_access(): use vaccess() instead of checking
permissions ourself, fixes problem with VAPPEND.
Diffstat (limited to 'sys/fs/nwfs/nwfs_vnops.c')
-rw-r--r-- | sys/fs/nwfs/nwfs_vnops.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index 6e17966..aae9ac0 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -121,7 +121,6 @@ VNODEOP_SET(nwfs_vnodeop_opv_desc); /* * nwfs_access vnode op - * for now just return ok */ static int nwfs_access(ap) @@ -133,10 +132,8 @@ nwfs_access(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - struct ucred *cred = ap->a_cred; - u_int mode = ap->a_mode; + mode_t mpmode; struct nwmount *nmp = VTONWFS(vp); - int error = 0; NCPVNDEBUG("\n"); if ((ap->a_mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) { @@ -147,15 +144,10 @@ nwfs_access(ap) break; } } - if (cred->cr_uid == 0) - return 0; - if (cred->cr_uid != nmp->m.uid) { - mode >>= 3; - if (!groupmember(nmp->m.gid, cred)) - mode >>= 3; - } - error = (((vp->v_type == VREG) ? nmp->m.file_mode : nmp->m.dir_mode) & mode) == mode ? 0 : EACCES; - return error; + mpmode = vp->v_type == VREG ? nmp->m.file_mode : + nmp->m.dir_mode; + return (vaccess(vp->v_type, mpmode, nmp->m.uid, + nmp->m.gid, ap->a_mode, ap->a_cred, NULL)); } /* * nwfs_open vnode op |