Commit 400f26b5 authored by Simo Sorce's avatar Simo Sorce Committed by J. Bruce Fields

SUNRPC: conditionally return endtime from import_sec_context

We expose this parameter for a future caller.
It will be used to extract the endtime from the gss-proxy upcall mechanism,
in order to set the rsc cache expiration time.
Signed-off-by: default avatarSimo Sorce <simo@redhat.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent 33d90ac0
...@@ -37,6 +37,7 @@ int gss_import_sec_context( ...@@ -37,6 +37,7 @@ int gss_import_sec_context(
size_t bufsize, size_t bufsize,
struct gss_api_mech *mech, struct gss_api_mech *mech,
struct gss_ctx **ctx_id, struct gss_ctx **ctx_id,
time_t *endtime,
gfp_t gfp_mask); gfp_t gfp_mask);
u32 gss_get_mic( u32 gss_get_mic(
struct gss_ctx *ctx_id, struct gss_ctx *ctx_id,
...@@ -92,6 +93,7 @@ struct gss_api_ops { ...@@ -92,6 +93,7 @@ struct gss_api_ops {
const void *input_token, const void *input_token,
size_t bufsize, size_t bufsize,
struct gss_ctx *ctx_id, struct gss_ctx *ctx_id,
time_t *endtime,
gfp_t gfp_mask); gfp_t gfp_mask);
u32 (*gss_get_mic)( u32 (*gss_get_mic)(
struct gss_ctx *ctx_id, struct gss_ctx *ctx_id,
......
...@@ -238,7 +238,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct ...@@ -238,7 +238,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
p = ERR_PTR(-EFAULT); p = ERR_PTR(-EFAULT);
goto err; goto err;
} }
ret = gss_import_sec_context(p, seclen, gm, &ctx->gc_gss_ctx, GFP_NOFS); ret = gss_import_sec_context(p, seclen, gm, &ctx->gc_gss_ctx, NULL, GFP_NOFS);
if (ret < 0) { if (ret < 0) {
p = ERR_PTR(ret); p = ERR_PTR(ret);
goto err; goto err;
......
...@@ -679,6 +679,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx, ...@@ -679,6 +679,7 @@ gss_import_v2_context(const void *p, const void *end, struct krb5_ctx *ctx,
static int static int
gss_import_sec_context_kerberos(const void *p, size_t len, gss_import_sec_context_kerberos(const void *p, size_t len,
struct gss_ctx *ctx_id, struct gss_ctx *ctx_id,
time_t *endtime,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
const void *end = (const void *)((const char *)p + len); const void *end = (const void *)((const char *)p + len);
...@@ -694,9 +695,11 @@ gss_import_sec_context_kerberos(const void *p, size_t len, ...@@ -694,9 +695,11 @@ gss_import_sec_context_kerberos(const void *p, size_t len,
else else
ret = gss_import_v2_context(p, end, ctx, gfp_mask); ret = gss_import_v2_context(p, end, ctx, gfp_mask);
if (ret == 0) if (ret == 0) {
ctx_id->internal_ctx_id = ctx; ctx_id->internal_ctx_id = ctx;
else if (endtime)
*endtime = ctx->endtime;
} else
kfree(ctx); kfree(ctx);
dprintk("RPC: %s: returning %d\n", __func__, ret); dprintk("RPC: %s: returning %d\n", __func__, ret);
......
...@@ -325,14 +325,15 @@ int ...@@ -325,14 +325,15 @@ int
gss_import_sec_context(const void *input_token, size_t bufsize, gss_import_sec_context(const void *input_token, size_t bufsize,
struct gss_api_mech *mech, struct gss_api_mech *mech,
struct gss_ctx **ctx_id, struct gss_ctx **ctx_id,
time_t *endtime,
gfp_t gfp_mask) gfp_t gfp_mask)
{ {
if (!(*ctx_id = kzalloc(sizeof(**ctx_id), gfp_mask))) if (!(*ctx_id = kzalloc(sizeof(**ctx_id), gfp_mask)))
return -ENOMEM; return -ENOMEM;
(*ctx_id)->mech_type = gss_mech_get(mech); (*ctx_id)->mech_type = gss_mech_get(mech);
return mech->gm_ops return mech->gm_ops->gss_import_sec_context(input_token, bufsize,
->gss_import_sec_context(input_token, bufsize, *ctx_id, gfp_mask); *ctx_id, endtime, gfp_mask);
} }
/* gss_get_mic: compute a mic over message and return mic_token. */ /* gss_get_mic: compute a mic over message and return mic_token. */
......
...@@ -497,7 +497,8 @@ static int rsc_parse(struct cache_detail *cd, ...@@ -497,7 +497,8 @@ static int rsc_parse(struct cache_detail *cd,
len = qword_get(&mesg, buf, mlen); len = qword_get(&mesg, buf, mlen);
if (len < 0) if (len < 0)
goto out; goto out;
status = gss_import_sec_context(buf, len, gm, &rsci.mechctx, GFP_KERNEL); status = gss_import_sec_context(buf, len, gm, &rsci.mechctx,
NULL, GFP_KERNEL);
if (status) if (status)
goto out; goto out;
......
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