From nobody Thu May 2 06:51:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1529344666146810.9786048602613; Mon, 18 Jun 2018 10:57:46 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B3FCE81DFA; Mon, 18 Jun 2018 17:57:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C2CC5D9D1; Mon, 18 Jun 2018 17:57:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 629CA1800538; Mon, 18 Jun 2018 17:57:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5IHvce5027834 for ; Mon, 18 Jun 2018 13:57:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA242111DCEF; Mon, 18 Jun 2018 17:57:38 +0000 (UTC) Received: from dhcp-17-130.bos.redhat.com (dhcp-17-130.bos.redhat.com [10.18.17.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id C08E1111DCE8; Mon, 18 Jun 2018 17:57:38 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Mon, 18 Jun 2018 13:57:23 -0400 Message-Id: <1d5368f19f03275e6add82abb0a03a6eab0c6972.1529344085.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Anya Harter Subject: [libvirt] [PATCH 1/4] qemu: Escape commas for qemuBuildChrChardevStr X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Jun 2018 17:57:45 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add comma escaping for dev->data.file.path in cases VIR_DOMAIN_CHR_TYPE_DEV and VIR_DOMAIN_CHR_TYPE_PIPE. Signed-off-by: Anya Harter Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 9 +++++---- tests/qemuxml2argvdata/name-escape.args | 4 ++++ tests/qemuxml2argvdata/name-escape.xml | 7 +++++++ tests/qemuxml2argvtest.c | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bb956a77f4..b764008949 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4975,9 +4975,10 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, break; =20 case VIR_DOMAIN_CHR_TYPE_DEV: - virBufferAsprintf(&buf, "%s,id=3D%s,path=3D%s", + virBufferAsprintf(&buf, "%s,id=3D%s,path=3D", STRPREFIX(alias, "parallel") ? "parport" : "tty", - charAlias, dev->data.file.path); + charAlias); + virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path); break; =20 case VIR_DOMAIN_CHR_TYPE_FILE: @@ -4997,8 +4998,8 @@ qemuBuildChrChardevStr(virLogManagerPtr logManager, break; =20 case VIR_DOMAIN_CHR_TYPE_PIPE: - virBufferAsprintf(&buf, "pipe,id=3D%s,path=3D%s", charAlias, - dev->data.file.path); + virBufferAsprintf(&buf, "pipe,id=3D%s,path=3D", charAlias); + virQEMUBuildBufferEscapeComma(&buf, dev->data.file.path); break; =20 case VIR_DOMAIN_CHR_TYPE_STDIO: diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvda= ta/name-escape.args index 5ff8c03db8..4b03068f95 100644 --- a/tests/qemuxml2argvdata/name-escape.args +++ b/tests/qemuxml2argvdata/name-escape.args @@ -23,6 +23,10 @@ bar=3D2/monitor.sock,server,nowait \ -no-acpi \ -boot c \ -usb \ +-chardev tty,id=3Dcharserial0,path=3D/dev/ttyS2,,foo \ +-device isa-serial,chardev=3Dcharserial0,id=3Dserial0 \ +-chardev pipe,id=3Dcharchannel0,path=3D/tmp/guestfwd,,foo \ +-netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ -vnc unix:/tmp/lib/domain--1-foo=3D1,,bar=3D2/vnc.sock \ -spice unix,addr=3D/tmp/lib/domain--1-foo=3D1,,bar=3D2/spice.sock \ -vga cirrus \ diff --git a/tests/qemuxml2argvdata/name-escape.xml b/tests/qemuxml2argvdat= a/name-escape.xml index 6b93d71798..3f5e1c9829 100644 --- a/tests/qemuxml2argvdata/name-escape.xml +++ b/tests/qemuxml2argvdata/name-escape.xml @@ -20,5 +20,12 @@ + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index f44cac9fef..c194ff59c9 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2760,7 +2760,8 @@ mymain(void) QEMU_CAPS_NAME_GUEST, QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_SPICE, - QEMU_CAPS_SPICE_UNIX); + QEMU_CAPS_SPICE_UNIX, + QEMU_CAPS_DEVICE_ISA_SERIAL); DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS); =20 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 06:51:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1529344676903484.50070769985996; Mon, 18 Jun 2018 10:57:56 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 819531279B; Mon, 18 Jun 2018 17:57:55 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4E8A85C257; Mon, 18 Jun 2018 17:57:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 0241C4A46E; Mon, 18 Jun 2018 17:57:55 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5IHvda8027839 for ; Mon, 18 Jun 2018 13:57:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0B748111CD5C; Mon, 18 Jun 2018 17:57:39 +0000 (UTC) Received: from dhcp-17-130.bos.redhat.com (dhcp-17-130.bos.redhat.com [10.18.17.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5417111DCE8; Mon, 18 Jun 2018 17:57:38 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Mon, 18 Jun 2018 13:57:24 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Anya Harter Subject: [libvirt] [PATCH 2/4] qemu: Escape commas for qemuBuildChrChardevFileStr X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 18 Jun 2018 17:57:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add comma escaping for fileval. Signed-off-by: Anya Harter Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 3 ++- tests/qemuxml2argvdata/name-escape.args | 2 ++ tests/qemuxml2argvdata/name-escape.xml | 4 ++++ tests/qemuxml2argvtest.c | 3 ++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index b764008949..40e8f8fccf 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4867,7 +4867,8 @@ qemuBuildChrChardevFileStr(virLogManagerPtr logManage= r, virBufferAsprintf(buf, ",%s=3D%s,%s=3Don", filearg, fdpath, append= arg); VIR_FREE(fdpath); } else { - virBufferAsprintf(buf, ",%s=3D%s", filearg, fileval); + virBufferAsprintf(buf, ",%s=3D", filearg); + virQEMUBuildBufferEscapeComma(buf, fileval); if (appendval !=3D VIR_TRISTATE_SWITCH_ABSENT) { virBufferAsprintf(buf, ",%s=3D%s", appendarg, virTristateSwitchTypeToString(appendval)); diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvda= ta/name-escape.args index 4b03068f95..35a13b2533 100644 --- a/tests/qemuxml2argvdata/name-escape.args +++ b/tests/qemuxml2argvdata/name-escape.args @@ -25,6 +25,8 @@ bar=3D2/monitor.sock,server,nowait \ -usb \ -chardev tty,id=3Dcharserial0,path=3D/dev/ttyS2,,foo \ -device isa-serial,chardev=3Dcharserial0,id=3Dserial0 \ +-chardev file,id=3Dcharserial1,path=3D/tmp/serial.log,,foo,append=3Don \ +-device isa-serial,chardev=3Dcharserial1,id=3Dserial1 \ -chardev pipe,id=3Dcharchannel0,path=3D/tmp/guestfwd,,foo \ -netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ -vnc unix:/tmp/lib/domain--1-foo=3D1,,bar=3D2/vnc.sock \ diff --git a/tests/qemuxml2argvdata/name-escape.xml b/tests/qemuxml2argvdat= a/name-escape.xml index 3f5e1c9829..79c1b34458 100644 --- a/tests/qemuxml2argvdata/name-escape.xml +++ b/tests/qemuxml2argvdata/name-escape.xml @@ -23,6 +23,10 @@ + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index c194ff59c9..3e02fa576c 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2761,7 +2761,8 @@ mymain(void) QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_UNIX, - QEMU_CAPS_DEVICE_ISA_SERIAL); + QEMU_CAPS_DEVICE_ISA_SERIAL, + QEMU_CAPS_CHARDEV_FILE_APPEND); DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS); =20 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 06:51:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1529344682160760.9618005682339; Mon, 18 Jun 2018 10:58:02 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AE6C3308625E; Mon, 18 Jun 2018 17:58:00 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6C8895C1B2; Mon, 18 Jun 2018 17:58:00 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 12F3B3FCC1; Mon, 18 Jun 2018 17:58:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5IHvdNi027844 for ; Mon, 18 Jun 2018 13:57:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3280E111AF16; Mon, 18 Jun 2018 17:57:39 +0000 (UTC) Received: from dhcp-17-130.bos.redhat.com (dhcp-17-130.bos.redhat.com [10.18.17.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 16393111CA1D; Mon, 18 Jun 2018 17:57:39 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Mon, 18 Jun 2018 13:57:25 -0400 Message-Id: <37ed7844dedd9483eb213ec805f2aa976513885a.1529344085.git.aharter@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Anya Harter Subject: [libvirt] [PATCH 3/4] qemu: Escape commas for qemuBuildSmartcardCommandLine X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Mon, 18 Jun 2018 17:58:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add comma escaping for smartcard->data.cert.file[i] and smartcard->data.cert.database. Signed-off-by: Anya Harter Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 21 ++++----------------- tests/qemuxml2argvdata/name-escape.args | 3 +++ tests/qemuxml2argvdata/name-escape.xml | 6 ++++++ tests/qemuxml2argvtest.c | 3 ++- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 40e8f8fccf..a9a5e200e9 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8716,29 +8716,16 @@ qemuBuildSmartcardCommandLine(virLogManagerPtr logM= anager, =20 virBufferAddLit(&opt, "ccid-card-emulated,backend=3Dcertificates"); for (i =3D 0; i < VIR_DOMAIN_SMARTCARD_NUM_CERTIFICATES; i++) { - if (strchr(smartcard->data.cert.file[i], ',')) { - virBufferFreeAndReset(&opt); - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid certificate name: %s"), - smartcard->data.cert.file[i]); - return -1; - } - virBufferAsprintf(&opt, ",cert%zu=3D%s", i + 1, - smartcard->data.cert.file[i]); + virBufferAsprintf(&opt, ",cert%zu=3D", i + 1); + virQEMUBuildBufferEscapeComma(&opt, smartcard->data.cert.file[= i]); } if (smartcard->data.cert.database) { - if (strchr(smartcard->data.cert.database, ',')) { - virBufferFreeAndReset(&opt); - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid database name: %s"), - smartcard->data.cert.database); - return -1; - } database =3D smartcard->data.cert.database; } else { database =3D VIR_DOMAIN_SMARTCARD_DEFAULT_DATABASE; } - virBufferAsprintf(&opt, ",db=3D%s", database); + virBufferAddLit(&opt, ",db=3D"); + virQEMUBuildBufferEscapeComma(&opt, database); break; =20 case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH: diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvda= ta/name-escape.args index 35a13b2533..d3b908a7e6 100644 --- a/tests/qemuxml2argvdata/name-escape.args +++ b/tests/qemuxml2argvdata/name-escape.args @@ -22,7 +22,10 @@ bar=3D2/monitor.sock,server,nowait \ -no-shutdown \ -no-acpi \ -boot c \ +-device usb-ccid,id=3Dccid0,bus=3Dusb.0,port=3D1 \ -usb \ +-device ccid-card-emulated,backend=3Dcertificates,cert1=3Dcert1,,foo,cert2= =3Dcert2,\ +cert3=3Dcert3,db=3D/etc/pki/nssdb,,foo,id=3Dsmartcard0,bus=3Dccid0.0 \ -chardev tty,id=3Dcharserial0,path=3D/dev/ttyS2,,foo \ -device isa-serial,chardev=3Dcharserial0,id=3Dserial0 \ -chardev file,id=3Dcharserial1,path=3D/tmp/serial.log,,foo,append=3Don \ diff --git a/tests/qemuxml2argvdata/name-escape.xml b/tests/qemuxml2argvdat= a/name-escape.xml index 79c1b34458..9ca7be5968 100644 --- a/tests/qemuxml2argvdata/name-escape.xml +++ b/tests/qemuxml2argvdata/name-escape.xml @@ -31,5 +31,11 @@ + + cert1,foo + cert2 + cert3 + /etc/pki/nssdb,foo + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 3e02fa576c..7468537c68 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2762,7 +2762,8 @@ mymain(void) QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_UNIX, QEMU_CAPS_DEVICE_ISA_SERIAL, - QEMU_CAPS_CHARDEV_FILE_APPEND); + QEMU_CAPS_CHARDEV_FILE_APPEND, + QEMU_CAPS_CCID_EMULATED); DO_TEST("debug-threads", QEMU_CAPS_NAME_DEBUG_THREADS); =20 DO_TEST("master-key", QEMU_CAPS_OBJECT_SECRET); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 06:51:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1529344677187422.59665456841697; Mon, 18 Jun 2018 10:57:57 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 181BA30832DF; Mon, 18 Jun 2018 17:57:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D5521001914; Mon, 18 Jun 2018 17:57:55 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id F3D234A46C; Mon, 18 Jun 2018 17:57:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w5IHvdmg027849 for ; Mon, 18 Jun 2018 13:57:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 56913111AF1A; Mon, 18 Jun 2018 17:57:39 +0000 (UTC) Received: from dhcp-17-130.bos.redhat.com (dhcp-17-130.bos.redhat.com [10.18.17.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3CD37111AF17; Mon, 18 Jun 2018 17:57:39 +0000 (UTC) From: Anya Harter To: libvir-list@redhat.com Date: Mon, 18 Jun 2018 13:57:26 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-loop: libvir-list@redhat.com Cc: Anya Harter Subject: [libvirt] [PATCH 4/4] qemu: Escape commas for qemuBuildGrapicsSPICECommandLine X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 18 Jun 2018 17:57:56 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add comma escaping for cfg->spiceTLSx509certdir and graphics->data.spice.rendernode. Signed-off-by: Anya Harter Reviewed-by: John Ferlan --- src/qemu/qemu_command.c | 11 ++++++++--- tests/qemuxml2argvdata/name-escape.args | 5 +++-- tests/qemuxml2argvdata/name-escape.xml | 1 + tests/qemuxml2argvtest.c | 5 +++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a9a5e200e9..36dccea9b2 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7974,8 +7974,11 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfi= gPtr cfg, !cfg->spicePassword) virBufferAddLit(&opt, "disable-ticketing,"); =20 - if (hasSecure) - virBufferAsprintf(&opt, "x509-dir=3D%s,", cfg->spiceTLSx509certdir= ); + if (hasSecure) { + virBufferAddLit(&opt, "x509-dir=3D"); + virQEMUBuildBufferEscapeComma(&opt, cfg->spiceTLSx509certdir); + virBufferAsprintf(&opt, ","); + } =20 switch (graphics->data.spice.defaultMode) { case VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_MODE_SECURE: @@ -8082,7 +8085,9 @@ qemuBuildGraphicsSPICECommandLine(virQEMUDriverConfig= Ptr cfg, goto error; } =20 - virBufferAsprintf(&opt, "rendernode=3D%s,", graphics->data.spi= ce.rendernode); + virBufferAddLit(&opt, "rendernode=3D"); + virQEMUBuildBufferEscapeComma(&opt, graphics->data.spice.rende= rnode); + virBufferAsprintf(&opt, ","); } } =20 diff --git a/tests/qemuxml2argvdata/name-escape.args b/tests/qemuxml2argvda= ta/name-escape.args index d3b908a7e6..72ed2e8410 100644 --- a/tests/qemuxml2argvdata/name-escape.args +++ b/tests/qemuxml2argvdata/name-escape.args @@ -33,6 +33,7 @@ cert3=3Dcert3,db=3D/etc/pki/nssdb,,foo,id=3Dsmartcard0,bu= s=3Dccid0.0 \ -chardev pipe,id=3Dcharchannel0,path=3D/tmp/guestfwd,,foo \ -netdev user,guestfwd=3Dtcp:10.0.2.1:4600-chardev:charchannel0,id=3Duser-c= hannel0 \ -vnc unix:/tmp/lib/domain--1-foo=3D1,,bar=3D2/vnc.sock \ --spice unix,addr=3D/tmp/lib/domain--1-foo=3D1,,bar=3D2/spice.sock \ --vga cirrus \ +-spice unix,addr=3D/tmp/lib/domain--1-foo=3D1,,bar=3D2/spice.sock,gl=3Don,\ +rendernode=3D/dev/dri/foo,,bar \ +-device cirrus-vga,id=3Dvideo0,bus=3Dpci.0,addr=3D0x2 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 diff --git a/tests/qemuxml2argvdata/name-escape.xml b/tests/qemuxml2argvdat= a/name-escape.xml index 9ca7be5968..0580de1813 100644 --- a/tests/qemuxml2argvdata/name-escape.xml +++ b/tests/qemuxml2argvdata/name-escape.xml @@ -19,6 +19,7 @@ + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 7468537c68..ade21f5a10 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2761,6 +2761,11 @@ mymain(void) QEMU_CAPS_DEVICE_CIRRUS_VGA, QEMU_CAPS_SPICE, QEMU_CAPS_SPICE_UNIX, + QEMU_CAPS_DEVICE_VIRTIO_GPU, + QEMU_CAPS_VIRTIO_GPU_VIRGL, + QEMU_CAPS_SPICE_GL, + QEMU_CAPS_SPICE_RENDERNODE, + QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_DEVICE_ISA_SERIAL, QEMU_CAPS_CHARDEV_FILE_APPEND, QEMU_CAPS_CCID_EMULATED); --=20 2.17.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list