diff options
author | tjr <tjr@FreeBSD.org> | 2003-02-03 09:04:34 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2003-02-03 09:04:34 +0000 |
commit | 60ef21c1516e2808e15443c41cd66ec3ee0d51c9 (patch) | |
tree | ae7c7e95fc4d80312aa125b671960919630ba54c /sys/fs/smbfs | |
parent | d15a58ad27d11b23a1e08df0bb819607656deaa9 (diff) | |
download | FreeBSD-src-60ef21c1516e2808e15443c41cd66ec3ee0d51c9.zip FreeBSD-src-60ef21c1516e2808e15443c41cd66ec3ee0d51c9.tar.gz |
Use vaccess() instead of rolling our own access checks. This fixes a bug
where requests to open a file in append mode were always denied, and
will also be useful when capabilities and auditing are implemented.
Diffstat (limited to 'sys/fs/smbfs')
-rw-r--r-- | sys/fs/smbfs/smbfs_vnops.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index 23586ad..744a7d4 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -139,10 +139,9 @@ smbfs_access(ap) } */ *ap; { struct vnode *vp = ap->a_vp; - struct ucred *cred = ap->a_cred; - u_int mode = ap->a_mode; + mode_t mode = ap->a_mode; + mode_t mpmode; struct smbmount *smp = VTOSMBFS(vp); - int error = 0; SMBVDEBUG("\n"); if ((mode & VWRITE) && (vp->v_mount->mnt_flag & MNT_RDONLY)) { @@ -153,15 +152,10 @@ smbfs_access(ap) break; } } - if (cred->cr_uid == 0) - return 0; - if (cred->cr_uid != smp->sm_args.uid) { - mode >>= 3; - if (!groupmember(smp->sm_args.gid, cred)) - mode >>= 3; - } - error = (((vp->v_type == VREG) ? smp->sm_args.file_mode : smp->sm_args.dir_mode) & mode) == mode ? 0 : EACCES; - return error; + mpmode = vp->v_type == VREG ? smp->sm_args.file_mode : + smp->sm_args.dir_mode; + return (vaccess(vp->v_type, mpmode, smp->sm_args.uid, + smp->sm_args.gid, ap->a_mode, ap->a_cred, NULL)); } /* ARGSUSED */ |