diff options
Diffstat (limited to 'qapi/qmp-dispatch.c')
-rw-r--r-- | qapi/qmp-dispatch.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/qapi/qmp-dispatch.c b/qapi/qmp-dispatch.c index 12be120fe7..6d78f3e9f6 100644 --- a/qapi/qmp-dispatch.c +++ b/qapi/qmp-dispatch.c @@ -20,8 +20,8 @@ #include "qapi/qmp/qbool.h" #include "sysemu/sysemu.h" -QDict *qmp_dispatch_check_obj(const QObject *request, bool allow_oob, - Error **errp) +static QDict *qmp_dispatch_check_obj(const QObject *request, bool allow_oob, + Error **errp) { const char *exec_key = NULL; const QDictEntry *ent; @@ -78,6 +78,7 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request, bool allow_oob, Error **errp) { Error *local_err = NULL; + bool oob; const char *command; QDict *args, *dict; QmpCommand *cmd; @@ -89,9 +90,11 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request, } command = qdict_get_try_str(dict, "execute"); + oob = false; if (!command) { assert(allow_oob); command = qdict_get_str(dict, "exec-oob"); + oob = true; } cmd = qmp_find_command(cmds, command); if (cmd == NULL) { @@ -104,6 +107,11 @@ static QObject *do_qmp_dispatch(QmpCommandList *cmds, QObject *request, command); return NULL; } + if (oob && !(cmd->options & QCO_ALLOW_OOB)) { + error_setg(errp, "The command %s does not support OOB", + command); + return false; + } if (runstate_check(RUN_STATE_PRECONFIG) && !(cmd->options & QCO_ALLOW_PRECONFIG)) { |