]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
auth_gss: fetch the acceptor name out of the downcall
authorJeff Layton <jlayton@poochiereds.net>
Sun, 22 Jun 2014 00:52:15 +0000 (20:52 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Sat, 12 Jul 2014 22:41:06 +0000 (18:41 -0400)
If rpc.gssd sends us an acceptor name string trailing the context token,
stash it as part of the context.

Signed-off-by: Jeff Layton <jlayton@poochiereds.net>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
include/linux/sunrpc/auth_gss.h
net/sunrpc/auth_gss/auth_gss.c

index f1cfd4c85cd047c4b2fadd367eeb819aabc57d29..cbc6875fb9cf8f9b7952f485e0c1ccb4845f4b46 100644 (file)
@@ -71,6 +71,7 @@ struct gss_cl_ctx {
        spinlock_t              gc_seq_lock;
        struct gss_ctx __rcu    *gc_gss_ctx;
        struct xdr_netobj       gc_wire_ctx;
+       struct xdr_netobj       gc_acceptor;
        u32                     gc_win;
        unsigned long           gc_expiry;
        struct rcu_head         gc_rcu;
index b6e440baccc3733f7b8963ed7ab6fddc72fd0c4c..e34af68603bdec1d7ba207c3bc3fee8143f84ffe 100644 (file)
@@ -262,9 +262,22 @@ gss_fill_context(const void *p, const void *end, struct gss_cl_ctx *ctx, struct
                p = ERR_PTR(ret);
                goto err;
        }
-       dprintk("RPC:       %s Success. gc_expiry %lu now %lu timeout %u\n",
-               __func__, ctx->gc_expiry, now, timeout);
-       return q;
+
+       /* is there any trailing data? */
+       if (q == end) {
+               p = q;
+               goto done;
+       }
+
+       /* pull in acceptor name (if there is one) */
+       p = simple_get_netobj(q, end, &ctx->gc_acceptor);
+       if (IS_ERR(p))
+               goto err;
+done:
+       dprintk("RPC:       %s Success. gc_expiry %lu now %lu timeout %u acceptor %.*s\n",
+               __func__, ctx->gc_expiry, now, timeout, ctx->gc_acceptor.len,
+               ctx->gc_acceptor.data);
+       return p;
 err:
        dprintk("RPC:       %s returns error %ld\n", __func__, -PTR_ERR(p));
        return p;
@@ -1225,6 +1238,7 @@ gss_do_free_ctx(struct gss_cl_ctx *ctx)
 
        gss_delete_sec_context(&ctx->gc_gss_ctx);
        kfree(ctx->gc_wire_ctx.data);
+       kfree(ctx->gc_acceptor.data);
        kfree(ctx);
 }