[virt-tools-list] [virt-viewer: PATCH 3/3] Auto fill the username field in the auth dialog

Fabiano Fidêncio fidencio at redhat.com
Tue Sep 23 15:34:05 UTC 2014


---
 src/virt-viewer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/virt-viewer.c b/src/virt-viewer.c
index 513c0b6..8346854 100644
--- a/src/virt-viewer.c
+++ b/src/virt-viewer.c
@@ -640,6 +640,12 @@ virt_viewer_auth_libvirt_credentials(virConnectCredentialPtr cred,
     if (username || password) {
         VirtViewerWindow *vwin = virt_viewer_app_get_main_window(VIRT_VIEWER_APP(app));
         GtkWindow *win = virt_viewer_window_get_window(vwin);
+
+        if (*username == NULL) {
+            /* username will be freed inside the virt_viewer_auth_collect_credentials */
+            *username = g_strdup (g_get_user_name());
+        }
+
         priv->auth_cancelled = !virt_viewer_auth_collect_credentials(win,
                                                                      "libvirt",
                                                                      app->priv->uri,
-- 
1.9.3




More information about the virt-tools-list mailing list