summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-02-14 14:55:39 +0000
committerDaniel P. Berrange <berrange@redhat.com>2012-02-14 14:55:39 +0000
commit56b0217c626349748c5cc6f2fbccfa6a905f75a4 (patch)
tree4fee7dfba40c99445f1101379e4376c754ed8518 /src
parenta52b9f3182e6212a0accf1937fee5556e004883d (diff)
Don't hardcode 'localhost' in no @listen parameter is given
If no @listen parameter is given, we must not hardcode 'localhost' since we can't assume we are running on the same host. Instead use the hostname from the connection URI
Diffstat (limited to 'src')
-rw-r--r--src/virt-viewer.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index b4c3b20..3143104 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -332,8 +332,6 @@ virt_viewer_extract_connect_info(VirtViewer *self,
free(xpath);
xpath = g_strdup_printf("string(/domain/devices/graphics[@type='%s']/@listen)", type);
ghost = virt_viewer_extract_xpath_string(xmldesc, xpath);
- if (ghost == NULL)
- ghost = g_strdup("localhost");
}
if (ghost && gport)
@@ -353,11 +351,11 @@ virt_viewer_extract_connect_info(VirtViewer *self,
* from a remote host. Instead we fallback to the hostname used in
* the libvirt URI. This isn't perfect but it is better than nothing
*/
- if (ghost &&
+ if (!ghost ||
(strcmp(ghost, "0.0.0.0") == 0 ||
strcmp(ghost, "::") == 0)) {
- DEBUG_LOG("Guest graphics listen '%s' is a wildcard, replacing with '%s'",
- ghost, host);
+ DEBUG_LOG("Guest graphics listen '%s' is NULL or a wildcard, replacing with '%s'",
+ ghost ? ghost : "", host);
g_free(ghost);
ghost = g_strdup(host);
}