From nobody Mon Apr 29 09:15:11 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; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1523935704506488.85865868127894; Mon, 16 Apr 2018 20:28:24 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D95B331537A8; Tue, 17 Apr 2018 03:28:21 +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 124B28F034; Tue, 17 Apr 2018 03:28:20 +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 4275C4CA97; Tue, 17 Apr 2018 03:28:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w3H3SEiO027301 for ; Mon, 16 Apr 2018 23:28:14 -0400 Received: by smtp.corp.redhat.com (Postfix) id 310A45C89C; Tue, 17 Apr 2018 03:28:14 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 294554C3 for ; Tue, 17 Apr 2018 03:28:12 +0000 (UTC) Received: from mail-qt0-f193.google.com (mail-qt0-f193.google.com [209.85.216.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A9989C057F90 for ; Tue, 17 Apr 2018 03:28:00 +0000 (UTC) Received: by mail-qt0-f193.google.com with SMTP id s2so17735767qti.2 for ; Mon, 16 Apr 2018 20:28:00 -0700 (PDT) Received: from localhost.localdomain ([186.223.3.161]) by smtp.gmail.com with ESMTPSA id v25sm11031628qkl.59.2018.04.16.20.27.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 16 Apr 2018 20:27:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id; bh=s2/5vYUn2k/B8gximQYhItRkE05Rf64U+ASbfLIgbIE=; b=vaBUiMNtCUO6uJ77nA06Zn1K/QzkKGy+buyRnLBehpzPJC4xRguDgmXuWHnCx/QU3q zKD+/bCQn5TDimpKx2JMsO3WM2Vf0jrzEG/z8qYqgVRfpCZXO9omPkAXUo12jPpJaqRt as9hAKG6rjLyiy6QJiRBn/ggRTIVOLXH3PUs3x7ZYrtddec/y1N43TzGyxK4YaYb9XJ7 aM9Ky83+KVay1Uw6Ty+y8kb/y7hg4+u/zD6Ltz8lXVXl4lkNVLo+NvPPcIMM/7H7PjKZ Umai82CSySY07Kny4ro5kRBSoso6xE/q6BABUorZWB1L9Ela+ZMy1RiiTeBRg9cQ3zXi xdlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=s2/5vYUn2k/B8gximQYhItRkE05Rf64U+ASbfLIgbIE=; b=TJkVDb5Vc3lGrrSstIIdc3wgv+k4ze3afy7IHbr3MaHa7shzU3MxPSLFCKNkqBMyn5 qHOdvm40P8YjmTTkegDaZyjEebjV6KFAa6q4zFGOlx3RIM10EFpY/L9gkaff1FyM+K+K ajcCzeaeOa2+sJ006opznOGxoB5giSjJ9W+VsYzl95xDQIEsAvMh0GDf4fq695dihPwH fw3yu++qSDW7x1M1BcEH14zlWCwyWkvAXjQfn7Qv02c6kdGcyWhJ9AZOJzQnfmSJXAJ2 xwu7xVpKE98YoRtaB6O8iKlQU1Q4W2MqFExfUZUFvWv7am8EAbbRYMjwZkmlInKOZx3Q w2+A== X-Gm-Message-State: ALQs6tAGJ/dkTVctb4MmU406pfUyKJG233k6inRD7kFmYShwdT0jRf3X givFfzHRo+lL/rqKGWvclVal+w== X-Google-Smtp-Source: AIpwx48f2JcH4hJp64vToA1R2yNZiWxSiVbh3Kbj/uYSVNTbCjOF5R+uTi00Bfm+LSavd/wqivVK+g== X-Received: by 10.200.38.238 with SMTP id 43mr478513qtp.155.1523935678833; Mon, 16 Apr 2018 20:27:58 -0700 (PDT) From: Julio Faracco To: libvir-list@redhat.com Date: Tue, 17 Apr 2018 00:27:27 -0300 Message-Id: <20180417032727.11030-1-jcfaracco@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 17 Apr 2018 03:28:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 17 Apr 2018 03:28:00 +0000 (UTC) for IP:'209.85.216.193' DOMAIN:'mail-qt0-f193.google.com' HELO:'mail-qt0-f193.google.com' FROM:'jcfaracco@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.281 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS, T_DKIM_INVALID) 209.85.216.193 mail-qt0-f193.google.com 209.85.216.193 mail-qt0-f193.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] domain: avoid slash characters to the new domain name. 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 17 Apr 2018 03:28:23 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The 'domrename' command needs to check if the new domain name contains the slash character. This character is not accepted by libvirt XML definition because it is an invalid char (see Cole's commit b1fc6a7b7). This commit enhace the 'domrename' command adding this check. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1333232 Signed-off-by: Julio Faracco --- src/internal.h | 9 +++++++++ src/libvirt-domain.c | 1 + 2 files changed, 10 insertions(+) diff --git a/src/internal.h b/src/internal.h index 1760e3b69..e976b1caa 100644 --- a/src/internal.h +++ b/src/internal.h @@ -484,6 +484,15 @@ goto label; \ } \ } while (0) +# define virCheckNonSlashGoto(argname, label) \ + do { \ + if (strchr(argname, '/')) { \ + virReportInvalidArg(ctl, \ + _("name %s cannot contain '/'"), \ + argname); \ + goto label; \ + } \ + } while (0) =20 =20 =20 diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 63d2ae23d..47bc59b11 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -8536,6 +8536,7 @@ virDomainRename(virDomainPtr dom, virResetLastError(); virCheckDomainReturn(dom, -1); virCheckNonEmptyStringArgGoto(new_name, error); + virCheckNonSlashGoto(new_name, error); virCheckReadOnlyGoto(dom->conn->flags, error); =20 if (dom->conn->driver->domainRename) { --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list