rutwa189 / rpms / openssh

Forked from rpms/openssh a year ago
Clone

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

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