From patchwork Tue Apr 26 19:21:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 66730 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1792884qge; Tue, 26 Apr 2016 12:24:55 -0700 (PDT) X-Received: by 10.28.189.10 with SMTP id n10mr21532478wmf.101.1461698695402; Tue, 26 Apr 2016 12:24:55 -0700 (PDT) Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com. [209.132.183.37]) by mx.google.com with ESMTPS id w8si222386wjz.65.2016.04.26.12.24.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Apr 2016 12:24:55 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.37 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 mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3QJMMHC063633; Tue, 26 Apr 2016 15:22:22 -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 u3QJLitm003922 for ; Tue, 26 Apr 2016 15:21:44 -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 u3QJLgAX019416; Tue, 26 Apr 2016 15:21:44 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Tue, 26 Apr 2016 15:21:37 -0400 Message-Id: <48b3825464a39dc18881a9058b31922395f9cf6c.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 2/3] conf: network: 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 network name containing an embedded '/' will immediately fail when trying to write the XML to disk. This patch explicitly rejects names containing a '/' Besides the network bridge driver, the only other network implementation is a very thin one for virtualbox, which seems to use the network name as a host interface name, which won't accept '/' anyways, so I think this is fine to do unconitionally. https://bugzilla.redhat.com/show_bug.cgi?id=787604 --- src/conf/network_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/network_conf.c b/src/conf/network_conf.c index e6915ff..1f680d7 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -2070,6 +2070,12 @@ virNetworkDefParseXML(xmlXPathContextPtr ctxt) goto error; } + if (strchr(def->name, '/')) { + virReportError(VIR_ERR_XML_ERROR, + _("name %s cannot contain '/'"), def->name); + goto error; + } + /* Extract network uuid */ tmp = virXPathString("string(./uuid[1])", ctxt); if (!tmp) {