mirror of
https://github.com/ceph/ceph
synced 2024-12-19 01:46:00 +00:00
librgw: enforce S3 object name restrictions
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
This commit is contained in:
parent
66b6b1fd3e
commit
12fd3faaec
@ -1171,6 +1171,18 @@ public:
|
||||
|
||||
}; /* RGWDeleteBucketRequest */
|
||||
|
||||
static inline bool valid_s3_object_name(const string& name) {
|
||||
if (name.size() > 1024) {
|
||||
// Name too long
|
||||
return false;
|
||||
}
|
||||
if (check_utf8(name.c_str(), name.size())) {
|
||||
// Object names must be valid UTF-8.
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
put object
|
||||
*/
|
||||
@ -1203,6 +1215,10 @@ public:
|
||||
assert(rados_ctx);
|
||||
RGWOp::init(rados_ctx->store, get_state(), this);
|
||||
op = this; // assign self as op: REQUIRED
|
||||
|
||||
if (! valid_s3_object_name(obj_name))
|
||||
return -ERR_INVALID_OBJECT_NAME;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user