if (acl_type == POSIX_ACL) {
if (in->xattrs.count(ACL_EA_ACCESS)) {
const bufferptr& access_acl = in->xattrs[ACL_EA_ACCESS];
- RequestUserGroups groups(perms.uid(), perms.gid());
- init_groups(&groups);
- return posix_acl_permits(access_acl, in->uid, in->gid, perms.uid(), groups, want);
+ return posix_acl_permits(access_acl, in->uid, in->gid, perms, want);
}
}
return -EAGAIN;
#include "include/types.h"
#include <sys/stat.h>
#include "posix_acl.h"
-#include "UserGroups.h"
+#include "UserPerm.h"
#ifndef ACCESSPERMS
#define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO)
}
int posix_acl_permits(const bufferptr& acl, uid_t i_uid, gid_t i_gid,
- uid_t uid, UserGroups& groups, unsigned want)
+ const UserPerm& perms, unsigned want)
{
if (posix_acl_check(acl.c_str(), acl.length()) < 0)
return -EIO;
perm = entry->e_perm;
switch(tag) {
case ACL_USER_OBJ:
- if (i_uid == uid)
+ if (i_uid == perms.uid())
goto check_perm;
break;
case ACL_USER:
id = entry->e_id;
- if (id == uid)
+ if (id == perms.uid())
goto check_mask;
break;
case ACL_GROUP_OBJ:
/* fall through */
case ACL_GROUP:
id = (tag == ACL_GROUP_OBJ) ? i_gid : entry->e_id;
- if (groups.is_in(id)) {
+ if (perms.gid_in_groups(id)) {
group_found = 1;
if ((perm & want) == want)
goto check_mask;
acl_ea_entry a_entries[0];
} acl_ea_header;
-class UserGroups;
+class UserPerm;
int posix_acl_check(const void *xattr, size_t size);
int posix_acl_equiv_mode(const void *xattr, size_t size, mode_t *mode_p);
int posix_acl_inherit_mode(bufferptr& acl, mode_t *mode_p);
int posix_acl_access_chmod(bufferptr& acl, mode_t mode);
int posix_acl_permits(const bufferptr& acl, uid_t i_uid, gid_t i_gid,
- uid_t uid, UserGroups& groups, unsigned want);
+ const UserPerm& groups, unsigned want);
#endif