Swift containers are declared in the upstream documentation as 1-256
bytes of UTF-8, and the only forbidden character is '/'.
We did not previously enforce the no-slash rule.
Also ensure that the common validate_bucket_name does not permit '/' or
0xFF either (it's also banned in S3).
See-Also: https://docs.openstack.org/developer/swift/api/object_api_v1_overview.html
Fixes: http://tracker.ceph.com/issues/19264
Backport: hammer, jewel
Signed-off-by: Robin H. Johnson <robin.johnson@dreamhost.com>
return -ERR_INVALID_BUCKET_NAME;
}
+ const char *s = bucket.c_str();
+ for (int i = 0; i < len; ++i, ++s) {
+ if (*(unsigned char *)s == 0xff)
+ return -ERR_INVALID_BUCKET_NAME;
+ if (*(unsigned char *)s == '/')
+ return -ERR_INVALID_BUCKET_NAME;
+ }
+
return 0;
}
for (int i = 0; i < len; ++i, ++s) {
if (*(unsigned char *)s == 0xff)
return -ERR_INVALID_BUCKET_NAME;
+ if (*(unsigned char *)s == '/')
+ return -ERR_INVALID_BUCKET_NAME;
}
return 0;