diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index 12803da95dc4..e9baa6ebb1dd 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c | |||
| @@ -332,6 +332,7 @@ struct rsc { | |||
| 332 | struct svc_cred cred; | 332 | struct svc_cred cred; |
| 333 | struct gss_svc_seq_data seqdata; | 333 | struct gss_svc_seq_data seqdata; |
| 334 | struct gss_ctx *mechctx; | 334 | struct gss_ctx *mechctx; |
| 335 | char *client_name; | ||
| 335 | }; | 336 | }; |
| 336 | 337 | ||
| 337 | static struct cache_head *rsc_table[RSC_HASHMAX]; | 338 | static struct cache_head *rsc_table[RSC_HASHMAX]; |
| @@ -346,6 +347,7 @@ static void rsc_free(struct rsc *rsci) | |||
| 346 | gss_delete_sec_context(&rsci->mechctx); | 347 | gss_delete_sec_context(&rsci->mechctx); |
| 347 | if (rsci->cred.cr_group_info) | 348 | if (rsci->cred.cr_group_info) |
| 348 | put_group_info(rsci->cred.cr_group_info); | 349 | put_group_info(rsci->cred.cr_group_info); |
| 350 | kfree(rsci->client_name); | ||
| 349 | } | 351 | } |
| 350 | 352 | ||
| 351 | static void rsc_put(struct kref *ref) | 353 | static void rsc_put(struct kref *ref) |
| @@ -383,6 +385,7 @@ rsc_init(struct cache_head *cnew, struct cache_head *ctmp) | |||
| 383 | tmp->handle.data = NULL; | 385 | tmp->handle.data = NULL; |
| 384 | new->mechctx = NULL; | 386 | new->mechctx = NULL; |
| 385 | new->cred.cr_group_info = NULL; | 387 | new->cred.cr_group_info = NULL; |
| 388 | new->client_name = NULL; | ||
| 386 | } | 389 | } |
| 387 | 390 | ||
| 388 | static void | 391 | static void |
| @@ -397,6 +400,8 @@ update_rsc(struct cache_head *cnew, struct cache_head *ctmp) | |||
| 397 | spin_lock_init(&new->seqdata.sd_lock); | 400 | spin_lock_init(&new->seqdata.sd_lock); |
| 398 | new->cred = tmp->cred; | 401 | new->cred = tmp->cred; |
| 399 | tmp->cred.cr_group_info = NULL; | 402 | tmp->cred.cr_group_info = NULL; |
| 403 | new->client_name = tmp->client_name; | ||
| 404 | tmp->client_name = NULL; | ||
| 400 | } | 405 | } |
| 401 | 406 | ||
| 402 | static struct cache_head * | 407 | static struct cache_head * |
| @@ -486,6 +491,15 @@ static int rsc_parse(struct cache_detail *cd, | |||
| 486 | status = gss_import_sec_context(buf, len, gm, &rsci.mechctx); | 491 | status = gss_import_sec_context(buf, len, gm, &rsci.mechctx); |
| 487 | if (status) | 492 | if (status) |
| 488 | goto out; | 493 | goto out; |
| 494 | |||
| 495 | /* get client name */ | ||
| 496 | len = qword_get(&mesg, buf, mlen); | ||
| 497 | if (len > 0) { | ||
| 498 | rsci.client_name = kstrdup(buf, GFP_KERNEL); | ||
| 499 | if (!rsci.client_name) | ||
| 500 | goto out; | ||
| 501 | } | ||
| 502 | |||
| 489 | } | 503 | } |
| 490 | rsci.h.expiry_time = expiry; | 504 | rsci.h.expiry_time = expiry; |
| 491 | rscp = rsc_update(&rsci, rscp); | 505 | rscp = rsc_update(&rsci, rscp); |
| @@ -913,6 +927,15 @@ struct gss_svc_data { | |||
| 913 | struct rsc *rsci; | 927 | struct rsc *rsci; |
| 914 | }; | 928 | }; |
| 915 | 929 | ||
| 930 | char *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 | } | ||
| 938 | |||
| 916 | static int | 939 | static int |
| 917 | svcauth_gss_set_client(struct svc_rqst *rqstp) | 940 | svcauth_gss_set_client(struct svc_rqst *rqstp) |
| 918 | { | 941 | { |
