This commit is contained in:
parent
6e52474953
commit
51cb2c0b9a
@ -43,17 +43,24 @@ auto fuse_drive_base::check_access(const std::string &api_path,
|
|||||||
|
|
||||||
// Always allow root
|
// Always allow root
|
||||||
auto current_uid = get_current_uid();
|
auto current_uid = get_current_uid();
|
||||||
if (current_uid != 0) {
|
if (current_uid == 0) {
|
||||||
|
return api_error::success;
|
||||||
|
}
|
||||||
|
|
||||||
// Always allow forced user
|
// Always allow forced user
|
||||||
if (not forced_uid_.has_value() || (current_uid != get_effective_uid())) {
|
if (forced_uid_.has_value() || (current_uid == get_effective_uid())) {
|
||||||
|
return api_error::success;
|
||||||
|
}
|
||||||
|
|
||||||
// Always allow if checking file exists
|
// Always allow if checking file exists
|
||||||
if (F_OK != mask) {
|
if (F_OK == mask) {
|
||||||
|
return api_error::success;
|
||||||
|
}
|
||||||
|
|
||||||
const auto effective_uid =
|
const auto effective_uid =
|
||||||
(forced_uid_.has_value() ? forced_uid_.value()
|
(forced_uid_.has_value() ? forced_uid_.value() : get_uid_from_meta(meta));
|
||||||
: get_uid_from_meta(meta));
|
|
||||||
const auto effective_gid =
|
const auto effective_gid =
|
||||||
(forced_gid_.has_value() ? forced_gid_.value()
|
(forced_gid_.has_value() ? forced_gid_.value() : get_gid_from_meta(meta));
|
||||||
: get_gid_from_meta(meta));
|
|
||||||
|
|
||||||
// Create file mode
|
// Create file mode
|
||||||
mode_t effective_mode =
|
mode_t effective_mode =
|
||||||
@ -101,9 +108,6 @@ auto fuse_drive_base::check_access(const std::string &api_path,
|
|||||||
// Deny access if effective mode is 0
|
// Deny access if effective mode is 0
|
||||||
return api_error::access_denied;
|
return api_error::access_denied;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return api_error::success;
|
return api_error::success;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user