aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-05-14 19:55:22 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-05-31 20:29:55 -0400
commit03a4e1f6ddf25f48848e1bddcffc0ad489648331 (patch)
treef140e3deb767d092eca997037ebb7b098d8afce9 /net/sunrpc
parent631fc9ea05c97e5d1d14ea58a7347be4857d09da (diff)
nfsd4: move principal name into svc_cred
Instead of keeping the principal name associated with a request in a structure that's private to auth_gss and using an accessor function, move it to svc_cred. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c25
-rw-r--r--net/sunrpc/svcauth_unix.c2
2 files changed, 8 insertions, 19 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index f0a0cd4470b7..d091d7d09bea 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -335,7 +335,6 @@ struct rsc {
335 struct svc_cred cred; 335 struct svc_cred cred;
336 struct gss_svc_seq_data seqdata; 336 struct gss_svc_seq_data seqdata;
337 struct gss_ctx *mechctx; 337 struct gss_ctx *mechctx;
338 char *client_name;
339}; 338};
340 339
341static struct rsc *rsc_update(struct cache_detail *cd, struct rsc *new, struct rsc *old); 340static struct rsc *rsc_update(struct cache_detail *cd, struct rsc *new, struct rsc *old);
@@ -346,9 +345,7 @@ static void rsc_free(struct rsc *rsci)
346 kfree(rsci->handle.data); 345 kfree(rsci->handle.data);
347 if (rsci->mechctx) 346 if (rsci->mechctx)
348 gss_delete_sec_context(&rsci->mechctx); 347 gss_delete_sec_context(&rsci->mechctx);
349 if (rsci->cred.cr_group_info) 348 free_svc_cred(&rsci->cred);
350 put_group_info(rsci->cred.cr_group_info);
351 kfree(rsci->client_name);
352} 349}
353 350
354static void rsc_put(struct kref *ref) 351static void rsc_put(struct kref *ref)
@@ -386,7 +383,7 @@ rsc_init(struct cache_head *cnew, struct cache_head *ctmp)
386 tmp->handle.data = NULL; 383 tmp->handle.data = NULL;
387 new->mechctx = NULL; 384 new->mechctx = NULL;
388 new->cred.cr_group_info = NULL; 385 new->cred.cr_group_info = NULL;
389 new->client_name = NULL; 386 new->cred.cr_principal = NULL;
390} 387}
391 388
392static void 389static void
@@ -401,8 +398,8 @@ update_rsc(struct cache_head *cnew, struct cache_head *ctmp)
401 spin_lock_init(&new->seqdata.sd_lock); 398 spin_lock_init(&new->seqdata.sd_lock);
402 new->cred = tmp->cred; 399 new->cred = tmp->cred;
403 tmp->cred.cr_group_info = NULL; 400 tmp->cred.cr_group_info = NULL;
404 new->client_name = tmp->client_name; 401 new->cred.cr_principal = tmp->cred.cr_principal;
405 tmp->client_name = NULL; 402 tmp->cred.cr_principal = NULL;
406} 403}
407 404
408static struct cache_head * 405static struct cache_head *
@@ -496,8 +493,8 @@ static int rsc_parse(struct cache_detail *cd,
496 /* get client name */ 493 /* get client name */
497 len = qword_get(&mesg, buf, mlen); 494 len = qword_get(&mesg, buf, mlen);
498 if (len > 0) { 495 if (len > 0) {
499 rsci.client_name = kstrdup(buf, GFP_KERNEL); 496 rsci.cred.cr_principal = kstrdup(buf, GFP_KERNEL);
500 if (!rsci.client_name) 497 if (!rsci.cred.cr_principal)
501 goto out; 498 goto out;
502 } 499 }
503 500
@@ -927,16 +924,6 @@ struct gss_svc_data {
927 struct rsc *rsci; 924 struct rsc *rsci;
928}; 925};
929 926
930char *svc_gss_principal(struct svc_rqst *rqstp)
931{
932 struct gss_svc_data *gd = (struct gss_svc_data *)rqstp->rq_auth_data;
933
934 if (gd && gd->rsci)
935 return gd->rsci->client_name;
936 return NULL;
937}
938EXPORT_SYMBOL_GPL(svc_gss_principal);
939
940static int 927static int
941svcauth_gss_set_client(struct svc_rqst *rqstp) 928svcauth_gss_set_client(struct svc_rqst *rqstp)
942{ 929{
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index 9c3b9f014468..12e4897d0bf3 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -740,6 +740,7 @@ svcauth_null_accept(struct svc_rqst *rqstp, __be32 *authp)
740 struct svc_cred *cred = &rqstp->rq_cred; 740 struct svc_cred *cred = &rqstp->rq_cred;
741 741
742 cred->cr_group_info = NULL; 742 cred->cr_group_info = NULL;
743 cred->cr_principal = NULL;
743 rqstp->rq_client = NULL; 744 rqstp->rq_client = NULL;
744 745
745 if (argv->iov_len < 3*4) 746 if (argv->iov_len < 3*4)
@@ -805,6 +806,7 @@ svcauth_unix_accept(struct svc_rqst *rqstp, __be32 *authp)
805 int len = argv->iov_len; 806 int len = argv->iov_len;
806 807
807 cred->cr_group_info = NULL; 808 cred->cr_group_info = NULL;
809 cred->cr_principal = NULL;
808 rqstp->rq_client = NULL; 810 rqstp->rq_client = NULL;
809 811
810 if ((len -= 3*4) < 0) 812 if ((len -= 3*4) < 0)