aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorNeil Brown <neilb@cse.unsw.edu.au>2005-01-04 05:44:30 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-01-04 05:44:30 -0800
commit3c36df6cda645d9cc17364fcaab93642727dd4fc (patch)
tree213a7a1ed263074f2de0e42f057611d516050fd7 /net
parenta900aeb7304d8533fb72bab7099e64e469b5ceda (diff)
downloadhistory-3c36df6cda645d9cc17364fcaab93642727dd4fc.tar.gz
[PATCH] knfsd: svcrpc: auth_null fixes
Fix some discrepencies between the server-side auth_null and auth_unix rpc code: in particular, make sure we return an auth error in the auth_null case instead of dropping when we fail to match an export entry, and make sure such responses are encoded correctly. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/svcauth_unix.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 043eb46c7fba4c..4cfc198a87d846 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -335,9 +335,13 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp)
{
struct kvec *argv = &rqstp->rq_arg.head[0];
struct kvec *resv = &rqstp->rq_res.head[0];
+ struct svc_cred *cred = &rqstp->rq_cred;
int rv=0;
struct ip_map key, *ipm;
+ cred->cr_group_info = NULL;
+ rqstp->rq_client = NULL;
+
if (argv->iov_len < 3*4)
return SVC_GARBAGE;
@@ -353,23 +357,17 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp)
}
/* Signal that mapping to nobody uid/gid is required */
- rqstp->rq_cred.cr_uid = (uid_t) -1;
- rqstp->rq_cred.cr_gid = (gid_t) -1;
- rqstp->rq_cred.cr_group_info = groups_alloc(0);
- if (rqstp->rq_cred.cr_group_info == NULL)
+ cred->cr_uid = (uid_t) -1;
+ cred->cr_gid = (gid_t) -1;
+ cred->cr_group_info = groups_alloc(0);
+ if (cred->cr_group_info == NULL)
return SVC_DROP; /* kmalloc failure - client must retry */
- /* Put NULL verifier */
- svc_putu32(resv, RPC_AUTH_NULL);
- svc_putu32(resv, 0);
-
strcpy(key.m_class, rqstp->rq_server->sv_program->pg_class);
key.m_addr = rqstp->rq_addr.sin_addr;
ipm = ip_map_lookup(&key, 0);
- rqstp->rq_client = NULL;
-
if (ipm)
switch (cache_check(&ip_map_cache, &ipm->h, &rqstp->rq_chandle)) {
case -EAGAIN:
@@ -388,10 +386,18 @@ svcauth_null_accept(struct svc_rqst *rqstp, u32 *authp)
}
else rv = SVC_DROP;
- if (rqstp->rq_client == NULL && rqstp->rq_proc != 0)
- *authp = rpc_autherr_badcred;
+ if (rv == SVC_OK && rqstp->rq_client == NULL && rqstp->rq_proc != 0)
+ goto badcred;
+
+ /* Put NULL verifier */
+ svc_putu32(resv, RPC_AUTH_NULL);
+ svc_putu32(resv, 0);
return rv;
+
+badcred:
+ *authp = rpc_autherr_badcred;
+ return SVC_DENIED;
}
static int