]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: stop using UserGroups for posix ACL checks
authorGreg Farnum <gfarnum@redhat.com>
Wed, 3 Aug 2016 22:27:34 +0000 (15:27 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:56 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/posix_acl.cc
src/client/posix_acl.h

index 31b4e0cbff8ff5dbd5ac91c6a880ebea6aff14b4..35f545ce9ffa90a0a57118a037416548c7b466f3 100644 (file)
@@ -12363,10 +12363,8 @@ int Client::_posix_acl_permission(Inode *in, const UserPerm& perms, unsigned wan
   if (acl_type == POSIX_ACL) {
     if (in->xattrs.count(ACL_EA_ACCESS)) {
       const bufferptr& access_acl = in->xattrs[ACL_EA_ACCESS];
-      RequestUserGroups groups(perms.uid(), perms.gid());
-      init_groups(&groups);
 
-      return posix_acl_permits(access_acl, in->uid, in->gid, perms.uid(), groups, want);
+      return posix_acl_permits(access_acl, in->uid, in->gid, perms, want);
     }
   }
   return -EAGAIN;
index d92d17a8f8582a911816c5e2c506bdba0170d7cf..e6331ed294c2cd598408f066b59b08755691a5e3 100644 (file)
@@ -1,7 +1,7 @@
 #include "include/types.h"
 #include <sys/stat.h>
 #include "posix_acl.h"
-#include "UserGroups.h"
+#include "UserPerm.h"
 
 #ifndef ACCESSPERMS
 #define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
@@ -220,7 +220,7 @@ int posix_acl_access_chmod(bufferptr& acl, mode_t mode)
 }
 
 int posix_acl_permits(const bufferptr& acl, uid_t i_uid, gid_t i_gid,
-                        uid_t uid, UserGroups& groups, unsigned want)
+                        const UserPerm& perms, unsigned want)
 {
   if (posix_acl_check(acl.c_str(), acl.length()) < 0)
     return -EIO;
@@ -238,19 +238,19 @@ int posix_acl_permits(const bufferptr& acl, uid_t i_uid, gid_t i_gid,
     perm = entry->e_perm;
     switch(tag) {
       case ACL_USER_OBJ:
-       if (i_uid == uid)
+       if (i_uid == perms.uid())
          goto check_perm;
        break;
       case ACL_USER:
        id = entry->e_id;
-       if (id == uid)
+       if (id == perms.uid())
          goto check_mask;
        break;
       case ACL_GROUP_OBJ:
        /* fall through */
       case ACL_GROUP:
        id = (tag == ACL_GROUP_OBJ) ? i_gid : entry->e_id;
-       if (groups.is_in(id)) {
+       if (perms.gid_in_groups(id)) {
          group_found = 1;
          if ((perm & want) == want)
            goto check_mask;
index d9c5cc854bd90599c485788ada9194fd2d466d34..4afcc3fe2e1e66b2a03a37d36b31f34a16b3b33d 100644 (file)
@@ -24,12 +24,12 @@ typedef struct {
   acl_ea_entry    a_entries[0];
 } acl_ea_header;
 
-class UserGroups;
+class UserPerm;
 
 int posix_acl_check(const void *xattr, size_t size);
 int posix_acl_equiv_mode(const void *xattr, size_t size, mode_t *mode_p);
 int posix_acl_inherit_mode(bufferptr& acl, mode_t *mode_p);
 int posix_acl_access_chmod(bufferptr& acl, mode_t mode);
 int posix_acl_permits(const bufferptr& acl, uid_t i_uid, gid_t i_gid,
-                     uid_t uid, UserGroups& groups, unsigned want);
+                     const UserPerm& groups, unsigned want);
 #endif