Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 22 Jun 2011 19:47:45 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r223436 - head/sys/fs/nfs
Message-ID:  <201106221947.p5MJljhJ064175@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Wed Jun 22 19:47:45 2011
New Revision: 223436
URL: http://svn.freebsd.org/changeset/base/223436

Log:
  Fix the new NFSv4 client so that it uses the same uid as
  was used for doing a mount when performing system operations
  on AUTH_SYS mounts.  This resolved an issue when mounting
  a Linux server. Found during testing at the recent
  NFSv4 interoperability Bakeathon.
  
  MFC after:	2 weeks

Modified:
  head/sys/fs/nfs/nfs_commonkrpc.c

Modified: head/sys/fs/nfs/nfs_commonkrpc.c
==============================================================================
--- head/sys/fs/nfs/nfs_commonkrpc.c	Wed Jun 22 19:42:32 2011	(r223435)
+++ head/sys/fs/nfs/nfs_commonkrpc.c	Wed Jun 22 19:47:45 2011	(r223436)
@@ -526,6 +526,20 @@ newnfs_request(struct nfsrv_descript *nd
 		else
 			secflavour = RPCSEC_GSS_KRB5;
 		srv_principal = NFSMNT_SRVKRBNAME(nmp);
+	} else if (nmp != NULL && !NFSHASKERB(nmp) &&
+	    nd->nd_procnum != NFSPROC_NULL &&
+	    (nd->nd_flag & ND_USEGSSNAME) != 0) {
+		/*
+		 * Use the uid that did the mount when the RPC is doing
+		 * NFSv4 system operations, as indicated by the
+		 * ND_USEGSSNAME flag, for the AUTH_SYS case.
+		 */
+		saved_uid = cred->cr_uid;
+		if (nmp->nm_uid != (uid_t)-1)
+			cred->cr_uid = nmp->nm_uid;
+		else
+			cred->cr_uid = 0;
+		set_uid = 1;
 	}
 
 	if (nmp != NULL) {



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