]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: 'zone placement' commands validate compression type 18273/head
authorCasey Bodley <cbodley@redhat.com>
Thu, 12 Oct 2017 17:26:29 +0000 (13:26 -0400)
committerCasey Bodley <cbodley@redhat.com>
Thu, 12 Oct 2017 17:28:07 +0000 (13:28 -0400)
Fixes: http://tracker.ceph.com/issues/21775
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_admin.cc

index 7a745928a2b759beeac5182cf4dd69eb90d79f20..552251e15a5191e92888bb665538a8024da378d4 100644 (file)
@@ -9,6 +9,7 @@
 #include <boost/optional.hpp>
 
 #include "auth/Crypto.h"
+#include "compressor/Compressor.h"
 
 #include "common/armor.h"
 #include "common/ceph_json.h"
@@ -4239,6 +4240,13 @@ int main(int argc, const char **argv)
           cerr << "ERROR: --placement-id not specified" << std::endl;
           return EINVAL;
         }
+        // validate compression type
+        if (compression_type && *compression_type != "random"
+            && !Compressor::get_comp_alg_type(*compression_type)) {
+          std::cerr << "Unrecognized compression type" << std::endl;
+          return EINVAL;
+        }
+
        RGWZoneParams zone(zone_id, zone_name);
        int ret = zone.init(g_ceph_context, store);
         if (ret < 0) {