summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth_generic.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2008-03-12 16:21:07 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2008-03-14 13:42:41 -0400
commit5c691044ecbca04dd558fca4c754121689fe1b34 (patch)
tree7a56b63c44766fcca0d7ac245ce0e19077b6f118 /net/sunrpc/auth_generic.c
parent9a559efd4199c9812d339e23cc1b6055366b224f (diff)
downloadlinux-stable-5c691044ecbca04dd558fca4c754121689fe1b34.tar.gz
linux-stable-5c691044ecbca04dd558fca4c754121689fe1b34.tar.bz2
linux-stable-5c691044ecbca04dd558fca4c754121689fe1b34.zip
SUNRPC: Add an rpc_credop callback for binding a credential to an rpc_task
We need the ability to treat 'generic' creds specially, since they want to bind instances of the auth cred instead of binding themselves. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_generic.c')
-rw-r--r--net/sunrpc/auth_generic.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c
index 6f129b1b20a0..6a3f77c9e4d3 100644
--- a/net/sunrpc/auth_generic.c
+++ b/net/sunrpc/auth_generic.c
@@ -35,6 +35,20 @@ struct rpc_cred *rpc_lookup_cred(void)
}
EXPORT_SYMBOL_GPL(rpc_lookup_cred);
+static void
+generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred)
+{
+ struct rpc_auth *auth = task->tk_client->cl_auth;
+ struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred;
+ struct rpc_cred *ret;
+
+ ret = auth->au_ops->lookup_cred(auth, acred, 0);
+ if (!IS_ERR(ret))
+ task->tk_msg.rpc_cred = ret;
+ else
+ task->tk_status = PTR_ERR(ret);
+}
+
/*
* Lookup generic creds for current process
*/
@@ -138,5 +152,6 @@ static struct rpc_auth generic_auth = {
static const struct rpc_credops generic_credops = {
.cr_name = "Generic cred",
.crdestroy = generic_destroy_cred,
+ .crbind = generic_bind_cred,
.crmatch = generic_match,
};