]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds/MDSAuthCaps: add permissions for user bits
authorNishtha Rai <nishtha3rai@gmail.com>
Mon, 20 Jul 2015 14:01:25 +0000 (19:31 +0530)
committerSage Weil <sage@redhat.com>
Thu, 1 Oct 2015 13:39:32 +0000 (09:39 -0400)
Signed-off-by: Nishtha Rai <nishtha3rai@gmail.com>
src/mds/MDSAuthCaps.cc

index bf0d0f12a47792a7743bd52471856ce4a721e152..89c61d1285e3785397f06978a9330f3de2689ff7 100644 (file)
@@ -154,10 +154,18 @@ bool MDSAuthCaps::is_capable(const std::string &inode_path,
         return true;
       }
 
-      if ((!(mask & MAY_READ) || (inode_mode & S_IROTH)) &&
-      (!(mask & MAY_WRITE) || (inode_mode & S_IWOTH)) &&
-      (!(mask & MAY_EXECUTE) || (inode_mode & S_IXOTH))) {
-        return true;
+      if (inode_uid == uid) {
+        if ((!(mask & MAY_READ) || (inode_mode & S_IRUSR)) &&
+          (!(mask & MAY_WRITE) || (inode_mode & S_IWUSR)) &&
+          (!(mask & MAY_EXECUTE) || (inode_mode & S_IXUSR))) {
+          return true;
+        }
+      } else {
+        if ((!(mask & MAY_READ) || (inode_mode & S_IROTH)) &&
+          (!(mask & MAY_WRITE) || (inode_mode & S_IWOTH)) &&
+          (!(mask & MAY_EXECUTE) || (inode_mode & S_IXOTH))) {
+          return true;
+        }
       }
 
          // use fcntl.h macros for the file mode: