[PATCH] virDomainGraphicsListenDefParseXML: validate attribute 'network' for listen type 'network'

Amneesh Singh natto at weirdnatto.in
Tue Apr 12 13:10:24 UTC 2022


Related: https://gitlab.com/libvirt/libvirt/-/issues/93
Signed-off-by: Amneesh Singh <natto at weirdnatto.in>
---
 src/conf/domain_conf.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index bd28840..f1651e3 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -12268,6 +12268,13 @@ virDomainGraphicsListenDefParseXML(virDomainGraphicsListenDef *def,
             goto error;
         }
         def->network = g_steal_pointer(&network);
+    } else {
+        if (def->type == VIR_DOMAIN_GRAPHICS_LISTEN_TYPE_NETWORK) {
+            virReportError(VIR_ERR_XML_ERROR, "%s",
+                           _("'network' attribute is required for listen "
+                             "type 'network'"));
+            goto error;
+        }
     }
 
     if (socketPath && socketPath[0]) {
-- 
2.35.1



More information about the libvir-list mailing list