]> 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:27 +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 a88d2a36da73567a8d9557e8c9a64a96a72e2acb..cb10f34fb2b3c23091ce4728a46947c14e0311ba 100644 (file)
@@ -797,6 +797,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);