diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2012-04-18 15:20:48 +0100 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2012-04-23 09:42:34 +0100 |
commit | 7ab88ea17946f4e9c1c4bdae44ceafc3b6f6e0dd (patch) | |
tree | 04a525f7fca5ef6087bf8214ea7d6b9c52569a72 /src/virt-viewer-util.c | |
parent | c1af3ab0cc3aad382f6bd396f62ae76f3052c553 (diff) | |
download | virt-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-util.c')
-rw-r--r-- | src/virt-viewer-util.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/virt-viewer-util.c b/src/virt-viewer-util.c index e4a0cc4..c1182af 100644 --- a/src/virt-viewer-util.c +++ b/src/virt-viewer-util.c @@ -91,10 +91,18 @@ virt_viewer_util_extract_host(const char *uristr, g_return_val_if_fail(uri != NULL, 1); if (host) { - if (!uri || !uri->server) + if (!uri || !uri->server) { *host = g_strdup("localhost"); - else - *host = g_strdup(uri->server); + } else { + if (uri->server[0] == '[') { + gchar *tmp; + *host = g_strdup(uri->server + 1); + if ((tmp = strchr(*host, ']'))) + *tmp = '\0'; + } else { + *host = g_strdup(uri->server); + } + } } if (user) { |