summaryrefslogtreecommitdiffstats
path: root/src/virt-viewer-session-vnc.c
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2012-04-18 15:20:48 +0100
committerDaniel P. Berrange <berrange@redhat.com>2012-04-23 09:42:34 +0100
commit7ab88ea17946f4e9c1c4bdae44ceafc3b6f6e0dd (patch)
tree04a525f7fca5ef6087bf8214ea7d6b9c52569a72 /src/virt-viewer-session-vnc.c
parentc1af3ab0cc3aad382f6bd396f62ae76f3052c553 (diff)
downloadvirt-viewer-7ab88ea17946f4e9c1c4bdae44ceafc3b6f6e0dd.tar.gz
virt-viewer-7ab88ea17946f4e9c1c4bdae44ceafc3b6f6e0dd.tar.xz
virt-viewer-7ab88ea17946f4e9c1c4bdae44ceafc3b6f6e0dd.zip
Add support for raw IPv6 addresses in VNC & libvirt URIs
Support vnc://[x:y:z:]:5901/ for raw IPv6 addresses in URIs, and qemu+ssh://root@[x:y:x:]:22/ for raw IPv6 addresses in libvirt URIs
Diffstat (limited to 'src/virt-viewer-session-vnc.c')
-rw-r--r--src/virt-viewer-session-vnc.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/virt-viewer-session-vnc.c b/src/virt-viewer-session-vnc.c
index 3e27566..238c865 100644
--- a/src/virt-viewer-session-vnc.c
+++ b/src/virt-viewer-session-vnc.c
@@ -197,6 +197,7 @@ virt_viewer_session_vnc_open_uri(VirtViewerSession* session,
VirtViewerSessionVnc *self = VIRT_VIEWER_SESSION_VNC(session);
xmlURIPtr uri = NULL;
gchar *portstr;
+ gchar *hoststr = NULL;
gboolean ret;
g_return_val_if_fail(self != NULL, FALSE);
@@ -207,8 +208,22 @@ virt_viewer_session_vnc_open_uri(VirtViewerSession* session,
portstr = g_strdup_printf("%d", uri->port);
- ret = vnc_display_open_host(self->priv->vnc, uri->server, portstr);
+ if (uri->server) {
+ if (uri->server[0] == '[') {
+ gchar *tmp;
+ hoststr = g_strdup(uri->server + 1);
+ if ((tmp = strchr(hoststr, ']')))
+ *tmp = '\0';
+ } else {
+ hoststr = g_strdup(uri->server);
+ }
+ }
+
+ ret = vnc_display_open_host(self->priv->vnc,
+ hoststr,
+ portstr);
g_free(portstr);
+ g_free(hoststr);
xmlFreeURI(uri);
return ret;
}