Skip to content

common: admin socket fallback to json-pretty format (dumpling)#1210

Merged
liewegas merged 1 commit intodumplingfrom
unknown repository
Feb 11, 2014
Merged

common: admin socket fallback to json-pretty format (dumpling)#1210
liewegas merged 1 commit intodumplingfrom
unknown repository

Conversation

@ghost
Copy link
Copy Markdown

@ghost ghost commented Feb 10, 2014

backport of #1207

If the format argument to a command sent to the admin socket is not
among the supported formats ( json, json-pretty, xml, xml-pretty ) the
new_formatter function will return null and the AdminSocketHook::call
function must fall back to a sensible default.

The CephContextHook::call and HelpHook::call failed to do that and a
malformed format argument would cause the mon to crash. A check is added
to each of them and fallback to json-pretty if the format is not
recognized.

To further protect AdminSocketHook::call implementations from similar
problems the format argument is checked immediately after accepting the
command in AdminSocket::do_accept and replaced with json-pretty if it is
not known.

A test case is added for both CephContextHook::call and HelpHook::call
to demonstrate the problem exists and is fixed by the patch.

Three other instances of unsafe calls to new_formatter were found and
a fallback to json-pretty was added. All other calls have been audited
and appear to be safe.

http://tracker.ceph.com/issues/7378 fixes #7378

Signed-off-by: Loic Dachary <loic@dachary.org>
(cherry picked from commit 165e76d)
liewegas pushed a commit that referenced this pull request Feb 11, 2014
common: admin socket fallback to json-pretty format (dumpling)

Reviewed-by: Sage Weil <sage@inktank.com>
@liewegas liewegas merged commit 4889234 into ceph:dumpling Feb 11, 2014
liewegas added a commit that referenced this pull request Dec 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant