sunrpc: Update svcgss xdr handle to rpsec_contect cache
For each received uid call make_kuid and validate the result. For each received gid call make_kgid and validate the result. Cc: "J. Bruce Fields" <bfields@fieldses.org> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
90602c7b19
commit
683428fae8
1 changed files with 13 additions and 5 deletions
|
@ -418,6 +418,7 @@ static int rsc_parse(struct cache_detail *cd,
|
||||||
{
|
{
|
||||||
/* contexthandle expiry [ uid gid N <n gids> mechname ...mechdata... ] */
|
/* contexthandle expiry [ uid gid N <n gids> mechname ...mechdata... ] */
|
||||||
char *buf = mesg;
|
char *buf = mesg;
|
||||||
|
int id;
|
||||||
int len, rv;
|
int len, rv;
|
||||||
struct rsc rsci, *rscp = NULL;
|
struct rsc rsci, *rscp = NULL;
|
||||||
time_t expiry;
|
time_t expiry;
|
||||||
|
@ -444,7 +445,7 @@ static int rsc_parse(struct cache_detail *cd,
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* uid, or NEGATIVE */
|
/* uid, or NEGATIVE */
|
||||||
rv = get_int(&mesg, &rsci.cred.cr_uid);
|
rv = get_int(&mesg, &id);
|
||||||
if (rv == -EINVAL)
|
if (rv == -EINVAL)
|
||||||
goto out;
|
goto out;
|
||||||
if (rv == -ENOENT)
|
if (rv == -ENOENT)
|
||||||
|
@ -452,8 +453,16 @@ static int rsc_parse(struct cache_detail *cd,
|
||||||
else {
|
else {
|
||||||
int N, i;
|
int N, i;
|
||||||
|
|
||||||
|
/* uid */
|
||||||
|
rsci.cred.cr_uid = make_kuid(&init_user_ns, id);
|
||||||
|
if (!uid_valid(rsci.cred.cr_uid))
|
||||||
|
goto out;
|
||||||
|
|
||||||
/* gid */
|
/* gid */
|
||||||
if (get_int(&mesg, &rsci.cred.cr_gid))
|
if (get_int(&mesg, &id))
|
||||||
|
goto out;
|
||||||
|
rsci.cred.cr_gid = make_kgid(&init_user_ns, id);
|
||||||
|
if (!gid_valid(rsci.cred.cr_gid))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* number of additional gid's */
|
/* number of additional gid's */
|
||||||
|
@ -467,11 +476,10 @@ static int rsc_parse(struct cache_detail *cd,
|
||||||
/* gid's */
|
/* gid's */
|
||||||
status = -EINVAL;
|
status = -EINVAL;
|
||||||
for (i=0; i<N; i++) {
|
for (i=0; i<N; i++) {
|
||||||
gid_t gid;
|
|
||||||
kgid_t kgid;
|
kgid_t kgid;
|
||||||
if (get_int(&mesg, &gid))
|
if (get_int(&mesg, &id))
|
||||||
goto out;
|
goto out;
|
||||||
kgid = make_kgid(&init_user_ns, gid);
|
kgid = make_kgid(&init_user_ns, id);
|
||||||
if (!gid_valid(kgid))
|
if (!gid_valid(kgid))
|
||||||
goto out;
|
goto out;
|
||||||
GROUP_AT(rsci.cred.cr_group_info, i) = kgid;
|
GROUP_AT(rsci.cred.cr_group_info, i) = kgid;
|
||||||
|
|
Loading…
Add table
Reference in a new issue