From: Greg Farnum Date: Wed, 3 Aug 2016 22:48:48 +0000 (-0700) Subject: client: stop using UserGroups for may_setattr() now that UserPerm does it all X-Git-Tag: v11.0.1~36^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=94c35ab3707cff779e04a28fbffba2a8c166cd88;p=ceph.git client: stop using UserGroups for may_setattr() now that UserPerm does it all Signed-off-by: Greg Farnum --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 35f545ce9ffa..20818a1c3039 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -5058,9 +5058,6 @@ out: int Client::may_setattr(Inode *in, struct stat *st, int mask, const UserPerm& perms) { - RequestUserGroups groups(perms.uid(), perms.gid()); - init_groups(&groups); - int r = _getattr_for_perm(in, perms); if (r < 0) goto out; @@ -5078,7 +5075,7 @@ int Client::may_setattr(Inode *in, struct stat *st, int mask, const UserPerm& pe } if (mask & CEPH_SETATTR_GID) { if (perms.uid() != 0 && (perms.uid() != in->uid || - (!groups.is_in(st->st_gid) && st->st_gid != in->gid))) + (!perms.gid_in_groups(st->st_gid) && st->st_gid != in->gid))) goto out; } @@ -5087,7 +5084,7 @@ int Client::may_setattr(Inode *in, struct stat *st, int mask, const UserPerm& pe goto out; gid_t i_gid = (mask & CEPH_SETATTR_GID) ? st->st_gid : in->gid; - if (perms.uid() != 0 && !groups.is_in(i_gid)) + if (perms.uid() != 0 && !perms.gid_in_groups(i_gid)) st->st_mode &= ~S_ISGID; }