summaryrefslogtreecommitdiffstats
path: root/net/sunrpc/auth.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r--net/sunrpc/auth.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
index cf23eed01b1c..ac8f824ec34f 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
@@ -39,15 +39,15 @@ static const struct rpc_authops __rcu *auth_flavors[RPC_AUTH_MAXFLAVOR] = {
39static LIST_HEAD(cred_unused); 39static LIST_HEAD(cred_unused);
40static unsigned long number_cred_unused; 40static unsigned long number_cred_unused;
41 41
42static struct rpc_cred machine_cred = { 42static struct cred machine_cred = {
43 .cr_count = REFCOUNT_INIT(1), 43 .usage = ATOMIC_INIT(1),
44}; 44};
45 45
46/* 46/*
47 * Return the machine_cred pointer to be used whenever 47 * Return the machine_cred pointer to be used whenever
48 * the a generic machine credential is needed. 48 * the a generic machine credential is needed.
49 */ 49 */
50struct rpc_cred *rpc_machine_cred(void) 50const struct cred *rpc_machine_cred(void)
51{ 51{
52 return &machine_cred; 52 return &machine_cred;
53} 53}
@@ -720,11 +720,15 @@ rpcauth_bind_new_cred(struct rpc_task *task, int lookupflags)
720} 720}
721 721
722static int 722static int
723rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags) 723rpcauth_bindcred(struct rpc_task *task, const struct cred *cred, int flags)
724{ 724{
725 struct rpc_rqst *req = task->tk_rqstp; 725 struct rpc_rqst *req = task->tk_rqstp;
726 struct rpc_cred *new = NULL; 726 struct rpc_cred *new = NULL;
727 int lookupflags = 0; 727 int lookupflags = 0;
728 struct rpc_auth *auth = task->tk_client->cl_auth;
729 struct auth_cred acred = {
730 .cred = cred,
731 };
728 732
729 if (flags & RPC_TASK_ASYNC) 733 if (flags & RPC_TASK_ASYNC)
730 lookupflags |= RPCAUTH_LOOKUP_NEW; 734 lookupflags |= RPCAUTH_LOOKUP_NEW;
@@ -733,7 +737,7 @@ rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags)
733 new = task->tk_op_cred->cr_ops->crbind(task, task->tk_op_cred, 737 new = task->tk_op_cred->cr_ops->crbind(task, task->tk_op_cred,
734 lookupflags); 738 lookupflags);
735 else if (cred != NULL && cred != &machine_cred) 739 else if (cred != NULL && cred != &machine_cred)
736 new = cred->cr_ops->crbind(task, cred, lookupflags); 740 new = auth->au_ops->lookup_cred(auth, &acred, lookupflags);
737 else if (cred == &machine_cred) 741 else if (cred == &machine_cred)
738 new = rpcauth_bind_machine_cred(task, lookupflags); 742 new = rpcauth_bind_machine_cred(task, lookupflags);
739 743