diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-04-07 20:50:11 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2008-04-19 16:54:56 -0400 |
commit | 7c67db3a8a98045744f06fcd6d8f476d9df0ba5c (patch) | |
tree | 4d0041249b48f9ac66560550e0e96c9c86c37891 /net/sunrpc/auth_gss | |
parent | 78ea323be6380a9313e87fe241809e912e8ae401 (diff) |
NFSv4: Reintroduce machine creds
We need to try to ensure that we always use the same credentials whenever
we re-establish the clientid on the server. If not, the server won't
recognise that we're the same client, and so may not allow us to recover
state.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'net/sunrpc/auth_gss')
-rw-r--r-- | net/sunrpc/auth_gss/auth_gss.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c index 7567eb95823b..46f7ec800af9 100644 --- a/net/sunrpc/auth_gss/auth_gss.c +++ b/net/sunrpc/auth_gss/auth_gss.c | |||
@@ -371,9 +371,16 @@ gss_alloc_msg(struct gss_auth *gss_auth, uid_t uid) | |||
371 | static struct gss_upcall_msg * | 371 | static struct gss_upcall_msg * |
372 | gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cred *cred) | 372 | gss_setup_upcall(struct rpc_clnt *clnt, struct gss_auth *gss_auth, struct rpc_cred *cred) |
373 | { | 373 | { |
374 | struct gss_cred *gss_cred = container_of(cred, | ||
375 | struct gss_cred, gc_base); | ||
374 | struct gss_upcall_msg *gss_new, *gss_msg; | 376 | struct gss_upcall_msg *gss_new, *gss_msg; |
377 | uid_t uid = cred->cr_uid; | ||
375 | 378 | ||
376 | gss_new = gss_alloc_msg(gss_auth, cred->cr_uid); | 379 | /* Special case: rpc.gssd assumes that uid == 0 implies machine creds */ |
380 | if (gss_cred->gc_machine_cred != 0) | ||
381 | uid = 0; | ||
382 | |||
383 | gss_new = gss_alloc_msg(gss_auth, uid); | ||
377 | if (gss_new == NULL) | 384 | if (gss_new == NULL) |
378 | return ERR_PTR(-ENOMEM); | 385 | return ERR_PTR(-ENOMEM); |
379 | gss_msg = gss_add_msg(gss_auth, gss_new); | 386 | gss_msg = gss_add_msg(gss_auth, gss_new); |
@@ -818,6 +825,7 @@ gss_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) | |||
818 | */ | 825 | */ |
819 | cred->gc_base.cr_flags = 1UL << RPCAUTH_CRED_NEW; | 826 | cred->gc_base.cr_flags = 1UL << RPCAUTH_CRED_NEW; |
820 | cred->gc_service = gss_auth->service; | 827 | cred->gc_service = gss_auth->service; |
828 | cred->gc_machine_cred = acred->machine_cred; | ||
821 | kref_get(&gss_auth->kref); | 829 | kref_get(&gss_auth->kref); |
822 | return &cred->gc_base; | 830 | return &cred->gc_base; |
823 | 831 | ||
@@ -855,6 +863,8 @@ gss_match(struct auth_cred *acred, struct rpc_cred *rc, int flags) | |||
855 | if (gss_cred->gc_ctx && time_after(jiffies, gss_cred->gc_ctx->gc_expiry)) | 863 | if (gss_cred->gc_ctx && time_after(jiffies, gss_cred->gc_ctx->gc_expiry)) |
856 | return 0; | 864 | return 0; |
857 | out: | 865 | out: |
866 | if (acred->machine_cred != gss_cred->gc_machine_cred) | ||
867 | return 0; | ||
858 | return (rc->cr_uid == acred->uid); | 868 | return (rc->cr_uid == acred->uid); |
859 | } | 869 | } |
860 | 870 | ||