[libvirt] [PATCH] Blank out the 'listenAddr' parameter if empty string

Daniel P. Berrange berrange at redhat.com
Wed May 18 17:08:07 UTC 2011


Some bogus apps are generating a VNC/SPICE/RFB listen attribute
with no content. This then causes a failure with the graphics
migration cookie parsing. Blank out the 'listenAddr' parameter
after parsing domain XML if it is the empty string, so the host
default takes over

* src/qemu/qemu_migration.c: Blank out listenAddr parameter
  if empty
---
 src/conf/domain_conf.c |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 03f4dc9..15fe9f0 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -3906,6 +3906,10 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
         def->data.vnc.socket = virXMLPropString(node, "socket");
         def->data.vnc.keymap = virXMLPropString(node, "keymap");
 
+        if (def->data.vnc.listenAddr &&
+            STREQ(def->data.vnc.listenAddr, ""))
+            VIR_FREE(def->data.vnc.listenAddr);
+
         if (virDomainGraphicsAuthDefParseXML(node, &def->data.vnc.auth) < 0)
             goto error;
     } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
@@ -3970,6 +3974,10 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
         }
 
         def->data.rdp.listenAddr = virXMLPropString(node, "listen");
+
+        if (def->data.rdp.listenAddr &&
+            STREQ(def->data.rdp.listenAddr, ""))
+            VIR_FREE(def->data.rdp.listenAddr);
     } else if (def->type == VIR_DOMAIN_GRAPHICS_TYPE_DESKTOP) {
         char *fullscreen = virXMLPropString(node, "fullscreen");
 
@@ -4033,6 +4041,11 @@ virDomainGraphicsDefParseXML(xmlNodePtr node, int flags) {
 
         def->data.spice.listenAddr = virXMLPropString(node, "listen");
         def->data.spice.keymap = virXMLPropString(node, "keymap");
+
+        if (def->data.spice.listenAddr &&
+            STREQ(def->data.spice.listenAddr, ""))
+            VIR_FREE(def->data.spice.listenAddr);
+
         if (virDomainGraphicsAuthDefParseXML(node, &def->data.spice.auth) < 0)
             goto error;
 
-- 
1.7.4.4




More information about the libvir-list mailing list