]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] kNFSdv4: Set credentials properly when puutrootfh is used
authorAndrew Morton <akpm@osdl.org>
Sat, 17 Apr 2004 10:26:39 +0000 (03:26 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 17 Apr 2004 10:26:39 +0000 (03:26 -0700)
From: NeilBrown <neilb@cse.unsw.edu.au>

The credentials (uid/gid) of a process are set when a filehandle is
verified.  Nfsv4 allows requests without an explicit filehandle (instead,
an implicit 'root' filehandle) so we much make sure the credentials are set
for these requests too.

From: "J. Bruce Fields" <bfields@fieldses.org>

From: Andros: added a call to nfsd_setuser in nfsd4_putrootfh so that nfsd
runs as the rpc->cred user.

fs/nfsd/nfs4proc.c

index 23442b1767d5bf055cc22f451c6b07d3d7239331..7fad51aa8f19c5aa445b7936dc2f34d078bb8717 100644 (file)
@@ -194,9 +194,14 @@ nfsd4_putfh(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_putf
 static inline int
 nfsd4_putrootfh(struct svc_rqst *rqstp, struct svc_fh *current_fh)
 {
+       int status;
+
        fh_put(current_fh);
-       return exp_pseudoroot(rqstp->rq_client, current_fh,
+       status = exp_pseudoroot(rqstp->rq_client, current_fh,
                              &rqstp->rq_chandle);
+       if (!status)
+               status = nfsd_setuser(rqstp, current_fh->fh_export);
+       return status;
 }
 
 static inline int