]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
fuse: wire up fuse_ll_access 21181/head
authorJeff Layton <jlayton@redhat.com>
Mon, 2 Apr 2018 13:20:41 +0000 (09:20 -0400)
committerJeff Layton <jlayton@redhat.com>
Tue, 10 Apr 2018 14:06:33 +0000 (10:06 -0400)
This gets called during chdir and is currently a no-op. Make sure we
check permissions appropriately.

Tracker: http://tracker.ceph.com/issues/23509
Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/client/Client.h
src/client/fuse_ll.cc

index 0f69bdfa503a3749cc35d69b1e60db160830cdbc..63030589a186a7ff74b776f5475c4f2382ba7948 100644 (file)
@@ -860,7 +860,6 @@ private:
     MAY_READ = 4,
   };
 
-  int inode_permission(Inode *in, const UserPerm& perms, unsigned want);
   int xattr_permission(Inode *in, const char *name, unsigned want,
                       const UserPerm& perms);
   int may_setattr(Inode *in, struct ceph_statx *stx, int mask,
@@ -1124,6 +1123,9 @@ public:
   int mksnap(const char *path, const char *name, const UserPerm& perm);
   int rmsnap(const char *path, const char *name, const UserPerm& perm);
 
+  // Inode permission checking
+  int inode_permission(Inode *in, const UserPerm& perms, unsigned want);
+
   // expose caps
   int get_caps_issued(int fd);
   int get_caps_issued(const char *path, const UserPerm& perms);
index a6e5b238a88e89cdc703534f2711a27674902304..86f91d31b2306a5246023fa7f5ef89f26d4f4c71 100644 (file)
@@ -766,7 +766,15 @@ static void fuse_ll_fsyncdir(fuse_req_t req, fuse_ino_t ino, int datasync,
 
 static void fuse_ll_access(fuse_req_t req, fuse_ino_t ino, int mask)
 {
-  fuse_reply_err(req, 0);
+  CephFuse::Handle *cfuse = fuse_ll_req_prepare(req);
+  const struct fuse_ctx *ctx = fuse_req_ctx(req);
+  Inode *in = cfuse->iget(ino);
+  UserPerm perms(ctx->uid, ctx->gid);
+  get_fuse_groups(perms, req);
+
+  int r = cfuse->client->inode_permission(in, perms, mask);
+  fuse_reply_err(req, -r);
+  cfuse->iput(in);
 }
 
 static void fuse_ll_create(fuse_req_t req, fuse_ino_t parent, const char *name,