forked from rpms/openssh
79 lines
2.5 KiB
Diff
79 lines
2.5 KiB
Diff
diff -up openssh-7.4p1/contrib/gnome-ssh-askpass2.c.progress openssh-7.4p1/contrib/gnome-ssh-askpass2.c
|
|
--- openssh-7.4p1/contrib/gnome-ssh-askpass2.c.progress 2016-12-19 05:59:41.000000000 +0100
|
|
+++ openssh-7.4p1/contrib/gnome-ssh-askpass2.c 2016-12-23 13:31:16.545211926 +0100
|
|
@@ -53,6 +53,7 @@
|
|
#include <string.h>
|
|
#include <unistd.h>
|
|
#include <X11/Xlib.h>
|
|
+#include <glib.h>
|
|
#include <gtk/gtk.h>
|
|
#include <gdk/gdkx.h>
|
|
|
|
@@ -81,14 +82,25 @@ ok_dialog(GtkWidget *entry, gpointer dia
|
|
gtk_dialog_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK);
|
|
}
|
|
|
|
+static void
|
|
+move_progress(GtkWidget *entry, gpointer progress)
|
|
+{
|
|
+ gdouble step;
|
|
+ g_return_if_fail(GTK_IS_PROGRESS_BAR(progress));
|
|
+
|
|
+ step = g_random_double_range(0.03, 0.1);
|
|
+ gtk_progress_bar_set_pulse_step(GTK_PROGRESS_BAR(progress), step);
|
|
+ gtk_progress_bar_pulse(GTK_PROGRESS_BAR(progress));
|
|
+}
|
|
+
|
|
static int
|
|
passphrase_dialog(char *message, int prompt_type)
|
|
{
|
|
const char *failed;
|
|
char *passphrase, *local;
|
|
int result, grab_tries, grab_server, grab_pointer;
|
|
int buttons, default_response;
|
|
- GtkWidget *parent_window, *dialog, *entry;
|
|
+ GtkWidget *parent_window, *dialog, *entry, *progress, *hbox;
|
|
GdkGrabStatus status;
|
|
|
|
grab_server = (getenv("GNOME_SSH_ASKPASS_GRAB_SERVER") != NULL);
|
|
@@ -104,16 +116,37 @@ passphrase_dialog(char *message)
|
|
gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE);
|
|
|
|
if (prompt_type == PROMPT_ENTRY) {
|
|
+ hbox = gtk_hbox_new(FALSE, 0);
|
|
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE,
|
|
+ FALSE, 0);
|
|
+ gtk_widget_show(hbox);
|
|
+
|
|
entry = gtk_entry_new();
|
|
gtk_box_pack_start(
|
|
- GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),
|
|
- entry, FALSE, FALSE, 0);
|
|
+ GTK_BOX(hbox), entry,
|
|
+ TRUE, FALSE, 0);
|
|
+ gtk_entry_set_width_chars(GTK_ENTRY(entry), 2);
|
|
gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE);
|
|
gtk_widget_grab_focus(entry);
|
|
gtk_widget_show(entry);
|
|
/* Make <enter> close dialog */
|
|
g_signal_connect(G_OBJECT(entry), "activate",
|
|
G_CALLBACK(ok_dialog), dialog);
|
|
+
|
|
+ hbox = gtk_hbox_new(FALSE, 0);
|
|
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), hbox, FALSE,
|
|
+ FALSE, 8);
|
|
+ gtk_widget_show(hbox);
|
|
+
|
|
+ progress = gtk_progress_bar_new();
|
|
+
|
|
+ gtk_progress_bar_set_text(GTK_PROGRESS_BAR(progress), "Passphrase length hidden intentionally");
|
|
+ gtk_box_pack_start(GTK_BOX(hbox), progress, TRUE,
|
|
+ TRUE, 5);
|
|
+ gtk_widget_show(progress);
|
|
+ g_signal_connect(G_OBJECT(entry), "changed",
|
|
+ G_CALLBACK(move_progress), progress);
|
|
+
|
|
}
|
|
|
|
/* Grab focus */
|