From 33f8ee8b6fa5605edbbfe12d8e097123e509ad9f Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Thu, 12 Oct 2017 13:26:29 -0400 Subject: [PATCH] rgw: 'zone placement' commands validate compression type Fixes: http://tracker.ceph.com/issues/21775 Signed-off-by: Casey Bodley --- src/rgw/rgw_admin.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 7a745928a2b..552251e15a5 100644 --- a/src/rgw/rgw_admin.cc +++ b/src/rgw/rgw_admin.cc @@ -9,6 +9,7 @@ #include #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) { -- 2.39.5