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
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)
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;
{
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);
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);
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() {