[virt-tools-list] [PATCH virt-viewer] session-spice: Pass hostname to authentication dialog

Pavel Grunt pgrunt at redhat.com
Mon Feb 6 11:20:21 UTC 2017


On Fri, 2017-02-03 at 16:11 -0200, Eduardo Lima (Etrunko) wrote:
> With this patch the dialog now shows the host we are trying to
> connect to.

I would mention that we use the "host" property of SpiceSession 

> 
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>

---
>  src/virt-viewer-session-spice.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-
> session-spice.c
> index c3fce48..bbdc680 100644
> --- a/src/virt-viewer-session-spice.c
> +++ b/src/virt-viewer-session-spice.c
> @@ -667,7 +667,7 @@
> virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
>                                               VirtViewerSession
> *session)
>  {
>      VirtViewerSessionSpice *self =
> VIRT_VIEWER_SESSION_SPICE(session);
> -    gchar *password = NULL, *user = NULL;
> +    gchar *password = NULL, *user = NULL, *host = NULL;
>      gboolean ret;
>      static gboolean username_required = FALSE;
>  
> @@ -717,9 +717,10 @@
> virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
>                  user = g_strdup(g_get_user_name());
>          }
>  
> +        g_object_get(self->priv->session, "host", &host, NULL);
>          ret = virt_viewer_auth_collect_credentials(self->priv-
> >main_window,
>                                                     "SPICE",
> -                                                   NULL,
> +                                                   host,
>                                                     username_require
> d ? &user : NULL,
>                                                     &password);
>          if (!ret) {
> @@ -749,8 +750,9 @@
> virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
>              SpiceURI *proxy = spice_session_get_proxy_uri(self-
> >priv->session);
>              g_warn_if_fail(proxy != NULL);
>  
> +            g_object_get(self->priv->session, "host", &host, NULL);
>              ret = virt_viewer_auth_collect_credentials(self->priv-
> >main_window,
> -                                                       "proxy",
> NULL,
> +                                                       "proxy",
> host,

Should it be the "host" or the proxy uri (spice_uri_get_hostname()) ?

Pavel

>                                                         &user,
> &password);
>              if (!ret) {
>                  g_signal_emit_by_name(session, "session-
> cancelled");
> @@ -776,6 +778,7 @@
> virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
>  
>      g_free(password);
>      g_free(user);
> +    g_free(host);
>  }
>  
>  static void remove_cb(GtkContainer   *container G_GNUC_UNUSED,




More information about the virt-tools-list mailing list