aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth.c
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-23 19:55:31 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:35 -0400
commit5fe4755e2526a2aa82b7ed8daeb3aed74a236925 (patch)
treeaceb993080fc6aac5861f04d8a8494becb4046eb /net/sunrpc/auth.c
parentf1c0a8615090359d57e096157feb9f900cbb233c (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.c24
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
301void
302rpcauth_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}
315EXPORT_SYMBOL(rpcauth_init_cred);
316
305struct rpc_cred * 317struct rpc_cred *
306rpcauth_bindcred(struct rpc_task *task) 318rpcauth_bindcred(struct rpc_task *task)
307{ 319{