Display security state when asking for password
Indicate to the user how secure the transport channel is so they
can avoid entering their password for untrusted sites.
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx
index cf6893c..640f2a9 100644
--- a/vncviewer/UserDialog.cxx
+++ b/vncviewer/UserDialog.cxx
@@ -32,6 +32,7 @@
#include <FL/Fl_Secret_Input.H>
#include <FL/Fl_Button.H>
#include <FL/Fl_Return_Button.H>
+#include <FL/Fl_Pixmap.H>
#include <rfb/util.h>
#include <rfb/Password.h>
@@ -42,8 +43,18 @@
#include "parameters.h"
#include "UserDialog.h"
+/* xpm:s predate const, so they have invalid definitions */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wwrite-strings"
+#include "../media/secure.xpm"
+#include "../media/insecure.xpm"
+#pragma GCC diagnostic pop
+
using namespace rfb;
+static Fl_Pixmap secure_icon(secure);
+static Fl_Pixmap insecure_icon(insecure);
+
static int ret_val = 0;
static void button_cb(Fl_Widget *widget, void *val) {
@@ -59,7 +70,7 @@
{
}
-void UserDialog::getUserPasswd(char** user, char** password)
+void UserDialog::getUserPasswd(bool secure, char** user, char** password)
{
CharArray passwordFileStr(passwordFile.getData());
@@ -83,6 +94,7 @@
}
Fl_Window *win;
+ Fl_Box *banner;
Fl_Input *username;
Fl_Secret_Input *passwd;
Fl_Box *icon;
@@ -93,9 +105,22 @@
win = new Fl_Window(410, 145, _("VNC authentication"));
win->callback(button_cb,(void *)0);
- y = 10;
+ banner = new Fl_Box(0, 0, win->w(), 20);
+ banner->align(FL_ALIGN_CENTER|FL_ALIGN_INSIDE|FL_ALIGN_IMAGE_NEXT_TO_TEXT);
+ banner->box(FL_FLAT_BOX);
+ if (secure) {
+ banner->label(_("This connection is secure"));
+ banner->color(FL_GREEN);
+ banner->image(secure_icon);
+ } else {
+ banner->label(_("This connection is not secure"));
+ banner->color(FL_RED);
+ banner->image(insecure_icon);
+ }
- icon = new Fl_Box(10, 10, 50, 50, "?");
+ y = 20 + 10;
+
+ icon = new Fl_Box(10, y, 50, 50, "?");
icon->box(FL_UP_BOX);
icon->labelfont(FL_TIMES_BOLD);
icon->labelsize(34);
diff --git a/vncviewer/UserDialog.h b/vncviewer/UserDialog.h
index c6756a8..b62ba7f 100644
--- a/vncviewer/UserDialog.h
+++ b/vncviewer/UserDialog.h
@@ -31,7 +31,7 @@
// UserPasswdGetter callbacks
- void getUserPasswd(char** user, char** password);
+ void getUserPasswd(bool secure, char** user, char** password);
// UserMsgBox callbacks