]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mon: return -EINVAL when handling unknown option in 'ceph osd pool get' 43266/head
authorZhao Cuicui <brucen1030@163.com>
Mon, 5 Jul 2021 08:53:17 +0000 (16:53 +0800)
committerCory Snyder <csnyder@iland.com>
Wed, 22 Sep 2021 18:18:00 +0000 (14:18 -0400)
Signed-off-by: Zhao Cuicui <brucen1030@163.com>
(cherry picked from commit 7ed494076e2390f8e6a386278346632d00ee718a)

src/mon/OSDMonitor.cc

index 877ce53a6fd4a288d2e9d6ae1421119563274161..f2fe3e9d0560d15ebd808365396047f49bba9c4f 100644 (file)
@@ -6085,6 +6085,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() &&