kentpeacock / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone
b58e57
diff -up openssh-7.4p1/contrib/gnome-ssh-askpass2.c.progress openssh-7.4p1/contrib/gnome-ssh-askpass2.c
b58e57
--- openssh-7.4p1/contrib/gnome-ssh-askpass2.c.progress	2016-12-19 05:59:41.000000000 +0100
b58e57
+++ openssh-7.4p1/contrib/gnome-ssh-askpass2.c	2016-12-23 13:31:16.545211926 +0100
b58e57
@@ -53,6 +53,7 @@
b58e57
 #include <string.h>
b58e57
 #include <unistd.h>
b58e57
 #include <X11/Xlib.h>
b58e57
+#include <glib.h>
b58e57
 #include <gtk/gtk.h>
b58e57
 #include <gdk/gdkx.h>
b58e57
 
b58e57
@@ -81,13 +82,24 @@ ok_dialog(GtkWidget *entry, gpointer dia
b58e57
 	gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
b58e57
 }
b58e57
 
b58e57
+static void
b58e57
+move_progress(GtkWidget *entry, gpointer progress)
b58e57
+{
b58e57
+	gdouble step;
b58e57
+	g_return_if_fail(GTK_IS_PROGRESS_BAR(progress));
b58e57
+	
b58e57
+	step = g_random_double_range(0.03, 0.1);
b58e57
+	gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(progress), step);
b58e57
+	gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress));
b58e57
+}
b58e57
+
b58e57
 static int
b58e57
 passphrase_dialog(char *message)
b58e57
 {
b58e57
 	const char *failed;
b58e57
 	char *passphrase, *local;
b58e57
 	int result, grab_tries, grab_server, grab_pointer;
b58e57
-	GtkWidget *parent_window, *dialog, *entry;
b58e57
+	GtkWidget *parent_window, *dialog, *entry, *progress, *hbox;
b58e57
 	GdkGrabStatus status;
b58e57
 
b58e57
 	grab_server = (getenv("GNOME_SSH_ASKPASS_GRAB_SERVER") != NULL);
b58e57
@@ -104,14 +116,32 @@ passphrase_dialog(char *message)
b58e57
 					"%s",
b58e57
 					message);
b58e57
 
b58e57
+	hbox = gtk_hbox_new(FALSE, 0);
b58e57
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE,
b58e57
+	    FALSE, 0);
b58e57
+	gtk_widget_show(hbox);
b58e57
+
b58e57
 	entry = gtk_entry_new();
b58e57
 	gtk_box_pack_start(
b58e57
-	    GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), entry,
b58e57
-	    FALSE, FALSE, 0);
b58e57
+	    GTK_BOX(hbox), entry,
b58e57
+	    TRUE, FALSE, 0);
b58e57
+	gtk_entry_set_width_chars(GTK_ENTRY(entry), 2);
b58e57
 	gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
b58e57
 	gtk_widget_grab_focus(entry);
b58e57
 	gtk_widget_show(entry);
b58e57
 
b58e57
+	hbox = gtk_hbox_new(FALSE, 0);
b58e57
+	gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE,
b58e57
+	    FALSE, 8);
b58e57
+	gtk_widget_show(hbox);
b58e57
+
b58e57
+	progress = gtk_progress_bar_new();
b58e57
+	
b58e57
+	gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), "Passphrase length hidden intentionally");
b58e57
+	gtk_box_pack_start(GTK_BOX(hbox), progress, TRUE,
b58e57
+	    TRUE, 5);
b58e57
+	gtk_widget_show(progress);
b58e57
+
b58e57
 	gtk_window_set_title(GTK_WINDOW(dialog), "OpenSSH");
b58e57
 	gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
b58e57
 	gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
b58e57
@@ -120,6 +150,8 @@ passphrase_dialog(char *message)
b58e57
 	gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
b58e57
 	g_signal_connect(G_OBJECT(entry), "activate",
b58e57
 			 G_CALLBACK(ok_dialog), dialog);
b58e57
+	g_signal_connect(G_OBJECT(entry), "changed",
b58e57
+			 G_CALLBACK(move_progress), progress);
b58e57
 
b58e57
 	gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
b58e57