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

Re: [virt-tools-list] [PATCH virt-viewer] Add support for raw IPv6 addresses in VNC URIs



On Wed, Apr 18, 2012 at 01:24:56PM -0400, Laine Stump wrote:
> On 04/18/2012 11:44 AM, Daniel P. Berrange wrote:
> > From: "Daniel P. Berrange" <berrange redhat com>
> >
> > Support   vnc://[x:y:z:]:5901/  for raw IPv6 addresses in URIs
> > ---
> >  src/virt-viewer-session-vnc.c |   17 ++++++++++++++++-
> >  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;
> >  }
> 
> ACK to this, but it looks like it would be good to give the same
> treatment to the results of xmlParseURI in
> virt_viewer_util_extract_host() (although to tell the truth this is the
> first time I've looked at this code, so I'm not sure exactly when/how
> it's used :-).

Well spotted. I fixed the code related to VNC URIs. The function you
point out is related to libvirt URIs which needs the same fix


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|


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