]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: switch Inode::check_mode() to UserPerm
authorGreg Farnum <gfarnum@redhat.com>
Wed, 3 Aug 2016 21:57:02 +0000 (14:57 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:55 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Inode.cc
src/client/Inode.h

index e3e2e374c336c5ae18371fbe4ca90849a9210b1c..dc05c98426bc367b40293ac00a89a938b2e0e0d2 100644 (file)
@@ -5035,7 +5035,7 @@ int Client::inode_permission(Inode *in, const UserPerm& perms, unsigned want)
   }
 
   // check permissions before doing anything else
-  if (!in->check_mode(perms.uid(), groups, want))
+  if (!in->check_mode(perms, want))
     return -EACCES;
   return 0;
 }
index 06e111c19b3fbb7107f31b9cd35061e9e7e0ba54..0a324aa637d89a47f489703e9836fa4e8bd7f7a6 100644 (file)
@@ -331,12 +331,12 @@ Dir *Inode::open_dir()
   return dir;
 }
 
-bool Inode::check_mode(uid_t ruid, UserGroups& groups, unsigned want)
+bool Inode::check_mode(const UserPerm& perms, unsigned want)
 {
-  if (uid == ruid) {
+  if (uid == perms.uid()) {
     // if uid is owner, owner entry determines access
     want = want << 6;
-  } else if (groups.is_in(gid)) {
+  } else if (perms.gid_in_groups(gid)) {
     // if a gid or sgid matches the owning group, group entry determines access
     want = want << 3;
   }
index 2c74b8b1e641180f0aac3030952e1ef3044981e9..de07ff210200d3e10414b26a737930beb572d7fb 100644 (file)
@@ -260,7 +260,7 @@ struct Inode {
     }
   };
 
-  bool check_mode(uid_t uid, UserGroups& groups, unsigned want);
+  bool check_mode(const UserPerm& perms, unsigned want);
 
   // CAPS --------
   void get_open_ref(int mode);