Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 Jul 2011 01:58:09 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r223775 - stable/8/sys/fs/nfsserver
Message-ID:  <201107050158.p651w9K1043180@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Jul  5 01:58:09 2011
New Revision: 223775
URL: http://svn.freebsd.org/changeset/base/223775

Log:
  MFC: r223373
  Fix the new NFSv4 server so that it checks for VREAD_ACL when
  a client does a Getattr for an ACL and not VREAD_ATTRIBUTES.
  This was found during the recent NFSv4 interoperability Bakeathon.

Modified:
  stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c
==============================================================================
--- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Mon Jul  4 23:32:09 2011	(r223774)
+++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c	Tue Jul  5 01:58:09 2011	(r223775)
@@ -172,11 +172,12 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 	fhandle_t fh;
 	int at_root = 0, error = 0, supports_nfsv4acls;
 	struct nfsreferral *refp;
-	nfsattrbit_t attrbits;
+	nfsattrbit_t attrbits, tmpbits;
 	struct mount *mp;
 	struct vnode *tvp = NULL;
 	struct vattr va;
 	uint64_t mounted_on_fileno = 0;
+	accmode_t accmode;
 
 	if (nd->nd_repstat)
 		return (0);
@@ -197,11 +198,20 @@ nfsrvd_getattr(struct nfsrv_descript *nd
 			vput(vp);
 			return (0);
 		}
-		if (!nd->nd_repstat)
-			nd->nd_repstat = nfsvno_accchk(vp,
-			    VREAD_ATTRIBUTES,
-			    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
-			    NFSACCCHK_VPISLOCKED, NULL);
+		if (nd->nd_repstat == 0) {
+			accmode = 0;
+			NFSSET_ATTRBIT(&tmpbits, &attrbits);
+			if (NFSISSET_ATTRBIT(&tmpbits, NFSATTRBIT_ACL)) {
+				NFSCLRBIT_ATTRBIT(&tmpbits, NFSATTRBIT_ACL);
+				accmode |= VREAD_ACL;
+			}
+			if (NFSNONZERO_ATTRBIT(&tmpbits))
+				accmode |= VREAD_ATTRIBUTES;
+			if (accmode != 0)
+				nd->nd_repstat = nfsvno_accchk(vp, accmode,
+				    nd->nd_cred, exp, p, NFSACCCHK_NOOVERRIDE,
+				    NFSACCCHK_VPISLOCKED, NULL);
+		}
 	}
 	if (!nd->nd_repstat)
 		nd->nd_repstat = nfsvno_getattr(vp, &nva, nd->nd_cred, p, 1);



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