rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

Blame SOURCES/openssh-5.1p1-askpass-progress.patch

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