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

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



At 05/19/2011 01:08 AM, Daniel P. Berrange Write:
> 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);
> +

Without this patch, the argument of qemu is '-vnc :<port>' if listenAddr is empty string.
It means that we can connect it from any address.

With this patch, the argument of qemu is '-vnc 127.0.0.1:<port>' if listenAddr is empty string.
It meas that we can only connect it from localhost.

This patch modifies the behavior of the vm. I do not know which is correct.

>          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;
>  


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