common: admin socket fallback to json-pretty format (emperor)#1208
Conversation
Author
|
It's my first time backporting, is it well formed ? |
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 (emperor) Reviewed-by: Sage Weil <sage@inktank.com>
liewegas
added a commit
that referenced
this pull request
Dec 14, 2016
rados: move rgw_snaps from thrash to basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
backport of #1207