Signed-off-by: Greg Farnum <gfarnum@redhat.com>
}
// check permissions before doing anything else
- if (!in->check_mode(perms.uid(), groups, want))
+ if (!in->check_mode(perms, want))
return -EACCES;
return 0;
}
return dir;
}
-bool Inode::check_mode(uid_t ruid, UserGroups& groups, unsigned want)
+bool Inode::check_mode(const UserPerm& perms, unsigned want)
{
- if (uid == ruid) {
+ if (uid == perms.uid()) {
// if uid is owner, owner entry determines access
want = want << 6;
- } else if (groups.is_in(gid)) {
+ } else if (perms.gid_in_groups(gid)) {
// if a gid or sgid matches the owning group, group entry determines access
want = want << 3;
}
}
};
- bool check_mode(uid_t uid, UserGroups& groups, unsigned want);
+ bool check_mode(const UserPerm& perms, unsigned want);
// CAPS --------
void get_open_ref(int mode);