[PATCH] domain: avoid slash characters to the new domain name.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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=1333232

Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
---
 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)
 
 
 
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);
 
     if (dom->conn->driver->domainRename) {
-- 
2.14.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux