rutwa189 / rpms / openssh

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