Commit d90186e6 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Linus Torvalds

gss_marshal and gss_validate depend on gss_cred_get_ctx never returning NULL;

but gss_refresh depends on gss_cred_get_ctx returning NULL whenever the cred is
not up to date.  So, I replaced the single gss_cred_get_ctx by a
gss_cred_get_ctx and a gss_cred_get_uptodate_ctx.
parent c9c31a36
......@@ -156,7 +156,7 @@ gss_cred_set_ctx(struct rpc_cred *cred, struct gss_cl_ctx *ctx)
}
static struct gss_cl_ctx *
gss_cred_get_ctx(struct rpc_cred *cred)
gss_cred_get_uptodate_ctx(struct rpc_cred *cred)
{
struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base);
struct gss_cl_ctx *ctx = NULL;
......@@ -206,6 +206,19 @@ dup_netobj(struct xdr_netobj *source, struct xdr_netobj *dest)
return 0;
}
static struct gss_cl_ctx *
gss_cred_get_ctx(struct rpc_cred *cred)
{
struct gss_cred *gss_cred = container_of(cred, struct gss_cred, gc_base);
struct gss_cl_ctx *ctx = NULL;
read_lock(&gss_ctx_lock);
if (gss_cred->gc_ctx)
ctx = gss_get_ctx(gss_cred->gc_ctx);
read_unlock(&gss_ctx_lock);
return ctx;
}
static int
gss_parse_init_downcall(struct gss_api_mech *gm, struct xdr_netobj *buf,
struct gss_cl_ctx **gc, uid_t *uid)
......@@ -637,7 +650,7 @@ gss_refresh(struct rpc_task *task)
task->tk_timeout = xprt->timeout.to_current;
spin_lock(&gss_auth->lock);
if (gss_cred_get_ctx(cred))
if (gss_cred_get_uptodate_ctx(cred))
goto out;
err = gss_upcall(clnt, task, cred->cr_uid);
out:
......@@ -648,8 +661,8 @@ gss_refresh(struct rpc_task *task)
static u32 *
gss_validate(struct rpc_task *task, u32 *p)
{
struct gss_cred *cred = (struct gss_cred *)task->tk_msg.rpc_cred;
struct gss_cl_ctx *ctx = cred->gc_ctx;
struct rpc_cred *cred = task->tk_msg.rpc_cred;
struct gss_cl_ctx *ctx = gss_cred_get_ctx(cred);
u32 seq, qop_state;
struct xdr_netobj bufin;
struct xdr_netobj bufout;
......
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