qemu: properly escape socket path for graphics

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1352529

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
Pavel Hrdina 2017-02-22 20:25:00 +01:00
parent 22b02f4492
commit 824272cb28
4 changed files with 15 additions and 6 deletions

View File

@ -7495,7 +7495,7 @@ qemuBuildGraphicsVNCCommandLine(virQEMUDriverConfigPtr cfg,
switch (glisten->type) {
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_SOCKET:
virBufferAddLit(&opt, "unix:");
virQEMUBuildBufferEscapeComma(&opt, glisten->socket);
virQEMUBuildBufferEscape(&opt, glisten->socket);
break;
case VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_ADDRESS:
@ -7627,7 +7627,9 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfigPtr cfg,
goto error;
}
virBufferAsprintf(&opt, "unix,addr=%s,", glisten->socket);
virBufferAddLit(&opt, "unix,addr=");
virQEMUBuildBufferEscape(&opt, glisten->socket);
virBufferAddLit(&opt, ",");
hasInsecure = true;
break;

View File

@ -3,7 +3,7 @@ PATH=/bin \
HOME=/home/test \
USER=test \
LOGNAME=test \
QEMU_AUDIO_DRV=none \
QEMU_AUDIO_DRV=spice \
/usr/bin/qemu \
-name guest=foo=1,,bar=2,debug-threads=on \
-S \
@ -20,6 +20,7 @@ bar=2/monitor.sock,server,nowait \
-no-acpi \
-boot c \
-usb \
-vnc unix:/tmp/bar,,foo.sock \
-vnc 'unix:/tmp/lib/domain--1-foo\=1,,bar\=2/vnc.sock' \
-spice 'unix,addr=/tmp/lib/domain--1-foo\=1,,bar\=2/spice.sock' \
-vga cirrus \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3

View File

@ -14,6 +14,11 @@
<on_crash>destroy</on_crash>
<devices>
<emulator>/usr/bin/qemu</emulator>
<graphics type='vnc' socket='/tmp/bar,foo.sock'/>
<graphics type='vnc'>
<listen type='socket'/>
</graphics>
<graphics type='spice'>
<listen type='socket'/>
</graphics>
</devices>
</domain>

View File

@ -2437,7 +2437,8 @@ mymain(void)
DO_TEST("name-escape", QEMU_CAPS_NAME_DEBUG_THREADS,
QEMU_CAPS_OBJECT_SECRET, QEMU_CAPS_CHARDEV, QEMU_CAPS_VNC,
QEMU_CAPS_NAME_GUEST, QEMU_CAPS_DEVICE_CIRRUS_VGA);
QEMU_CAPS_NAME_GUEST, QEMU_CAPS_DEVICE_CIRRUS_VGA,
QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_UNIX);
DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS);
DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET);