diff options
author | Frank Sorenson <sorenson@redhat.com> | 2016-09-29 11:44:39 -0400 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-09-30 15:45:21 -0400 |
commit | 1e035d065f3415809c056fb7537320a74c718537 (patch) | |
tree | fd5c407a7a2dc75651809d944089d6e94d7e4a53 /net/sunrpc | |
parent | 18028c967e423673a055a30b1bf4e603ec64026d (diff) |
sunrpc: add auth_unix hash_cred() function
Add a hash_cred() function for auth_unix, using both the
uid and gid from the auth_cred.
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/auth_unix.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/net/sunrpc/auth_unix.c b/net/sunrpc/auth_unix.c index a99278c984e8..4c0c572af2da 100644 --- a/net/sunrpc/auth_unix.c +++ b/net/sunrpc/auth_unix.c | |||
@@ -46,6 +46,14 @@ unx_destroy(struct rpc_auth *auth) | |||
46 | rpcauth_clear_credcache(auth->au_credcache); | 46 | rpcauth_clear_credcache(auth->au_credcache); |
47 | } | 47 | } |
48 | 48 | ||
49 | static int | ||
50 | unx_hash_cred(struct auth_cred *acred, unsigned int hashbits) | ||
51 | { | ||
52 | return hash_64(from_kgid(&init_user_ns, acred->gid) | | ||
53 | ((u64)from_kuid(&init_user_ns, acred->uid) << | ||
54 | (sizeof(gid_t) * 8)), hashbits); | ||
55 | } | ||
56 | |||
49 | /* | 57 | /* |
50 | * Lookup AUTH_UNIX creds for current process | 58 | * Lookup AUTH_UNIX creds for current process |
51 | */ | 59 | */ |
@@ -220,6 +228,7 @@ const struct rpc_authops authunix_ops = { | |||
220 | .au_name = "UNIX", | 228 | .au_name = "UNIX", |
221 | .create = unx_create, | 229 | .create = unx_create, |
222 | .destroy = unx_destroy, | 230 | .destroy = unx_destroy, |
231 | .hash_cred = unx_hash_cred, | ||
223 | .lookup_cred = unx_lookup_cred, | 232 | .lookup_cred = unx_lookup_cred, |
224 | .crcreate = unx_create_cred, | 233 | .crcreate = unx_create_cred, |
225 | }; | 234 | }; |