From owner-svn-src-all@FreeBSD.ORG Sat May 3 00:19:10 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0CC6E720; Sat, 3 May 2014 00:19:10 +0000 (UTC) Received: from esa-jnhn.mail.uoguelph.ca (esa-jnhn.mail.uoguelph.ca [131.104.91.44]) by mx1.freebsd.org (Postfix) with ESMTP id 8FEAB1B78; Sat, 3 May 2014 00:19:09 +0000 (UTC) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmUGADcSY1ODaFve/2dsb2JhbABag1VMC4JnwXOBKXSCJQEBBAEjBFIFFg4GBAICDRkCIzYGE4gtAwkIDaYGnSkNhkUXgSqLEYFjATMHgm+BSgSXPYMui1iFW4NPIYFu X-IronPort-AV: E=Sophos;i="4.97,975,1389762000"; d="scan'208";a="120090152" Received: from muskoka.cs.uoguelph.ca (HELO zcs3.mail.uoguelph.ca) ([131.104.91.222]) by esa-jnhn.mail.uoguelph.ca with ESMTP; 02 May 2014 20:19:08 -0400 Received: from zcs3.mail.uoguelph.ca (localhost.localdomain [127.0.0.1]) by zcs3.mail.uoguelph.ca (Postfix) with ESMTP id D748FB4032; Fri, 2 May 2014 20:19:07 -0400 (EDT) Date: Fri, 2 May 2014 20:19:07 -0400 (EDT) From: Rick Macklem To: Rick Macklem Message-ID: <1749211976.1376200.1399076347872.JavaMail.root@uoguelph.ca> In-Reply-To: <201405030013.s430DjDp034424@svn.freebsd.org> Subject: Re: svn commit: r265252 - in head/sys/fs: nfs nfsserver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [172.17.91.203] X-Mailer: Zimbra 7.2.1_GA_2790 (ZimbraWebClient - FF3.0 (Win)/7.2.1_GA_2790) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 May 2014 00:19:10 -0000 I wrote: > Author: rmacklem > Date: Sat May 3 00:13:45 2014 > New Revision: 265252 > URL: http://svnweb.freebsd.org/changeset/base/265252 > > Log: > The new draft specification for NFSv4.0 specifies that a server > should either accept owner and owner_group strings that are just > the digits of the uid/gid or return NFS4ERR_BADOWNER. > This patch adds a sysctl vfs.nfsd.enable_stringtouid, which can > be set to enable the server w.r.t. accepting numeric string. It > also ensures that NFS4ERR_BADOWNER is returned if numeric uid/gid > strings are not enabled. This fixes the server for recent Linux > nfs4 clients that use numeric uid/gid strings by default. > > Reported and tested by: craigyk@gmail.com > MFC after: 2 weeks > Oops, I meant to MFC in 1 week, since I'd like to get this in 9.3. rick > Modified: > head/sys/fs/nfs/nfs_commonsubs.c > head/sys/fs/nfsserver/nfs_nfsdport.c > > Modified: head/sys/fs/nfs/nfs_commonsubs.c > ============================================================================== > --- head/sys/fs/nfs/nfs_commonsubs.c Fri May 2 23:47:14 2014 > (r265251) > +++ head/sys/fs/nfs/nfs_commonsubs.c Sat May 3 00:13:45 2014 > (r265252) > @@ -65,6 +65,7 @@ uid_t nfsrv_defaultuid; > gid_t nfsrv_defaultgid; > int nfsrv_lease = NFSRV_LEASE; > int ncl_mbuf_mlen = MLEN; > +int nfsd_enable_stringtouid = 0; > NFSNAMEIDMUTEX; > NFSSOCKMUTEX; > > @@ -2640,9 +2641,14 @@ nfsv4_strtouid(struct nfsrv_descript *nd > /* If a string of digits and an AUTH_SYS mount, just convert it. */ > str0 = str; > tuid = (uid_t)strtoul(str0, &endstr, 10); > - if ((endstr - str0) == len && > - (nd->nd_flag & (ND_KERBV | ND_NFSCL)) == ND_NFSCL) { > - *uidp = tuid; > + if ((endstr - str0) == len) { > + /* A numeric string. */ > + if ((nd->nd_flag & ND_KERBV) == 0 && > + ((nd->nd_flag & ND_NFSCL) != 0 || > + nfsd_enable_stringtouid != 0)) > + *uidp = tuid; > + else > + error = NFSERR_BADOWNER; > goto out; > } > /* > @@ -2845,9 +2851,14 @@ nfsv4_strtogid(struct nfsrv_descript *nd > /* If a string of digits and an AUTH_SYS mount, just convert it. */ > str0 = str; > tgid = (gid_t)strtoul(str0, &endstr, 10); > - if ((endstr - str0) == len && > - (nd->nd_flag & (ND_KERBV | ND_NFSCL)) == ND_NFSCL) { > - *gidp = tgid; > + if ((endstr - str0) == len) { > + /* A numeric string. */ > + if ((nd->nd_flag & ND_KERBV) == 0 && > + ((nd->nd_flag & ND_NFSCL) != 0 || > + nfsd_enable_stringtouid != 0)) > + *gidp = tgid; > + else > + error = NFSERR_BADOWNER; > goto out; > } > /* > > Modified: head/sys/fs/nfsserver/nfs_nfsdport.c > ============================================================================== > --- head/sys/fs/nfsserver/nfs_nfsdport.c Fri May 2 23:47:14 2014 > (r265251) > +++ head/sys/fs/nfsserver/nfs_nfsdport.c Sat May 3 00:13:45 2014 > (r265252) > @@ -80,6 +80,7 @@ static int nfs_commit_blks; > static int nfs_commit_miss; > extern int nfsrv_issuedelegs; > extern int nfsrv_dolocallocks; > +extern int nfsd_enable_stringtouid; > > SYSCTL_NODE(_vfs, OID_AUTO, nfsd, CTLFLAG_RW, 0, "New NFS server"); > SYSCTL_INT(_vfs_nfsd, OID_AUTO, mirrormnt, CTLFLAG_RW, > @@ -92,6 +93,8 @@ SYSCTL_INT(_vfs_nfsd, OID_AUTO, issue_de > &nfsrv_issuedelegs, 0, "Enable nfsd to issue delegations"); > SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_locallocks, CTLFLAG_RW, > &nfsrv_dolocallocks, 0, "Enable nfsd to acquire local locks on > files"); > +SYSCTL_INT(_vfs_nfsd, OID_AUTO, enable_stringtouid, CTLFLAG_RW, > + &nfsd_enable_stringtouid, 0, "Enable nfsd to accept numeric > owner_names"); > > #define MAX_REORDERED_RPC 16 > #define NUM_HEURISTIC 1031 > >