summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2011-06-22 19:47:45 +0000
committerrmacklem <rmacklem@FreeBSD.org>2011-06-22 19:47:45 +0000
commit0a8537fb6af36d227389d693dc514cbd503ba043 (patch)
tree40a765aec8ceda5d7166eed71176d78b612cb53c
parent4bd1849e7f983e321378d18d4bad3f0b4660590a (diff)
downloadFreeBSD-src-0a8537fb6af36d227389d693dc514cbd503ba043.zip
FreeBSD-src-0a8537fb6af36d227389d693dc514cbd503ba043.tar.gz
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
-rw-r--r--sys/fs/nfs/nfs_commonkrpc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index df23e49..c34ea87 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -526,6 +526,20 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
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) {
OpenPOWER on IntegriCloud