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: v17.1.0~1465^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7ed494076e2390f8e6a386278346632d00ee718a;p=ceph.git mon: return -EINVAL when handling unknown option in 'ceph osd pool get' Signed-off-by: Zhao Cuicui --- diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index db8e9990e91a..0bce1aac6c4b 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -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() &&