]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: pass UserPerm to readlink()
authorGreg Farnum <gfarnum@redhat.com>
Wed, 3 Aug 2016 05:14:14 +0000 (22:14 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:52 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.cc
src/client/Client.h
src/client/SyntheticClient.cc
src/libcephfs.cc

index 50a5744bb525ad2c85ee6a98cdc8cafb579b368b..7d0466c57043cd336de0cdacda2c339eadd95906 100644 (file)
@@ -6326,7 +6326,7 @@ int Client::symlink(const char *target, const char *relpath)
   return _symlink(dir.get(), name.c_str(), target, perms);
 }
 
-int Client::readlink(const char *relpath, char *buf, loff_t size
+int Client::readlink(const char *relpath, char *buf, loff_t size, const UserPerm& perms)
 {
   Mutex::Locker lock(client_lock);
   tout(cct) << "readlink" << std::endl;
@@ -6334,7 +6334,7 @@ int Client::readlink(const char *relpath, char *buf, loff_t size)
 
   filepath path(relpath);
   InodeRef in;
-  int r = path_walk(path, &in, false);
+  int r = path_walk(path, &in, perms, false);
   if (r < 0)
     return r;
 
index 87ad54f984ac898d1c435237f53405ecbae181ac..1f47b620c4609a97767a25185485d73f9a9ac8f0 100644 (file)
@@ -1093,7 +1093,7 @@ public:
   int rmdir(const char *path);
 
   // symlinks
-  int readlink(const char *path, char *buf, loff_t size);
+  int readlink(const char *path, char *buf, loff_t size, const UserPerm& perms);
 
   int symlink(const char *existing, const char *newname);
 
index f525b95efd83188f82e09a13dca770a554eb3270..837d06737100571c294632d14666a5683c8f691c 100644 (file)
@@ -1096,7 +1096,7 @@ int SyntheticClient::play_trace(Trace& t, string& prefix, bool metadata_only)
     } else if (strcmp(op, "readlink") == 0) {
       const char *a = t.get_string(buf, p);
       char buf[100];
-      client->readlink(a, buf, 100);
+      client->readlink(a, buf, 100, perms);
     } else if (strcmp(op, "lstat") == 0) {
       struct stat st;
       const char *a = t.get_string(buf, p);
index 97db35758b397037ed9fc00dece3890f472e285f..6d3c0c1f9f1a282ea1e9a726cbbfb5ef17a03d92 100644 (file)
@@ -599,7 +599,8 @@ extern "C" int ceph_readlink(struct ceph_mount_info *cmount, const char *path,
 {
   if (!cmount->is_mounted())
     return -ENOTCONN;
-  return cmount->get_client()->readlink(path, buf, size);
+  UserPerm perms = cmount->get_client()->pick_my_perms();
+  return cmount->get_client()->readlink(path, buf, size, perms);
 }
 
 extern "C" int ceph_symlink(struct ceph_mount_info *cmount, const char *existing,