diff options
author | Pierre Ossman <ossman@cendio.se> | 2017-09-01 11:14:35 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-09-01 11:14:35 +0200 |
commit | daf3d88aa1b554c5d6d41116c51517d30cb7c4b7 (patch) | |
tree | c8c8ca00aa1a07fe00d05f88ea96ebe1498eff1c /vncviewer/UserDialog.cxx | |
parent | 10a48102a4a892daee8ea325f008fccf9663b236 (diff) | |
download | tigervnc-daf3d88aa1b554c5d6d41116c51517d30cb7c4b7.tar.gz tigervnc-daf3d88aa1b554c5d6d41116c51517d30cb7c4b7.zip |
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.
Diffstat (limited to 'vncviewer/UserDialog.cxx')
-rw-r--r-- | vncviewer/UserDialog.cxx | 31 |
1 files changed, 28 insertions, 3 deletions
diff --git a/vncviewer/UserDialog.cxx b/vncviewer/UserDialog.cxx index cf6893c8..640f2a98 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 @@ UserDialog::~UserDialog() { } -void UserDialog::getUserPasswd(char** user, char** password) +void UserDialog::getUserPasswd(bool secure, char** user, char** password) { CharArray passwordFileStr(passwordFile.getData()); @@ -83,6 +94,7 @@ void UserDialog::getUserPasswd(char** user, char** password) } Fl_Window *win; + Fl_Box *banner; Fl_Input *username; Fl_Secret_Input *passwd; Fl_Box *icon; @@ -93,9 +105,22 @@ void UserDialog::getUserPasswd(char** user, char** password) 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); + } + + y = 20 + 10; - icon = new Fl_Box(10, 10, 50, 50, "?"); + icon = new Fl_Box(10, y, 50, 50, "?"); icon->box(FL_UP_BOX); icon->labelfont(FL_TIMES_BOLD); icon->labelsize(34); |