提交 1e035d06 编写于 作者: F Frank Sorenson 提交者: Anna Schumaker

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: NFrank Sorenson <sorenson@redhat.com>
Signed-off-by: NAnna Schumaker <Anna.Schumaker@Netapp.com>
上级 18028c96
...@@ -46,6 +46,14 @@ unx_destroy(struct rpc_auth *auth) ...@@ -46,6 +46,14 @@ unx_destroy(struct rpc_auth *auth)
rpcauth_clear_credcache(auth->au_credcache); 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 * Lookup AUTH_UNIX creds for current process
*/ */
...@@ -220,6 +228,7 @@ const struct rpc_authops authunix_ops = { ...@@ -220,6 +228,7 @@ const struct rpc_authops authunix_ops = {
.au_name = "UNIX", .au_name = "UNIX",
.create = unx_create, .create = unx_create,
.destroy = unx_destroy, .destroy = unx_destroy,
.hash_cred = unx_hash_cred,
.lookup_cred = unx_lookup_cred, .lookup_cred = unx_lookup_cred,
.crcreate = unx_create_cred, .crcreate = unx_create_cred,
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册