From patchwork Sun May 8 18:43:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 67328 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1260903qge; Sun, 8 May 2016 11:46:44 -0700 (PDT) X-Received: by 10.28.72.132 with SMTP id v126mr7434435wma.49.1462733203650; Sun, 08 May 2016 11:46:43 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id d28si21919168wmi.69.2016.05.08.11.46.43 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 08 May 2016 11:46:43 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u48IiCbx020372; Sun, 8 May 2016 14:44:12 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u48IhkZ1016823 for ; Sun, 8 May 2016 14:43:46 -0400 Received: from colepc.redhat.com (ovpn-113-25.phx2.redhat.com [10.3.113.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u48IhhIX024246; Sun, 8 May 2016 14:43:46 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Sun, 8 May 2016 14:43:38 -0400 Message-Id: <9596e306a87cb7bed3b4c3e5f82eb89d2c1f3c9f.1462732781.git.crobinso@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 3/6] qemu: command: escape commas in secret master path 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 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com Need to convert the local function to virBuffer usage, so we can use qemuBufferEscapeComma --- src/qemu/qemu_command.c | 7 +++++-- tests/qemuxml2argvdata/qemuxml2argv-name-escape.args | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 6ed7ae5..067a8c3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -196,6 +196,7 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, int ret = -1; char *alias = NULL; char *path = NULL; + virBuffer buf = VIR_BUFFER_INITIALIZER; /* If the -object secret does not exist, then just return. This just * means the domain won't be able to use a secret master key and is @@ -218,12 +219,14 @@ qemuBuildMasterKeyCommandLine(virCommandPtr cmd, goto cleanup; virCommandAddArg(cmd, "-object"); - virCommandAddArgFormat(cmd, "secret,id=%s,format=raw,file=%s", - alias, path); + virBufferAsprintf(&buf, "secret,id=%s,format=raw,file=", alias); + qemuBufferEscapeComma(&buf, path); + virCommandAddArgBuffer(cmd, &buf); ret = 0; cleanup: + virBufferFreeAndReset(&buf); VIR_FREE(alias); VIR_FREE(path); return ret; diff --git a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args index 94a3133..a5e35b8 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-name-escape.args @@ -7,7 +7,7 @@ QEMU_AUDIO_DRV=none \ /usr/bin/qemu \ -name foo,,bar,debug-threads=on \ -S \ --object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-foo,\ +-object secret,id=masterKey0,format=raw,file=/tmp/lib/domain--1-foo,,\ bar/master-key.aes \ -M pc \ -m 214 \