Skip to content

Commit

Permalink
sunrpc: add auth_unix hash_cred() function
Browse files Browse the repository at this point in the history
Add a hash_cred() function for auth_unix, using both the
uid and gid from the auth_cred.

Signed-off-by: Frank Sorenson <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
fsorenson authored and amschuma-ntap committed Sep 30, 2016
1 parent 18028c9 commit 1e035d0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions net/sunrpc/auth_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ unx_destroy(struct rpc_auth *auth)
rpcauth_clear_credcache(auth->au_credcache);
}

static int
unx_hash_cred(struct auth_cred *acred, unsigned int hashbits)
{
return hash_64(from_kgid(&init_user_ns, acred->gid) |
((u64)from_kuid(&init_user_ns, acred->uid) <<
(sizeof(gid_t) * 8)), hashbits);
}

/*
* Lookup AUTH_UNIX creds for current process
*/
Expand Down Expand Up @@ -220,6 +228,7 @@ const struct rpc_authops authunix_ops = {
.au_name = "UNIX",
.create = unx_create,
.destroy = unx_destroy,
.hash_cred = unx_hash_cred,
.lookup_cred = unx_lookup_cred,
.crcreate = unx_create_cred,
};
Expand Down

0 comments on commit 1e035d0

Please sign in to comment.