mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
Merge PR #29089 into master
* refs/pull/29089/head: mon/MgrMonitor: fix null deref when invalid formatter is specified Reviewed-by: Kefu Chai <kchai@redhat.com> Reviewed-by: João Eduardo Luís <joao@suse.de>
This commit is contained in:
commit
525ab21f71
@ -855,8 +855,9 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op)
|
||||
}
|
||||
|
||||
string format;
|
||||
cmd_getval(g_ceph_context, cmdmap, "format", format, string("json-pretty"));
|
||||
boost::scoped_ptr<Formatter> f(Formatter::create(format));
|
||||
cmd_getval(g_ceph_context, cmdmap, "format", format);
|
||||
boost::scoped_ptr<Formatter> f(Formatter::create(format, "json-pretty",
|
||||
"json-pretty"));
|
||||
|
||||
string prefix;
|
||||
cmd_getval(g_ceph_context, cmdmap, "prefix", prefix);
|
||||
@ -952,14 +953,10 @@ bool MgrMonitor::preprocess_command(MonOpRequestRef op)
|
||||
}
|
||||
f->flush(rdata);
|
||||
} else if (prefix == "mgr versions") {
|
||||
if (!f)
|
||||
f.reset(Formatter::create("json-pretty"));
|
||||
count_metadata("ceph_version", f.get());
|
||||
f->flush(rdata);
|
||||
r = 0;
|
||||
} else if (prefix == "mgr count-metadata") {
|
||||
if (!f)
|
||||
f.reset(Formatter::create("json-pretty"));
|
||||
string field;
|
||||
cmd_getval(g_ceph_context, cmdmap, "property", field);
|
||||
count_metadata(field, f.get());
|
||||
|
Loading…
Reference in New Issue
Block a user