[libvirt] [PATCH] Don't allow read only connection to use SECURE_XML

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

 



Seems to me that a read only connection shouldn't be able to dump domain
xml with the SECURE flag. Attached patch blocks the attempt with an
explicit error message.

Thanks,
Cole
diff --git a/src/libvirt.c b/src/libvirt.c
index bf3453a..6e73cff 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2619,6 +2619,12 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags)
 
     conn = domain->conn;
 
+    if ((conn->flags & VIR_CONNECT_RO) && (flags & VIR_DOMAIN_XML_SECURE)) {
+        virLibConnError(conn, VIR_ERR_OPERATION_DENIED,
+                        _("%s with secure flag"), __FUNCTION__);
+        goto error;
+    }
+
     if (conn->driver->domainDumpXML) {
         char *ret;
         ret = conn->driver->domainDumpXML (domain, flags);
--
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]