aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <Trond.Myklebust@netapp.com>2007-06-07 10:14:14 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2007-07-10 23:40:31 -0400
commit4a8c1344dccb848dbcf0edabc8b5c51a8ecf2808 (patch)
treeecfa69d4bc36aefe86c2528240ef69da723f5bf4
parentc1384c9c4c184543375b52a0997d06cd98145164 (diff)
SUNRPC: Add a backpointer from the struct rpc_cred to the rpc_auth
Cleans up an issue whereby rpcsec_gss uses the rpc_clnt->cl_auth. If we want to be able to add several rpc_auths to a single rpc_clnt, then this abuse must go. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r--include/linux/sunrpc/auth.h4
-rw-r--r--net/sunrpc/auth_gss/auth_gss.c3
-rw-r--r--net/sunrpc/auth_null.c1
-rw-r--r--net/sunrpc/auth_unix.c1
4 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/sunrpc/auth.h b/include/linux/sunrpc/auth.h
index 534cdc7be58d..8ef27afeea73 100644
--- a/include/linux/sunrpc/auth.h
+++ b/include/linux/sunrpc/auth.h
@@ -30,8 +30,11 @@ struct auth_cred {
30/* 30/*
31 * Client user credentials 31 * Client user credentials
32 */ 32 */
33struct rpc_auth;
34struct rpc_credops;
33struct rpc_cred { 35struct rpc_cred {
34 struct hlist_node cr_hash; /* hash chain */ 36 struct hlist_node cr_hash; /* hash chain */
37 struct rpc_auth * cr_auth;
35 struct rpc_credops * cr_ops; 38 struct rpc_credops * cr_ops;
36 unsigned long cr_expire; /* when to gc */ 39 unsigned long cr_expire; /* when to gc */
37 atomic_t cr_count; /* ref count */ 40 atomic_t cr_count; /* ref count */
@@ -60,6 +63,7 @@ struct rpc_cred_cache {
60 unsigned long expire; /* cache expiry interval */ 63 unsigned long expire; /* cache expiry interval */
61}; 64};
62 65
66struct rpc_authops;
63struct rpc_auth { 67struct rpc_auth {
64 unsigned int au_cslack; /* call cred size estimate */ 68 unsigned int au_cslack; /* call cred size estimate */
65 /* guess at number of u32's auth adds before 69 /* guess at number of u32's auth adds before
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 4e4ccc5b6fea..e894e2fc360d 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -386,7 +386,7 @@ static inline int
386gss_refresh_upcall(struct rpc_task *task) 386gss_refresh_upcall(struct rpc_task *task)
387{ 387{
388 struct rpc_cred *cred = task->tk_msg.rpc_cred; 388 struct rpc_cred *cred = task->tk_msg.rpc_cred;
389 struct gss_auth *gss_auth = container_of(task->tk_client->cl_auth, 389 struct gss_auth *gss_auth = container_of(cred->cr_auth,
390 struct gss_auth, rpc_auth); 390 struct gss_auth, rpc_auth);
391 struct gss_cred *gss_cred = container_of(cred, 391 struct gss_cred *gss_cred = container_of(cred,
392 struct gss_cred, gc_base); 392 struct gss_cred, gc_base);
@@ -741,6 +741,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
741 * fail to flag the credential as RPCAUTH_CRED_UPTODATE. 741 * fail to flag the credential as RPCAUTH_CRED_UPTODATE.
742 */ 742 */
743 cred->gc_flags = 0; 743 cred->gc_flags = 0;
744 cred->gc_base.cr_auth = auth;
744 cred->gc_base.cr_ops = &gss_credops; 745 cred->gc_base.cr_ops = &gss_credops;
745 cred->gc_base.cr_flags = RPCAUTH_CRED_NEW; 746 cred->gc_base.cr_flags = RPCAUTH_CRED_NEW;
746 cred->gc_service = gss_auth->service; 747 cred->gc_service = gss_auth->service;
diff --git a/net/sunrpc/auth_null.c b/net/sunrpc/auth_null.c
index 3df9fccab2f8..890bd9b3794b 100644
--- a/net/sunrpc/auth_null.c
+++ b/net/sunrpc/auth_null.c
@@ -133,6 +133,7 @@ struct rpc_credops null_credops = {
133 133
134static 134static
135struct rpc_cred null_cred = { 135struct rpc_cred null_cred = {
136 .cr_auth = &null_auth,
136 .cr_ops = &null_credops, 137 .cr_ops = &null_credops,
137 .cr_count = ATOMIC_INIT(1), 138 .cr_count = ATOMIC_INIT(1),
138 .cr_flags = RPCAUTH_CRED_UPTODATE, 139 .cr_flags = RPCAUTH_CRED_UPTODATE,
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c
index 4e7733aee36e..82300b83045e 100644
--- a/net/sunrpc/auth_unix.c
+++ b/net/sunrpc/auth_unix.c
@@ -92,6 +92,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
92 if (i < NFS_NGROUPS) 92 if (i < NFS_NGROUPS)
93 cred->uc_gids[i] = NOGROUP; 93 cred->uc_gids[i] = NOGROUP;
94 } 94 }
95 cred->uc_base.cr_auth = &unix_auth;
95 cred->uc_base.cr_ops = &unix_credops; 96 cred->uc_base.cr_ops = &unix_credops;
96 97
97 return (struct rpc_cred *) cred; 98 return (struct rpc_cred *) cred;