Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 5 Feb 2003 18:33:43 +0100
From:      Thomas Quinot <thomas@freebsd.org>
To:        freebsd-audit@freebsd.org, roberto@freebsd.org
Subject:   Fix for kern/46515 (NFSv2 client denies O_APPEND)
Message-ID:  <20030205173343.GA24808@melusine.cuivre.fr.eu.org>

next in thread | raw e-mail | index | archive | help

Unless anyone objects to it, I would like to commit the enclosed
fix for PR 46515. It was submitted by Peter Edwards
<pmedwards@eircom.net> 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));
 }
 
 /*
-- 
    Thomas.Quinot@Cuivre.FR.EU.ORG

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030205173343.GA24808>