}
}
-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)
#include "osdc/ObjectCacher.h"
#include "InodeRef.h"
-#include "UserGroups.h"
#include "UserPerm.h"
class FSMap;
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,
#include "Dir.h"
#include "MetaSession.h"
#include "ClientSnapRealm.h"
-#include "UserGroups.h"
#include "mds/flock.h"
struct Inode;
class ceph_lock_state_t;
class MetaRequest;
-class UserGroups;
class filepath;
struct Cap {
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
+++ /dev/null
-#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