summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@inktank.com>2013-08-26 19:46:43 -0700
committerYehuda Sadeh <yehuda@inktank.com>2013-09-04 16:28:01 -0700
commit616d4cb530520021b592aebc8ecdc2b68fef6730 (patch)
treeb7e3e832ac52051be2680994b68cb6fa9badbdae
parent57cb25c851ff25a4270e414b1db617d0db68df53 (diff)
downloadceph-616d4cb530520021b592aebc8ecdc2b68fef6730.tar.gz
rgw: check object name after rebuilding it in S3 POST
Fixes: #6088 Backport: bobtail, cuttlefish, dumpling When posting an object it is possible to provide a key name that refers to the original filename, however we need to verify that in the end we don't end up with an empty object name. Reviewed-by: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Yehuda Sadeh <yehuda@inktank.com> (cherry picked from commit c8ec532fadc0df36e4b265fe20a2ff3e35319744)
-rw-r--r--src/rgw/rgw_rest_s3.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rgw/rgw_rest_s3.cc b/src/rgw/rgw_rest_s3.cc
index 2c09f6f712b..2a657a604ff 100644
--- a/src/rgw/rgw_rest_s3.cc
+++ b/src/rgw/rgw_rest_s3.cc
@@ -776,6 +776,11 @@ int RGWPostObj_ObjStore_S3::get_params()
rebuild_key(s->object_str);
+ if (s->object_str.empty()) {
+ err_msg = "Empty object name";
+ return -EINVAL;
+ }
+
env.add_var("key", s->object_str);
part_str("Content-Type", &content_type);