From: Greg Farnum Date: Wed, 3 Aug 2016 22:51:01 +0000 (-0700) Subject: client: remove the now-unused UserGroups entirely X-Git-Tag: v11.0.1~36^2~16 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=07d6fc0309a9f653423360c6d8400144d00affdb;p=ceph.git client: remove the now-unused UserGroups entirely Signed-off-by: Greg Farnum --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 20818a1c303..85df5afb614 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -12497,35 +12497,11 @@ void Client::handle_conf_change(const struct md_config_t *conf, } } -void Client::init_groups(RequestUserGroups *groups) +void Client::init_groups(UserPerm *perms) { gid_t *sgids; - int count = _getgrouplist(&sgids, groups->get_uid(), groups->get_gid()); - groups->init_gids(sgids, count); -} - -bool Client::RequestUserGroups::is_in(gid_t id) -{ - assert(sgid_count >= 0); - if (id == gid) - return true; - for (int i = 0; i < sgid_count; ++i) { - if (id == sgids[i]) - return true; - } - return false; -} - -int Client::RequestUserGroups::get_gids(const gid_t **out) -{ - assert(sgid_count >= 0); - if (sgid_count > 0) { - *out = sgids; - return sgid_count; - } else { - *out = &gid; - return 1; - } + int count = _getgrouplist(&sgids, perms->uid(), perms->gid()); + perms->init_gids(sgids, count); } void intrusive_ptr_add_ref(Inode *in) diff --git a/src/client/Client.h b/src/client/Client.h index 6b4ea038587..72f74dc4487 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -46,7 +46,6 @@ using std::fstream; #include "osdc/ObjectCacher.h" #include "InodeRef.h" -#include "UserGroups.h" #include "UserPerm.h" class FSMap; @@ -822,29 +821,7 @@ private: MAY_READ = 4, }; - class RequestUserGroups : public UserGroups { - uid_t uid; - gid_t gid; - int sgid_count; - gid_t *sgids; - public: - RequestUserGroups(uid_t u, gid_t g) : - uid(u), gid(g), sgid_count(-1), sgids(NULL) {} - ~RequestUserGroups() { - free(sgids); - } - bool is_init() { return sgid_count < 0; } - void init_gids(gid_t *_sgids, int count) { - sgids = _sgids; - sgid_count = count; - } - uid_t get_uid() { return uid; } - gid_t get_gid() { return gid; } - bool is_in(gid_t id); - int get_gids(const gid_t **out); - }; - friend class RequestUserGroups; - void init_groups(RequestUserGroups *groups); + void init_groups(UserPerm *groups); int inode_permission(Inode *in, const UserPerm& perms, unsigned want); int xattr_permission(Inode *in, const char *name, unsigned want, diff --git a/src/client/Inode.cc b/src/client/Inode.cc index 0a324aa637d..e2acb54063b 100644 --- a/src/client/Inode.cc +++ b/src/client/Inode.cc @@ -7,7 +7,6 @@ #include "Dir.h" #include "MetaSession.h" #include "ClientSnapRealm.h" -#include "UserGroups.h" #include "mds/flock.h" diff --git a/src/client/Inode.h b/src/client/Inode.h index de07ff21020..cd331c72c07 100644 --- a/src/client/Inode.h +++ b/src/client/Inode.h @@ -23,7 +23,6 @@ struct SnapRealm; struct Inode; class ceph_lock_state_t; class MetaRequest; -class UserGroups; class filepath; struct Cap { diff --git a/src/client/Makefile.am b/src/client/Makefile.am index 5776f526ef0..312676a306f 100644 --- a/src/client/Makefile.am +++ b/src/client/Makefile.am @@ -26,8 +26,7 @@ noinst_HEADERS += \ client/ioctl.h \ client/ObjecterWriteback.h \ client/posix_acl.h \ - client/UserPerm.h \ - client/UserGroups.h + client/UserPerm.h if WITH_FUSE libclient_fuse_la_SOURCES = client/fuse_ll.cc diff --git a/src/client/UserGroups.h b/src/client/UserGroups.h deleted file mode 100644 index 3a3966f2f81..00000000000 --- a/src/client/UserGroups.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef CEPH_CLIENT_USERGROUPS_H -#define CEPH_CLIENT_USERGROUPS_H - -class UserGroups { -public: - virtual bool is_in(gid_t gid) = 0; - virtual gid_t get_gid() = 0; - virtual int get_gids(const gid_t **gids) = 0; - virtual ~UserGroups() {}; -}; - -#endif