diff options
Diffstat (limited to 'net/sunrpc/auth.c')
-rw-r--r-- | net/sunrpc/auth.c | 14 |
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] = { | |||
39 | static LIST_HEAD(cred_unused); | 39 | static LIST_HEAD(cred_unused); |
40 | static unsigned long number_cred_unused; | 40 | static unsigned long number_cred_unused; |
41 | 41 | ||
42 | static struct rpc_cred machine_cred = { | 42 | static 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 | */ |
50 | struct rpc_cred *rpc_machine_cred(void) | 50 | const 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 | ||
722 | static int | 722 | static int |
723 | rpcauth_bindcred(struct rpc_task *task, struct rpc_cred *cred, int flags) | 723 | rpcauth_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 | ||