summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorthomas <thomas@FreeBSD.org>2003-03-31 23:26:10 +0000
committerthomas <thomas@FreeBSD.org>2003-03-31 23:26:10 +0000
commit7e134f95f3b31d917bf5acfa4e8b81684ddd1076 (patch)
tree5d4388e667e1551804811c4122419bde583b6165 /sys/nfsclient
parentfb111f29cdbc25132526c39b1b4c188c25818242 (diff)
downloadFreeBSD-src-7e134f95f3b31d917bf5acfa4e8b81684ddd1076.zip
FreeBSD-src-7e134f95f3b31d917bf5acfa4e8b81684ddd1076.tar.gz
Revert change 1.201 (removing mapping of VAPPEND to VWRITE).
Instead, use the generic vaccess() operation to determine whether an operation is permitted. This avoids embedding knowledge on vnode permission bits such as VAPPEND in the NFS client. PR: kern/46515 vaccess() patch submitted by: "Peter Edwards" <pmedwards@eircom.net> Approved by: tjr, roberto (mentor)
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_vnops.c34
1 files changed, 2 insertions, 32 deletions
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index af19819..5a2f6ad 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -2975,22 +2975,13 @@ static int
nfsspec_access(struct vop_access_args *ap)
{
struct vattr *vap;
- gid_t *gp;
struct ucred *cred = ap->a_cred;
struct vnode *vp = ap->a_vp;
mode_t mode = ap->a_mode;
struct vattr vattr;
- int i;
int error;
/*
- * Map VAPPEND to VWRITE; NFSv2 does not understand the concept
- * of append-only files. XXX What about VADMIN and VSTAT?
- */
- if (mode & VAPPEND)
- mode = (mode & ~VAPPEND) | VWRITE;
-
- /*
* Disallow write attempts on filesystems mounted read-only;
* unless the file is a socket, fifo, or a block or character
* device resident on the filesystem.
@@ -3005,33 +2996,12 @@ nfsspec_access(struct vop_access_args *ap)
break;
}
}
- /*
- * If you're the super-user,
- * you always get access.
- */
- if (cred->cr_uid == 0)
- return (0);
vap = &vattr;
error = VOP_GETATTR(vp, vap, cred, ap->a_td);
if (error)
return (error);
- /*
- * Access check is based on only one of owner, group, public.
- * If not owner, then check group. If not a member of the
- * group, then check public access.
- */
- if (cred->cr_uid != vap->va_uid) {
- mode >>= 3;
- gp = cred->cr_groups;
- for (i = 0; i < cred->cr_ngroups; i++, gp++)
- if (vap->va_gid == *gp)
- goto found;
- mode >>= 3;
-found:
- ;
- }
- error = (vap->va_mode & mode) == mode ? 0 : EACCES;
- return (error);
+ return (vaccess(vp->v_type, vap->va_mode, vap->va_uid, vap->va_gid,
+ mode, cred, NULL));
}
/*
OpenPOWER on IntegriCloud