From: Casey Bodley Date: Thu, 12 Oct 2017 17:26:29 +0000 (-0400) Subject: rgw: 'zone placement' commands validate compression type X-Git-Tag: v13.0.1~582^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=33f8ee8b6fa5605edbbfe12d8e097123e509ad9f;p=ceph.git rgw: 'zone placement' commands validate compression type Fixes: http://tracker.ceph.com/issues/21775 Signed-off-by: Casey Bodley --- diff --git a/src/rgw/rgw_admin.cc b/src/rgw/rgw_admin.cc index 7a745928a2b7..552251e15a51 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) {