SUNRPC: conditionally return endtime from import_sec_context
authorSimo Sorce <simo@redhat.com>
Fri, 25 May 2012 22:09:53 +0000 (18:09 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Fri, 26 Apr 2013 15:41:27 +0000 (11:41 -0400)
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: Simo Sorce <simo@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
include/linux/sunrpc/gss_api.h
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/gss_krb5_mech.c
net/sunrpc/auth_gss/gss_mech_switch.c
net/sunrpc/auth_gss/svcauth_gss.c

index a19e2547ae6aba4481ba4cd01f5bdbbf7545de22..04d03bb2de5d01fb67053be55c4545fc3b9c1f98 100644 (file)
@@ -37,6 +37,7 @@ int gss_import_sec_context(
                size_t                  bufsize,
                struct gss_api_mech     *mech,
                struct gss_ctx          **ctx_id,
+               time_t                  *endtime,
                gfp_t                   gfp_mask);
 u32 gss_get_mic(
                struct gss_ctx          *ctx_id,
@@ -92,6 +93,7 @@ struct gss_api_ops {
                        const void              *input_token,
                        size_t                  bufsize,
                        struct gss_ctx          *ctx_id,
+                       time_t                  *endtime,
                        gfp_t                   gfp_mask);
        u32 (*gss_get_mic)(
                        struct gss_ctx          *ctx_id,
index 5257d2982ba53665024e028dc4a5c0cb15dabd90..23563e783ec287243af09589c2fe0b6e9d2bb832 100644 (file)
@@ -238,7 +238,7 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
                p = ERR_PTR(-EFAULT);
                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) {
                p = ERR_PTR(ret);
                goto err;
index d3611f11a8dfc0767ab5736a87740a68f7645f8d..3bc4a23938ea72116deb071fae82f800ccc478d1 100644 (file)
@@ -679,6 +679,7 @@ out_err:
 static int
 gss_import_sec_context_kerberos(const void *p, size_t len,
                                struct gss_ctx *ctx_id,
+                               time_t *endtime,
                                gfp_t gfp_mask)
 {
        const void *end = (const void *)((const char *)p + len);
@@ -694,9 +695,11 @@ gss_import_sec_context_kerberos(const void *p, size_t len,
        else
                ret = gss_import_v2_context(p, end, ctx, gfp_mask);
 
-       if (ret == 0)
+       if (ret == 0) {
                ctx_id->internal_ctx_id = ctx;
-       else
+               if (endtime)
+                       *endtime = ctx->endtime;
+       } else
                kfree(ctx);
 
        dprintk("RPC:       %s: returning %d\n", __func__, ret);
index f0f4eee63a3579e5783e9a290a4bfb808f0d593a..43fd5bbf92c61002a3b727ac69ee66fdd93c1fc7 100644 (file)
@@ -325,14 +325,15 @@ int
 gss_import_sec_context(const void *input_token, size_t bufsize,
                       struct gss_api_mech      *mech,
                       struct gss_ctx           **ctx_id,
+                      time_t                   *endtime,
                       gfp_t gfp_mask)
 {
        if (!(*ctx_id = kzalloc(sizeof(**ctx_id), gfp_mask)))
                return -ENOMEM;
        (*ctx_id)->mech_type = gss_mech_get(mech);
 
-       return mech->gm_ops
-               ->gss_import_sec_context(input_token, bufsize, *ctx_id, gfp_mask);
+       return mech->gm_ops->gss_import_sec_context(input_token, bufsize,
+                                               *ctx_id, endtime, gfp_mask);
 }
 
 /* gss_get_mic: compute a mic over message and return mic_token. */
index 5ead60550895f848ba2348bba3bbbfc50ddea7ea..20eedecc35f8037b1482dfbc6642f9a356760aaf 100644 (file)
@@ -497,7 +497,8 @@ static int rsc_parse(struct cache_detail *cd,
                len = qword_get(&mesg, buf, mlen);
                if (len < 0)
                        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)
                        goto out;