using rgw::IAM::Policy;
using rgw::IAM::Policy;
+using rgw::IAM::PublicAccessConfiguration;
static string mp_ns = RGW_OBJ_NS_MULTIPART;
static string shadow_ns = RGW_OBJ_NS_SHADOW;
}
}
+static boost::optional<PublicAccessConfiguration>
+get_public_access_conf_from_attr(const map<string, bufferlist>& attrs)
+{
+ if (auto aiter = attrs.find(RGW_ATTR_PUBLIC_ACCESS);
+ aiter != attrs.end())
+ {
+ bufferlist::const_iterator iter{&aiter->second};
+ PublicAccessConfiguration access_conf;
+ try {
+ access_conf.decode(iter);
+ } catch (const buffer::error& e) {
+ return boost::none;
+ }
+ return access_conf;
+ }
+ return boost::none;
+}
+
vector<Policy> get_iam_user_policy_from_attr(CephContext* cct,
rgw::sal::RGWRadosStore* store,
map<string, bufferlist>& attrs,
}
}
+ auto access_conf = get_public_access_conf_from_attr(s->bucket_attrs);
+ if (access_conf && access_conf->block_public_acls()) {
+ if (s->canned_acl.compare("public-read") ||
+ s->canned_acl.compare("public-read-write") ||
+ s->canned_acl.compare("authenticated-read"))
+ return -EACCES;
+ }
+
auto op_ret = get_params();
if (op_ret < 0) {
ldpp_dout(this, 20) << "get_params() returned ret=" << op_ret << dendl;