kentpeacock / rpms / openssh

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