提交 9132adb0 编写于 作者: E Eric W. Biederman

sunrpc: Simplify auth_unix now that everything is a kgid_t

In unx_create_cred directly assign gids from acred->group_info
to cred->uc_gids.

In unx_match directly compare uc_gids with group_info.

Now that both group_info and unx_cred gids are stored as kgids
this is valid and the extra layer of translation can be removed.

Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: N"Eric W. Biederman" <ebiederm@xmission.com>
上级 0b4d51b0
...@@ -79,11 +79,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags) ...@@ -79,11 +79,8 @@ unx_create_cred(struct rpc_auth *auth, struct auth_cred *acred, int flags)
groups = NFS_NGROUPS; groups = NFS_NGROUPS;
cred->uc_gid = acred->gid; cred->uc_gid = acred->gid;
for (i = 0; i < groups; i++) { for (i = 0; i < groups; i++)
gid_t gid; cred->uc_gids[i] = GROUP_AT(acred->group_info, i);
gid = from_kgid(&init_user_ns, GROUP_AT(acred->group_info, i));
cred->uc_gids[i] = gid;
}
if (i < NFS_NGROUPS) if (i < NFS_NGROUPS)
cred->uc_gids[i] = INVALID_GID; cred->uc_gids[i] = INVALID_GID;
...@@ -130,12 +127,9 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags) ...@@ -130,12 +127,9 @@ unx_match(struct auth_cred *acred, struct rpc_cred *rcred, int flags)
groups = acred->group_info->ngroups; groups = acred->group_info->ngroups;
if (groups > NFS_NGROUPS) if (groups > NFS_NGROUPS)
groups = NFS_NGROUPS; groups = NFS_NGROUPS;
for (i = 0; i < groups ; i++) { for (i = 0; i < groups ; i++)
gid_t gid; if (!gid_eq(cred->uc_gids[i], GROUP_AT(acred->group_info, i)))
gid = from_kgid(&init_user_ns, GROUP_AT(acred->group_info, i));
if (cred->uc_gids[i] != gid)
return 0; return 0;
}
if (groups < NFS_NGROUPS && if (groups < NFS_NGROUPS &&
cred->uc_gids[groups] != INVALID_GID) cred->uc_gids[groups] != INVALID_GID)
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册