Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 306003
b: refs/heads/master
c: 72cda3d
h: refs/heads/master
i:
  306001: a681fcc
  305999: d2e1bb2
v: v3
  • Loading branch information
Eric W. Biederman committed May 3, 2012
1 parent bd4260d commit 39fb951
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 92361636e0153bd0cb22e7dfe3fc6287f6537c66
refs/heads/master: 72cda3d1ef24ab0a9a89c15e9776ca737b75f45a
4 changes: 2 additions & 2 deletions trunk/include/linux/cred.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ extern int groups_search(const struct group_info *, kgid_t);
#define GROUP_AT(gi, i) \
((gi)->blocks[(i) / NGROUPS_PER_BLOCK][(i) % NGROUPS_PER_BLOCK])

extern int in_group_p(gid_t);
extern int in_egroup_p(gid_t);
extern int in_group_p(kgid_t);
extern int in_egroup_p(kgid_t);

/*
* The common credentials for a thread group
Expand Down
14 changes: 6 additions & 8 deletions trunk/kernel/groups.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,27 +256,25 @@ SYSCALL_DEFINE2(setgroups, int, gidsetsize, gid_t __user *, grouplist)
/*
* Check whether we're fsgid/egid or in the supplemental group..
*/
int in_group_p(gid_t grp)
int in_group_p(kgid_t grp)
{
const struct cred *cred = current_cred();
int retval = 1;

if (grp != cred->fsgid)
retval = groups_search(cred->group_info,
make_kgid(cred->user_ns, grp));
if (!gid_eq(grp, cred->fsgid))
retval = groups_search(cred->group_info, grp);
return retval;
}

EXPORT_SYMBOL(in_group_p);

int in_egroup_p(gid_t grp)
int in_egroup_p(kgid_t grp)
{
const struct cred *cred = current_cred();
int retval = 1;

if (grp != cred->egid)
retval = groups_search(cred->group_info,
make_kgid(cred->user_ns, grp));
if (!gid_eq(grp, cred->egid))
retval = groups_search(cred->group_info, grp);
return retval;
}

Expand Down

0 comments on commit 39fb951

Please sign in to comment.