rcolebaugh / rpms / openssh

Forked from rpms/openssh 2 years ago
Clone

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

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