jonathancammack / rpms / openssh

Forked from rpms/openssh 8 months ago
Clone

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

9070b3
diff -up openssh-7.4p1/contrib/gnome-ssh-askpass2.c.progress openssh-7.4p1/contrib/gnome-ssh-askpass2.c
9070b3
--- openssh-7.4p1/contrib/gnome-ssh-askpass2.c.progress	2016-12-19 05:59:41.000000000 +0100
9070b3
+++ openssh-7.4p1/contrib/gnome-ssh-askpass2.c	2016-12-23 13:31:16.545211926 +0100
9070b3
@@ -53,6 +53,7 @@
9070b3
 #include <unistd.h>
9070b3
 
9070b3
 #include <X11/Xlib.h>
9070b3
+#include <glib.h>
9070b3
 #include <gtk/gtk.h>
9070b3
 #include <gdk/gdkx.h>
9070b3
 #include <gdk/gdkkeysyms.h>
9070b3
@@ -81,14 +82,25 @@ ok_dialog(GtkWidget *entry, gpointer dia
9070b3
 	return 1;
9070b3
 }
9070b3
 
9070b3
+static void
9070b3
+move_progress(GtkWidget *entry, gpointer progress)
9070b3
+{
9070b3
+	gdouble step;
9070b3
+	g_return_if_fail(GTK_IS_PROGRESS_BAR(progress));
9070b3
+	
9070b3
+	step = g_random_double_range(0.03, 0.1);
9070b3
+	gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(progress), step);
9070b3
+	gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress));
9070b3
+}
9070b3
+
9070b3
 static int
9070b3
 passphrase_dialog(char *message, int prompt_type)
9070b3
 {
9070b3
 	const char *failed;
9070b3
 	char *passphrase, *local;
9070b3
 	int result, grab_tries, grab_server, grab_pointer;
9070b3
 	int buttons, default_response;
9070b3
-	GtkWidget *parent_window, *dialog, *entry;
9070b3
+	GtkWidget *parent_window, *dialog, *entry, *progress, *hbox;
9070b3
 	GdkGrabStatus status;
9070b3
 	GdkColor fg, bg;
9070b3
 	int fg_set = 0, bg_set = 0;
9070b3
@@ -104,14 +116,19 @@ passphrase_dialog(char *message)
9070b3
 		gtk_widget_modify_bg(dialog, GTK_STATE_NORMAL, &bg;;
9070b3
 
9070b3
 	if (prompt_type == PROMPT_ENTRY || prompt_type == PROMPT_NONE) {
9070b3
+		hbox = gtk_hbox_new(FALSE, 0);
9070b3
+		gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE,
9070b3
+		    FALSE, 0);
9070b3
+		gtk_widget_show(hbox);
9070b3
+
9070b3
		entry = gtk_entry_new();
9070b3
		if (fg_set)
9070b3
			gtk_widget_modify_fg(entry, GTK_STATE_NORMAL, &fg;;
9070b3
		if (bg_set)
9070b3
			gtk_widget_modify_bg(entry, GTK_STATE_NORMAL, &bg;;
9070b3
		gtk_box_pack_start(
9070b3
-		    GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
9070b3
-		    entry, FALSE, FALSE, 0);
9070b3
+		    GTK_BOX(hbox), entry, TRUE, FALSE, 0);
9070b3
+		gtk_entry_set_width_chars(GTK_ENTRY(entry), 2);
9070b3
 		gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
9070b3
 		gtk_widget_grab_focus(entry);
9070b3
 		if (prompt_type == PROMPT_ENTRY) {
9070b3
@@ -130,6 +145,22 @@ passphrase_dialog(char *message)
9070b3
 			g_signal_connect(G_OBJECT(entry), "key_press_event",
9070b3
 			    G_CALLBACK(check_none), dialog);
9070b3
 		}
9070b3
+
9070b3
+		hbox = gtk_hbox_new(FALSE, 0);
9070b3
+		gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox),
9070b3
+		    hbox, FALSE, FALSE, 8);
9070b3
+		gtk_widget_show(hbox);
9070b3
+
9070b3
+		progress = gtk_progress_bar_new();
9070b3
+
9070b3
+		gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress),
9070b3
+		    "Passphrase length hidden intentionally");
9070b3
+		gtk_box_pack_start(GTK_BOX(hbox), progress, TRUE,
9070b3
+		    TRUE, 5);
9070b3
+		gtk_widget_show(progress);
9070b3
+		g_signal_connect(G_OBJECT(entry), "changed",
9070b3
+				 G_CALLBACK(move_progress), progress);
9070b3
+
9070b3
 	}
9070b3
 
9070b3
 	/* Grab focus */