Date: Mon, 30 Dec 2002 07:00:11 -0800 (PST) From: "Peter Edwards" <pmedwards@eircom.net> To: freebsd-bugs@FreeBSD.org Subject: Re: kern/46515: NFSv3 client denies O_APPEND open on existing file Message-ID: <200212301500.gBUF0BZf000582@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/46515; it has been noted by GNATS. From: "Peter Edwards" <pmedwards@eircom.net> To: freebsd-gnats-submit@FreeBSD.org, thomas@freebsd.org Cc: dillon@freebsd.org Subject: Re: kern/46515: NFSv3 client denies O_APPEND open on existing file Date: Mon, 30 Dec 2002 14:58:20 +0000 Hm. It would seem more natural to have the NFS client code just use "vaccess", like other filesystems, thus avoiding having to teach NFS about file access modes it knows nothing about... Index: nfs_vnops.c =================================================================== RCS file: /pub/FreeBSD/development/FreeBSD-CVS/src/sys/nfsclient/nfs_vnops.c,v retrieving revision 1.190 diff -u -r1.190 nfs_vnops.c --- nfs_vnops.c 23 Dec 2002 06:20:41 -0000 1.190 +++ nfs_vnops.c 30 Dec 2002 14:41:17 -0000 @@ -2979,12 +2979,10 @@ 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; /* @@ -3002,33 +3000,12 @@ 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)); } /* -- Peter Edwards. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212301500.gBUF0BZf000582>