From: Greg Farnum Date: Thu, 1 Sep 2016 23:27:38 +0000 (-0700) Subject: client: add a static pick_my_perms taking a CephContext X-Git-Tag: v11.0.1~36^2~12 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5a1b9f84c06771080fa883747e92328fa7803f41;p=ceph.git client: add a static pick_my_perms taking a CephContext Signed-off-by: Greg Farnum --- diff --git a/src/client/Client.h b/src/client/Client.h index 72f74dc4487..6d80b4afecd 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -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; diff --git a/src/libcephfs.cc b/src/libcephfs.cc index 1960f0a93cf..6f7582d17dc 100644 --- a/src/libcephfs.cc +++ b/src/libcephfs.cc @@ -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); }