]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: add a static pick_my_perms taking a CephContext
authorGreg Farnum <gfarnum@redhat.com>
Thu, 1 Sep 2016 23:27:38 +0000 (16:27 -0700)
committerGreg Farnum <gfarnum@redhat.com>
Wed, 21 Sep 2016 23:33:57 +0000 (16:33 -0700)
Signed-off-by: Greg Farnum <gfarnum@redhat.com>
src/client/Client.h
src/libcephfs.cc

index 72f74dc44879a6b25976719c7b5261be9a7c690b..6d80b4afecd185ac3c603f089ba824a9be943d2b 100644 (file)
@@ -298,6 +298,11 @@ public:
     return UserPerm(uid, gid);
   }
 
+  static UserPerm pick_my_perms(CephContext *c) {
+    uid_t uid = c->_conf->client_mount_uid >= 0 ? c->_conf->client_mount_uid : ::geteuid();
+    gid_t gid = c->_conf->client_mount_gid >= 0 ? c->_conf->client_mount_gid : ::getegid();
+    return UserPerm(uid, gid);
+  }
 protected:
   MonClient *monclient;
   Messenger *messenger;  
index 1960f0a93cf0e0069154123db5ba08f8727897d6..6f7582d17dc769f57924ef9128f2e376a537d9d6 100644 (file)
@@ -427,7 +427,7 @@ extern "C" int ceph_mount(struct ceph_mount_info *cmount, const char *root)
   std::string mount_root;
   if (root)
     mount_root = root;
-  UserPerm perms = cmount->get_client()->pick_my_perms();
+  UserPerm perms = Client::pick_my_perms(cmount->get_ceph_context());
   return cmount->mount(mount_root, perms);
 }