[libvirt] [PATCH 2/2] libvirt-domain: forbid use virDomainRename in readonly connection

Luyao Huang lhuang at redhat.com
Mon Aug 17 05:22:00 UTC 2015


This function will change the guest name, we shouldn't
allow the readonly user do this.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 src/libvirt-domain.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index 9065dab..9314f85 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -8796,6 +8796,7 @@ virDomainRename(virDomainPtr dom,
     virResetLastError();
     virCheckDomainReturn(dom, -1);
     virCheckNonNullArgGoto(new_name, error);
+    virCheckReadOnlyGoto(dom->conn->flags, error);
 
     if (dom->conn->driver->domainRename) {
         int ret = dom->conn->driver->domainRename(dom, new_name, flags);
-- 
1.8.3.1




More information about the libvir-list mailing list