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

Eduardo Lima (Etrunko) etrunko at redhat.com
Fri Feb 3 18:11:04 UTC 2017


With this patch the dialog now shows the host we are trying to connect to.

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_required ? &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,
                                                        &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,
-- 
2.9.3




More information about the virt-tools-list mailing list