jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

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

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