jonathancammack / rpms / openssh

Forked from rpms/openssh 9 months ago
Clone

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

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