mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
Allow creation of buckets starting with underscore in RGW
Signed-off-by caleb miles <caleb.miles@inktank.com>
This commit is contained in:
parent
debce05510
commit
be6961bd28
@ -573,6 +573,7 @@ OPTION(rgw_extended_http_attrs, OPT_STR, "") // list of extended attrs that can
|
||||
OPTION(rgw_exit_timeout_secs, OPT_INT, 120) // how many seconds to wait for process to go down before exiting unconditionally
|
||||
OPTION(rgw_get_obj_window_size, OPT_INT, 16 << 20) // window size in bytes for single get obj request
|
||||
OPTION(rgw_get_obj_max_req_size, OPT_INT, 4 << 20) // max length of a single get obj rados op
|
||||
OPTION(rgw_relaxed_s3_bucket_names, OPT_BOOL, false) // enable relaxed bucket name rules for US region buckets
|
||||
|
||||
OPTION(mutex_perf_counter, OPT_BOOL, false) // enable/disable mutex perf counter
|
||||
|
||||
|
@ -1742,7 +1742,7 @@ static bool looks_like_ip_address(const char *bucket)
|
||||
return (num_periods == 3);
|
||||
}
|
||||
|
||||
int RGWHandler_ObjStore_S3::validate_bucket_name(const string& bucket)
|
||||
int RGWHandler_ObjStore_S3::validate_bucket_name(const string& bucket, bool relaxed_names)
|
||||
{
|
||||
int ret = RGWHandler_ObjStore::validate_bucket_name(bucket);
|
||||
if (ret < 0)
|
||||
@ -1751,10 +1751,13 @@ int RGWHandler_ObjStore_S3::validate_bucket_name(const string& bucket)
|
||||
if (bucket.size() == 0)
|
||||
return 0;
|
||||
|
||||
// bucket names must start with a number, letter, or underscore
|
||||
if (!(isalpha(bucket[0]) || isdigit(bucket[0]))) {
|
||||
// bucket names must start with a number or letter
|
||||
return -ERR_INVALID_BUCKET_NAME;
|
||||
}
|
||||
if (!relaxed_names)
|
||||
return -ERR_INVALID_BUCKET_NAME;
|
||||
else if (!(bucket[0] == '_' || bucket[0] == '.' || bucket[0] == '-'))
|
||||
return -ERR_INVALID_BUCKET_NAME;
|
||||
}
|
||||
|
||||
for (const char *s = bucket.c_str(); *s; ++s) {
|
||||
char c = *s;
|
||||
@ -1778,7 +1781,8 @@ int RGWHandler_ObjStore_S3::init(RGWRados *store, struct req_state *s, RGWClient
|
||||
{
|
||||
dout(10) << "s->object=" << (s->object ? s->object : "<NULL>") << " s->bucket=" << (s->bucket_name ? s->bucket_name : "<NULL>") << dendl;
|
||||
|
||||
int ret = validate_bucket_name(s->bucket_name_str);
|
||||
bool relaxed_names = s->cct->_conf->rgw_relaxed_s3_bucket_names;
|
||||
int ret = validate_bucket_name(s->bucket_name_str, relaxed_names);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = validate_object_name(s->object_str);
|
||||
|
@ -261,7 +261,10 @@ public:
|
||||
RGWHandler_Auth_S3() : RGWHandler_ObjStore() {}
|
||||
virtual ~RGWHandler_Auth_S3() {}
|
||||
|
||||
virtual int validate_bucket_name(const string& bucket) { return 0; }
|
||||
virtual int validate_bucket_name(const string& bucket) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual int validate_object_name(const string& bucket) { return 0; }
|
||||
|
||||
virtual int init(RGWRados *store, struct req_state *state, RGWClientIO *cio);
|
||||
@ -278,7 +281,7 @@ public:
|
||||
RGWHandler_ObjStore_S3() : RGWHandler_ObjStore() {}
|
||||
virtual ~RGWHandler_ObjStore_S3() {}
|
||||
|
||||
int validate_bucket_name(const string& bucket);
|
||||
int validate_bucket_name(const string& bucket, bool relaxed_names);
|
||||
|
||||
virtual int init(RGWRados *store, struct req_state *state, RGWClientIO *cio);
|
||||
virtual int authorize() {
|
||||
|
Loading…
Reference in New Issue
Block a user