diff options
Diffstat (limited to 'net/sunrpc/auth_generic.c')
| -rw-r--r-- | net/sunrpc/auth_generic.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/net/sunrpc/auth_generic.c b/net/sunrpc/auth_generic.c index bf88bf8e9365..43162bb3b78f 100644 --- a/net/sunrpc/auth_generic.c +++ b/net/sunrpc/auth_generic.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | */ | 5 | */ |
| 6 | 6 | ||
| 7 | #include <linux/err.h> | 7 | #include <linux/err.h> |
| 8 | #include <linux/slab.h> | ||
| 8 | #include <linux/types.h> | 9 | #include <linux/types.h> |
| 9 | #include <linux/module.h> | 10 | #include <linux/module.h> |
| 10 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
| @@ -26,7 +27,6 @@ struct generic_cred { | |||
| 26 | }; | 27 | }; |
| 27 | 28 | ||
| 28 | static struct rpc_auth generic_auth; | 29 | static struct rpc_auth generic_auth; |
| 29 | static struct rpc_cred_cache generic_cred_cache; | ||
| 30 | static const struct rpc_credops generic_credops; | 30 | static const struct rpc_credops generic_credops; |
| 31 | 31 | ||
| 32 | /* | 32 | /* |
| @@ -54,18 +54,13 @@ struct rpc_cred *rpc_lookup_machine_cred(void) | |||
| 54 | } | 54 | } |
| 55 | EXPORT_SYMBOL_GPL(rpc_lookup_machine_cred); | 55 | EXPORT_SYMBOL_GPL(rpc_lookup_machine_cred); |
| 56 | 56 | ||
| 57 | static void | 57 | static struct rpc_cred *generic_bind_cred(struct rpc_task *task, |
| 58 | generic_bind_cred(struct rpc_task *task, struct rpc_cred *cred, int lookupflags) | 58 | struct rpc_cred *cred, int lookupflags) |
| 59 | { | 59 | { |
| 60 | struct rpc_auth *auth = task->tk_client->cl_auth; | 60 | struct rpc_auth *auth = task->tk_client->cl_auth; |
| 61 | struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; | 61 | struct auth_cred *acred = &container_of(cred, struct generic_cred, gc_base)->acred; |
| 62 | struct rpc_cred *ret; | ||
| 63 | 62 | ||
| 64 | ret = auth->au_ops->lookup_cred(auth, acred, lookupflags); | 63 | return auth->au_ops->lookup_cred(auth, acred, lookupflags); |
| 65 | if (!IS_ERR(ret)) | ||
| 66 | task->tk_msg.rpc_cred = ret; | ||
| 67 | else | ||
| 68 | task->tk_status = PTR_ERR(ret); | ||
| 69 | } | 64 | } |
| 70 | 65 | ||
| 71 | /* | 66 | /* |
| @@ -158,20 +153,16 @@ out_nomatch: | |||
| 158 | return 0; | 153 | return 0; |
| 159 | } | 154 | } |
| 160 | 155 | ||
| 161 | void __init rpc_init_generic_auth(void) | 156 | int __init rpc_init_generic_auth(void) |
| 162 | { | 157 | { |
| 163 | spin_lock_init(&generic_cred_cache.lock); | 158 | return rpcauth_init_credcache(&generic_auth); |
| 164 | } | 159 | } |
| 165 | 160 | ||
| 166 | void __exit rpc_destroy_generic_auth(void) | 161 | void __exit rpc_destroy_generic_auth(void) |
| 167 | { | 162 | { |
| 168 | rpcauth_clear_credcache(&generic_cred_cache); | 163 | rpcauth_destroy_credcache(&generic_auth); |
| 169 | } | 164 | } |
| 170 | 165 | ||
| 171 | static struct rpc_cred_cache generic_cred_cache = { | ||
| 172 | {{ NULL, },}, | ||
| 173 | }; | ||
| 174 | |||
| 175 | static const struct rpc_authops generic_auth_ops = { | 166 | static const struct rpc_authops generic_auth_ops = { |
| 176 | .owner = THIS_MODULE, | 167 | .owner = THIS_MODULE, |
| 177 | .au_name = "Generic", | 168 | .au_name = "Generic", |
| @@ -182,7 +173,6 @@ static const struct rpc_authops generic_auth_ops = { | |||
| 182 | static struct rpc_auth generic_auth = { | 173 | static struct rpc_auth generic_auth = { |
| 183 | .au_ops = &generic_auth_ops, | 174 | .au_ops = &generic_auth_ops, |
| 184 | .au_count = ATOMIC_INIT(0), | 175 | .au_count = ATOMIC_INIT(0), |
| 185 | .au_credcache = &generic_cred_cache, | ||
| 186 | }; | 176 | }; |
| 187 | 177 | ||
| 188 | static const struct rpc_credops generic_credops = { | 178 | static const struct rpc_credops generic_credops = { |
