提交 4a8c1344 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 c1384c9c
...@@ -30,8 +30,11 @@ struct auth_cred { ...@@ -30,8 +30,11 @@ struct auth_cred {
/* /*
* Client user credentials * Client user credentials
*/ */
struct rpc_auth;
struct rpc_credops;
struct rpc_cred { struct rpc_cred {
struct hlist_node cr_hash; /* hash chain */ struct hlist_node cr_hash; /* hash chain */
struct rpc_auth * cr_auth;
struct rpc_credops * cr_ops; struct rpc_credops * cr_ops;
unsigned long cr_expire; /* when to gc */ unsigned long cr_expire; /* when to gc */
atomic_t cr_count; /* ref count */ atomic_t cr_count; /* ref count */
...@@ -60,6 +63,7 @@ struct rpc_cred_cache { ...@@ -60,6 +63,7 @@ struct rpc_cred_cache {
unsigned long expire; /* cache expiry interval */ unsigned long expire; /* cache expiry interval */
}; };
struct rpc_authops;
struct rpc_auth { struct rpc_auth {
unsigned int au_cslack; /* call cred size estimate */ unsigned int au_cslack; /* call cred size estimate */
/* guess at number of u32's auth adds before /* guess at number of u32's auth adds before
......
...@@ -386,7 +386,7 @@ static inline int ...@@ -386,7 +386,7 @@ static inline int
gss_refresh_upcall(struct rpc_task *task) gss_refresh_upcall(struct rpc_task *task)
{ {
struct rpc_cred *cred = task->tk_msg.rpc_cred; struct rpc_cred *cred = task->tk_msg.rpc_cred;
struct gss_auth *gss_auth = container_of(task->tk_client->cl_auth, struct gss_auth *gss_auth = container_of(cred->cr_auth,
struct gss_auth, rpc_auth); struct gss_auth, rpc_auth);
struct gss_cred *gss_cred = container_of(cred, struct gss_cred *gss_cred = container_of(cred,
struct gss_cred, gc_base); struct gss_cred, gc_base);
...@@ -741,6 +741,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) ...@@ -741,6 +741,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
* fail to flag the credential as RPCAUTH_CRED_UPTODATE. * fail to flag the credential as RPCAUTH_CRED_UPTODATE.
*/ */
cred->gc_flags = 0; cred->gc_flags = 0;
cred->gc_base.cr_auth = auth;
cred->gc_base.cr_ops = &gss_credops; cred->gc_base.cr_ops = &gss_credops;
cred->gc_base.cr_flags = RPCAUTH_CRED_NEW; cred->gc_base.cr_flags = RPCAUTH_CRED_NEW;
cred->gc_service = gss_auth->service; cred->gc_service = gss_auth->service;
......
...@@ -133,6 +133,7 @@ struct rpc_credops null_credops = { ...@@ -133,6 +133,7 @@ struct rpc_credops null_credops = {
static static
struct rpc_cred null_cred = { struct rpc_cred null_cred = {
.cr_auth = &null_auth,
.cr_ops = &null_credops, .cr_ops = &null_credops,
.cr_count = ATOMIC_INIT(1), .cr_count = ATOMIC_INIT(1),
.cr_flags = RPCAUTH_CRED_UPTODATE, .cr_flags = RPCAUTH_CRED_UPTODATE,
......
...@@ -92,6 +92,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) ...@@ -92,6 +92,7 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
if (i < NFS_NGROUPS) if (i < NFS_NGROUPS)
cred->uc_gids[i] = NOGROUP; cred->uc_gids[i] = NOGROUP;
} }
cred->uc_base.cr_auth = &unix_auth;
cred->uc_base.cr_ops = &unix_credops; cred->uc_base.cr_ops = &unix_credops;
return (struct rpc_cred *) cred; return (struct rpc_cred *) cred;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册