render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
Blob Blame History Raw
From 0c1bec6a89f97c77ba9e0ed4146deb8606ea6f16 Mon Sep 17 00:00:00 2001
Message-Id: <0c1bec6a89f97c77ba9e0ed4146deb8606ea6f16@dist-git>
From: Jonathon Jongsma <jjongsma@redhat.com>
Date: Wed, 25 Mar 2020 11:21:19 -0500
Subject: [PATCH] api: disallow virDomainAgentSetResponseTimeout() on read-only
 connections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This function changes the amount of time that libvirt waits for a
response from the guest agent for all guest agent commands. Since this
is a configuration change, it should not be allowed on read-only
connections.

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 4cc90c2e62df653e909ad31fd810224bf8bcf913)

https://bugzilla.redhat.com/show_bug.cgi?id=1814508

Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Message-Id: <20200325162119.9047-2-jjongsma@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
---
 src/libvirt-domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c
index eb66999f07..3deee54e48 100644
--- a/src/libvirt-domain.c
+++ b/src/libvirt-domain.c
@@ -12554,6 +12554,8 @@ virDomainAgentSetResponseTimeout(virDomainPtr domain,
     virCheckDomainReturn(domain, -1);
     conn = domain->conn;
 
+    virCheckReadOnlyGoto(conn->flags, error);
+
     if (conn->driver->domainAgentSetResponseTimeout) {
         if (conn->driver->domainAgentSetResponseTimeout(domain, timeout, flags) < 0)
             goto error;
-- 
2.26.0