Commit f36e10e5 authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] kNFSd: Set nfsd user every time a filehandle is verified.

request might traverse several export points which may
have different uid squashing.
parent eaee716b
...@@ -17,9 +17,6 @@ nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) ...@@ -17,9 +17,6 @@ nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
struct svc_cred *cred = &rqstp->rq_cred; struct svc_cred *cred = &rqstp->rq_cred;
int i; int i;
if (rqstp->rq_userset)
return;
if (exp->ex_flags & NFSEXP_ALLSQUASH) { if (exp->ex_flags & NFSEXP_ALLSQUASH) {
cred->cr_uid = exp->ex_anon_uid; cred->cr_uid = exp->ex_anon_uid;
cred->cr_gid = exp->ex_anon_gid; cred->cr_gid = exp->ex_anon_gid;
...@@ -57,5 +54,4 @@ nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp) ...@@ -57,5 +54,4 @@ nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
current->cap_permitted); current->cap_permitted);
} }
rqstp->rq_userset = 1;
} }
...@@ -161,9 +161,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) ...@@ -161,9 +161,6 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
goto out; goto out;
} }
/* Set user creds if we haven't done so already. */
nfsd_setuser(rqstp, exp);
/* /*
* Look up the dentry using the NFS file handle. * Look up the dentry using the NFS file handle.
*/ */
...@@ -223,6 +220,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access) ...@@ -223,6 +220,10 @@ fh_verify(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, int access)
inode = dentry->d_inode; inode = dentry->d_inode;
/* Set user creds for this exportpoint */
nfsd_setuser(rqstp, exp);
/* Type check. The correct error return for type mismatches /* Type check. The correct error return for type mismatches
* does not seem to be generally agreed upon. SunOS seems to * does not seem to be generally agreed upon. SunOS seems to
* use EISDIR if file isn't S_IFREG; a comment in the NFSv3 * use EISDIR if file isn't S_IFREG; a comment in the NFSv3
......
...@@ -125,7 +125,6 @@ struct svc_rqst { ...@@ -125,7 +125,6 @@ struct svc_rqst {
u32 rq_proc; /* procedure number */ u32 rq_proc; /* procedure number */
u32 rq_prot; /* IP protocol */ u32 rq_prot; /* IP protocol */
unsigned short unsigned short
rq_userset : 1, /* auth->setuser OK */
rq_secure : 1; /* secure port */ rq_secure : 1; /* secure port */
......
...@@ -1222,7 +1222,6 @@ svc_recv(struct svc_serv *serv, struct svc_rqst *rqstp, long timeout) ...@@ -1222,7 +1222,6 @@ svc_recv(struct svc_serv *serv, struct svc_rqst *rqstp, long timeout)
} }
rqstp->rq_secure = ntohs(rqstp->rq_addr.sin_port) < 1024; rqstp->rq_secure = ntohs(rqstp->rq_addr.sin_port) < 1024;
rqstp->rq_userset = 0;
rqstp->rq_chandle.defer = svc_defer; rqstp->rq_chandle.defer = svc_defer;
if (serv->sv_stats) if (serv->sv_stats)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment