Blob Blame History Raw
From af43e091e4eb48ba27dd76f84a84874e96658b3c Mon Sep 17 00:00:00 2001
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
Date: Fri, 27 Jan 2017 17:48:11 -0200
Subject: [PATCH 17/26] session-spice: Pass hostname to authentication dialog

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

Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
---
 src/virt-viewer-session-spice.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index c3fce48..9b52ec0 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -691,6 +691,7 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
     case SPICE_CHANNEL_ERROR_AUTH:
     {
         const GError *error = NULL;
+        gchar *host = NULL;
         g_debug("main channel: auth failure (wrong username/password?)");
 
         {
@@ -717,11 +718,13 @@ 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);
+        g_free(host);
         if (!ret) {
             g_signal_emit_by_name(session, "session-cancelled");
         } else {
@@ -750,7 +753,7 @@ virt_viewer_session_spice_main_channel_event(SpiceChannel *channel,
             g_warn_if_fail(proxy != NULL);
 
             ret = virt_viewer_auth_collect_credentials(self->priv->main_window,
-                                                       "proxy", NULL,
+                                                       "proxy", spice_uri_get_hostname(proxy),
                                                        &user, &password);
             if (!ret) {
                 g_signal_emit_by_name(session, "session-cancelled");
-- 
2.12.0