From: Zhao Cuicui Date: Mon, 5 Jul 2021 08:53:17 +0000 (+0800) Subject: mon: return -EINVAL when handling unknown option in 'ceph osd pool get' X-Git-Tag: v15.2.15~17^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F43266%2Fhead;p=ceph.git mon: return -EINVAL when handling unknown option in 'ceph osd pool get' Signed-off-by: Zhao Cuicui (cherry picked from commit 7ed494076e2390f8e6a386278346632d00ee718a) --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index 877ce53a6fd4..f2fe3e9d0560 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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() &&