]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: return -EINVAL when handling unknown option in 'ceph osd pool get' 42179/head
authorZhao Cuicui <brucen1030@163.com>
Mon, 5 Jul 2021 08:53:17 +0000 (16:53 +0800)
committerZhao Cuicui <brucen1030@163.com>
Mon, 5 Jul 2021 12:17:03 +0000 (20:17 +0800)
Signed-off-by: Zhao Cuicui <brucen1030@163.com>
src/mon/OSDMonitor.cc

index db8e9990e91a372be089126bf322aba3c477160c..0bce1aac6c4bb6e6fc914a1cd73ee55bc41d2408 100644 (file)
@@ -6152,6 +6152,13 @@ bool OSDMonitor::preprocess_command(MonOpRequestRef op)
       }
     } else /* var != "all" */  {
       choices_map_t::const_iterator found = ALL_CHOICES.find(var);
+      if (found == ALL_CHOICES.end()) {
+        ss << "pool '" << poolstr
+              << "': invalid variable: '" << var << "'";
+        r = -EINVAL;
+        goto reply;
+      }
+
       osd_pool_get_choices selected = found->second;
 
       if (!p->is_tier() &&