diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-06-23 19:55:31 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2007-07-10 23:40:35 -0400 |
commit | 5fe4755e2526a2aa82b7ed8daeb3aed74a236925 (patch) | |
tree | aceb993080fc6aac5861f04d8a8494becb4046eb /net/sunrpc/auth.c | |
parent | f1c0a8615090359d57e096157feb9f900cbb233c (diff) |
SUNRPC: Clean up rpc credential initialisation
Add a helper rpc_cred_init()
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r-- | net/sunrpc/auth.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c index d3f0f944c0b5..2156327da45b 100644 --- a/net/sunrpc/auth.c +++ b/net/sunrpc/auth.c | |||
@@ -264,13 +264,9 @@ retry: | |||
264 | 264 | ||
265 | if (!cred) { | 265 | if (!cred) { |
266 | new = auth->au_ops->crcreate(auth, acred, flags); | 266 | new = auth->au_ops->crcreate(auth, acred, flags); |
267 | if (!IS_ERR(new)) { | 267 | if (!IS_ERR(new)) |
268 | #ifdef RPC_DEBUG | ||
269 | new->cr_magic = RPCAUTH_CRED_MAGIC; | ||
270 | #endif | ||
271 | goto retry; | 268 | goto retry; |
272 | } else | 269 | cred = new; |
273 | cred = new; | ||
274 | } else if ((cred->cr_flags & RPCAUTH_CRED_NEW) | 270 | } else if ((cred->cr_flags & RPCAUTH_CRED_NEW) |
275 | && cred->cr_ops->cr_init != NULL | 271 | && cred->cr_ops->cr_init != NULL |
276 | && !(flags & RPCAUTH_LOOKUP_NEW)) { | 272 | && !(flags & RPCAUTH_LOOKUP_NEW)) { |
@@ -302,6 +298,22 @@ rpcauth_lookupcred(struct rpc_auth *auth, int flags) | |||
302 | return ret; | 298 | return ret; |
303 | } | 299 | } |
304 | 300 | ||
301 | void | ||
302 | rpcauth_init_cred(struct rpc_cred *cred, const struct auth_cred *acred, | ||
303 | struct rpc_auth *auth, const struct rpc_credops *ops) | ||
304 | { | ||
305 | INIT_HLIST_NODE(&cred->cr_hash); | ||
306 | atomic_set(&cred->cr_count, 1); | ||
307 | cred->cr_auth = auth; | ||
308 | cred->cr_ops = ops; | ||
309 | cred->cr_expire = jiffies; | ||
310 | #ifdef RPC_DEBUG | ||
311 | cred->cr_magic = RPCAUTH_CRED_MAGIC; | ||
312 | #endif | ||
313 | cred->cr_uid = acred->uid; | ||
314 | } | ||
315 | EXPORT_SYMBOL(rpcauth_init_cred); | ||
316 | |||
305 | struct rpc_cred * | 317 | struct rpc_cred * |
306 | rpcauth_bindcred(struct rpc_task *task) | 318 | rpcauth_bindcred(struct rpc_task *task) |
307 | { | 319 | { |