]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: check object name after rebuilding it in S3 POST
authorYehuda Sadeh <yehuda@inktank.com>
Tue, 27 Aug 2013 02:46:43 +0000 (19:46 -0700)
committerYehuda Sadeh <yehuda@inktank.com>
Wed, 4 Sep 2013 23:27:03 +0000 (16:27 -0700)
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)

src/rgw/rgw_rest_s3.cc

index 8690dd8fdbebdf179c5765f537c56d1d1ce29b15..ab6e66442974c833e2ed213b5efb215953080060 100644 (file)
@@ -893,6 +893,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);