// drop ..
}
-bool MDSCapMatch::match(string_view target_path,
+bool MDSCapMatch::match(string_view fs_name,
+ string_view target_path,
const int caller_uid,
const int caller_gid,
const vector<uint64_t> *caller_gid_list) const
{
+ if (!match_fs(fs_name)) {
+ return false;
+ }
+
if (uid != MDS_AUTH_UID_ANY) {
if (uid != caller_uid)
return false;
* This is true if any of the 'grant' clauses in the capability match the
* requested path + op.
*/
-bool MDSAuthCaps::is_capable(string_view inode_path,
+bool MDSAuthCaps::is_capable(string_view fs_name,
+ string_view inode_path,
uid_t inode_uid, gid_t inode_gid,
unsigned inode_mode,
uid_t caller_uid, gid_t caller_gid,
uid_t new_uid, gid_t new_gid,
const entity_addr_t& addr) const
{
- ldout(g_ceph_context, 10) << __func__ << " inode(path /" << inode_path
+ ldout(g_ceph_context, 10) << __func__ << "fs_name " << fs_name << " inode(path /" << inode_path
<< " owner " << inode_uid << ":" << inode_gid
<< " mode 0" << std::oct << inode_mode << std::dec
<< ") by caller " << caller_uid << ":" << caller_gid
continue;
}
- if (grant.match.match(inode_path, caller_uid, caller_gid, caller_gid_list) &&
+ if (grant.match.match(fs_name, inode_path, caller_uid, caller_gid, caller_gid_list) &&
grant.spec.allows(mask & (MAY_READ|MAY_EXECUTE), mask & MAY_WRITE)) {
if (grant.match.root_squash && ((caller_uid == 0) || (caller_gid == 0)) &&
(mask & MAY_WRITE)) {
}
// check whether this grant matches against a given file and caller uid:gid
- bool match(std::string_view target_path,
+ bool match(std::string_view fs_name,
+ std::string_view target_path,
const int caller_uid,
const int caller_gid,
const std::vector<uint64_t> *caller_gid_list) const;
bool merge(MDSAuthCaps newcaps);
bool allow_all() const;
- bool is_capable(std::string_view inode_path,
+ bool is_capable(std::string_view fs_name,
+ std::string_view inode_path,
uid_t inode_uid, gid_t inode_gid, unsigned inode_mode,
uid_t uid, gid_t gid, const std::vector<uint64_t> *caller_gid_list,
unsigned mask, uid_t new_uid, gid_t new_gid,
bool Server::check_access(const MDRequestRef& mdr, CInode *in, unsigned mask)
{
if (mdr->session) {
+ std::string_view fs_name = mds->mdsmap->get_fs_name();
int r = mdr->session->check_access(
- in, mask,
+ fs_name, in, mask,
mdr->client_request->get_caller_uid(),
mdr->client_request->get_caller_gid(),
&mdr->client_request->get_caller_gid_list(),
_update_human_name();
}
-int Session::check_access(CInode *in, unsigned mask,
+int Session::check_access(std::string_view fs_name, CInode *in, unsigned mask,
int caller_uid, int caller_gid,
const vector<uint64_t> *caller_gid_list,
int new_uid, int new_gid)
return -EIO;
}
- if (!auth_caps.is_capable(path, inode->uid, inode->gid, inode->mode,
+ if (!auth_caps.is_capable(fs_name, path, inode->uid, inode->gid, inode->mode,
caller_uid, caller_gid, caller_gid_list, mask,
new_uid, new_gid,
info.inst.addr)) {
completed_requests_dirty = false;
}
- int check_access(CInode *in, unsigned mask, int caller_uid, int caller_gid,
+ int check_access(std::string_view fs_name, CInode *in, unsigned mask, int caller_uid, int caller_gid,
const std::vector<uint64_t> *gid_list, int new_uid, int new_gid);
bool fs_name_capable(std::string_view fs_name, unsigned mask) const {