From patchwork Tue Apr 26 19:21: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: 66728 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1792712qge; Tue, 26 Apr 2016 12:24:30 -0700 (PDT) X-Received: by 10.194.92.45 with SMTP id cj13mr5591889wjb.178.1461698670555; Tue, 26 Apr 2016 12:24:30 -0700 (PDT) Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com. [209.132.183.39]) by mx.google.com with ESMTPS id v124si26553403wmg.0.2016.04.26.12.24.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 12:24:30 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.39 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 mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3QJLlm1004692; Tue, 26 Apr 2016 15:21:47 -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 u3QJLj5E003927 for ; Tue, 26 Apr 2016 15:21:45 -0400 Received: from colepc.redhat.com (ovpn-113-44.phx2.redhat.com [10.3.113.44]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3QJLgAY019416; Tue, 26 Apr 2016 15:21:44 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 26 Apr 2016 15:21:38 -0400 Message-Id: <1b928bcbdc77c52338ae49763098bb9c79746a6c.1461697488.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 3/3] conf: storage: pool: reject name containing '/' 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 Trying to define a pool name containing an embedded '/' will immediately fail when trying to write the XML to disk. This patch explicitly rejects names containing a '/' Besides our stateful driver, there are two other storage impls: esx and phyp. esx doesn't support pool creation, so this should doesn't apply. phyp does support pool creation, and the name is passed to the 'mksp' tool, which google doesn't reveal whether it accepts '/' or not. IMO the likeliness of this impacting any users is near zero --- src/conf/storage_conf.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c index daf8f99..6fa9695 100644 --- a/src/conf/storage_conf.c +++ b/src/conf/storage_conf.c @@ -853,6 +853,12 @@ virStoragePoolDefParseXML(xmlXPathContextPtr ctxt) goto error; } + if (strchr(ret->name, '/')) { + virReportError(VIR_ERR_XML_ERROR, + _("name %s cannot contain '/'"), ret->name); + goto error; + } + uuid = virXPathString("string(./uuid)", ctxt); if (uuid == NULL) { if (virUUIDGenerate(ret->uuid) < 0) {