]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: unescape HMP commands before converting them to json
authorJosh Durgin <josh.durgin@dreamhost.com>
Sun, 26 Feb 2012 00:48:02 +0000 (16:48 -0800)
committerEric Blake <eblake@redhat.com>
Mon, 27 Feb 2012 23:06:02 +0000 (16:06 -0700)
commitf27f616ff899732fe90ce1f0f4abb3887cea5e17
treee2541384c0367ea1607b65a0909bac1cd6941147
parent4716138229ae47c5492c13a8622b779889560fd7
qemu: unescape HMP commands before converting them to json

QMP commands don't need to be escaped since converting them to json
also escapes special characters. When a QMP command fails, however,
libvirt falls back to HMP commands. These fallback functions
(qemuMonitorText*) do their own escaping, and pass the result directly
to qemuMonitorHMPCommandWithFd. If the monitor is in json mode, these
pre-escaped commands will be escaped again when converted to json,
which can result in the wrong arguments being sent.

For example, a filename test\file would be sent in json as
test\\file.

This prevented attaching an image file with a " or \ in its name in
qemu 1.0.50, and also broke rbd attachment (which uses backslashes to
escape some internal arguments.)

Reported-by: Masuko Tomoya <tomoya.masuko@gmail.com>
Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
.gitignore
src/qemu/qemu_monitor.c
src/qemu/qemu_monitor.h
tests/Makefile.am
tests/qemumonitortest.c [new file with mode: 0644]