diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-03-12 16:21:07 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-03-14 13:42:41 -0400 |
commit | 5c691044ecbca04dd558fca4c754121689fe1b34 (patch) | |
tree | 7a56b63c44766fcca0d7ac245ce0e19077b6f118 /net/sunrpc/auth_generic.c | |
parent | 9a559efd4199c9812d339e23cc1b6055366b224f (diff) |
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.c | 15 |
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) | |||
35 | } | 35 | } |
36 | EXPORT_SYMBOL_GPL(rpc_lookup_cred); | 36 | EXPORT_SYMBOL_GPL(rpc_lookup_cred); |
37 | 37 | ||
38 | static void | ||
39 | generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred) | ||
40 | { | ||
41 | struct rpc_auth *auth = task->tk_client->cl_auth; | ||
42 | struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; | ||
43 | struct rpc_cred *ret; | ||
44 | |||
45 | ret = auth->au_ops->lookup_cred(auth, acred, 0); | ||
46 | if (!IS_ERR(ret)) | ||
47 | task->tk_msg.rpc_cred = ret; | ||
48 | else | ||
49 | task->tk_status = PTR_ERR(ret); | ||
50 | } | ||
51 | |||
38 | /* | 52 | /* |
39 | * Lookup generic creds for current process | 53 | * Lookup generic creds for current process |
40 | */ | 54 | */ |
@@ -138,5 +152,6 @@ static struct rpc_auth generic_auth = { | |||
138 | static const struct rpc_credops generic_credops = { | 152 | static const struct rpc_credops generic_credops = { |
139 | .cr_name = "Generic cred", | 153 | .cr_name = "Generic cred", |
140 | .crdestroy = generic_destroy_cred, | 154 | .crdestroy = generic_destroy_cred, |
155 | .crbind = generic_bind_cred, | ||
141 | .crmatch = generic_match, | 156 | .crmatch = generic_match, |
142 | }; | 157 | }; |