Fix for kern/46515 (NFSv2 client denies O_APPEND)
Thomas Quinot <[email protected]> Wed, 5 Feb 2003 18:33:43 +0100
| Newsgroups | gmane.os.freebsd.devel.audit |
|---|---|
| Message-ID | <[email protected]> |
Unless anyone objects to it, I would like to commit the enclosed fix for PR 46515. It was submitted by Peter Edwards <[email protected]> and I have been running it here without problems. Thomas. Index: nfs_vnops.c =================================================================== RCS file: /home/ncvs/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 15:32:36 -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)); } /* -- [email protected] To Unsubscribe: send mail to [email protected] with "unsubscribe freebsd-audit" in the body of the message