vishalmishra434 / rpms / openssh

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