summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Tkac <atkac@redhat.com>2010-12-08 13:45:40 +0000
committerAdam Tkac <atkac@redhat.com>2010-12-08 13:45:40 +0000
commitd3b4deac38b30dcd692bff14ca9066127dd2a797 (patch)
treec4d3fc710a1d20d52dcd72812127e1f44d6e11d5
parent9d84654b1017f5477dadac62a0f59eb7f05e2769 (diff)
downloadtigervnc-d3b4deac38b30dcd692bff14ca9066127dd2a797.tar.gz
tigervnc-d3b4deac38b30dcd692bff14ca9066127dd2a797.zip
[Development] Add "Security" options dialog for Windows viewer.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4215 3789f03b-4d11-0410-bbf8-ca57d06f2519
-rw-r--r--common/rfb/CConnection.h4
-rw-r--r--win/vncviewer/OptionsDialog.cxx138
-rw-r--r--win/vncviewer/resource.h10
-rw-r--r--win/vncviewer/vncviewer.rc27
4 files changed, 177 insertions, 2 deletions
diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h
index eb8c1c3f..db236bc9 100644
--- a/common/rfb/CConnection.h
+++ b/common/rfb/CConnection.h
@@ -131,10 +131,10 @@ namespace rfb {
stateEnum state() { return state_; }
- CSecurity *csecurity; /* Windows viewer needs it exported. */
+ CSecurity *csecurity;
+ SecurityClient *security;
protected:
void setState(stateEnum s) { state_ = s; }
- SecurityClient *security;
private:
void processVersionMsg();
diff --git a/win/vncviewer/OptionsDialog.cxx b/win/vncviewer/OptionsDialog.cxx
index c2c2fc90..b3d72f2e 100644
--- a/win/vncviewer/OptionsDialog.cxx
+++ b/win/vncviewer/OptionsDialog.cxx
@@ -26,9 +26,14 @@
#include <rfb/CConnection.h>
#include <commdlg.h>
#include <rfb/LogWriter.h>
+#include <rfb/Security.h>
+#include <list>
+
+using namespace rdr;
using namespace rfb;
using namespace rfb::win32;
+using namespace std;
static LogWriter vlog("Options");
@@ -349,6 +354,138 @@ protected:
OptionsInfo* dlg;
};
+class SecurityPage : public PropSheetPage {
+public:
+ SecurityPage(OptionsInfo* dlg_, Security *security_)
+ : PropSheetPage(GetModuleHandle(0), MAKEINTRESOURCE(IDD_SECURITY)),
+ dlg(dlg_), security(security_) {
+ }
+ virtual void initDialog() {
+ enableVeNCryptFeatures(false);
+
+ /* Process non-VeNCrypt sectypes */
+ list<U8> secTypes = security->GetEnabledSecTypes();
+ list<U8>::iterator i;
+
+ for (i = secTypes.begin(); i != secTypes.end(); i++) {
+ switch (*i) {
+ case secTypeVeNCrypt:
+ enableVeNCryptFeatures(true);
+ setItemChecked(IDC_VENCRYPT, true);
+ break;
+ case secTypeNone:
+ setItemChecked(IDC_ENC_NONE, true);
+ setItemChecked(IDC_AUTH_NONE, true);
+ break;
+ case secTypeVncAuth:
+ setItemChecked(IDC_ENC_NONE, true);
+ setItemChecked(IDC_AUTH_VNC, true);
+ break;
+ }
+ }
+
+ /* Process VeNCrypt subtypes */
+ if (isItemChecked(IDC_VENCRYPT)) {
+ list<U32> secTypesExt = security->GetEnabledExtSecTypes();
+ list<U32>::iterator iext;
+ for (iext = secTypesExt.begin(); iext != secTypesExt.end(); iext++) {
+ switch (*iext) {
+ case secTypePlain:
+ setItemChecked(IDC_ENC_NONE, true);
+ setItemChecked(IDC_AUTH_PLAIN, true);
+ break;
+ case secTypeTLSNone:
+ setItemChecked(IDC_ENC_TLS, true);
+ setItemChecked(IDC_AUTH_NONE, true);
+ break;
+ case secTypeTLSVnc:
+ setItemChecked(IDC_ENC_TLS, true);
+ setItemChecked(IDC_AUTH_VNC, true);
+ break;
+ case secTypeTLSPlain:
+ setItemChecked(IDC_ENC_TLS, true);
+ setItemChecked(IDC_AUTH_PLAIN, true);
+ break;
+ case secTypeX509None:
+ setItemChecked(IDC_ENC_X509, true);
+ setItemChecked(IDC_AUTH_NONE, true);
+ enableItem(IDC_LOAD_CACERT, true);
+ enableItem(IDC_LOAD_CRLCERT, true);
+ break;
+ case secTypeX509Vnc:
+ setItemChecked(IDC_ENC_X509, true);
+ setItemChecked(IDC_AUTH_VNC, true);
+ enableItem(IDC_LOAD_CACERT, true);
+ enableItem(IDC_LOAD_CRLCERT, true);
+ break;
+ case secTypeX509Plain:
+ setItemChecked(IDC_ENC_X509, true);
+ setItemChecked(IDC_AUTH_PLAIN, true);
+ enableItem(IDC_LOAD_CACERT, true);
+ enableItem(IDC_LOAD_CRLCERT, true);
+ break;
+ }
+ }
+ }
+ }
+ virtual bool onCommand(int id, int cmd) {
+ switch (id) {
+ case IDC_VENCRYPT:
+ enableVeNCryptFeatures(isItemChecked(IDC_VENCRYPT));
+ break;
+ case IDC_ENC_NONE:
+ break;
+ case IDC_ENC_TLS:
+ break;
+ case IDC_ENC_X509:
+ if (isItemChecked(IDC_ENC_X509)) {
+ enableItem(IDC_LOAD_CACERT, true);
+ enableItem(IDC_LOAD_CRLCERT, true);
+ } else {
+ enableItem(IDC_LOAD_CACERT, false);
+ enableItem(IDC_LOAD_CRLCERT, false);
+ }
+ break;
+ case IDC_LOAD_CACERT:
+ break;
+ case IDC_LOAD_CRLCERT:
+ break;
+ case IDC_AUTH_NONE:
+ break;
+ case IDC_AUTH_VNC:
+ break;
+ case IDC_AUTH_PLAIN:
+ break;
+ default:
+ throw rdr::Exception("Unhandled action in SecurityPage");
+ }
+ return true;
+ }
+protected:
+ OptionsInfo* dlg;
+private:
+ Security *security;
+
+ void enableVeNCryptFeatures(bool enable) {
+ if (enable) {
+ enableItem(IDC_ENC_TLS, true);
+ enableItem(IDC_ENC_X509, true);
+ enableItem(IDC_AUTH_PLAIN, true);
+ } else {
+ disableFeature(IDC_ENC_TLS);
+ disableFeature(IDC_ENC_X509);
+ disableFeature(IDC_AUTH_PLAIN);
+ enableItem(IDC_LOAD_CACERT, false);
+ enableItem(IDC_LOAD_CRLCERT, false);
+ }
+ }
+
+ void disableFeature(int id) {
+ enableItem(id, false);
+ setItemChecked(id, false);
+ }
+};
+
OptionsDialog::OptionsDialog() : visible(false) {
}
@@ -369,6 +506,7 @@ bool OptionsDialog::showDialog(CConn* view, bool capture) {
InputsPage inputsPage(&info); pages.push_back(&inputsPage);
MiscPage miscPage(&info); pages.push_back(&miscPage);
DefaultsPage defPage(&info); if (view) pages.push_back(&defPage);
+ SecurityPage secPage(&info, view->security); pages.push_back(&secPage);
// Show the property sheet
ViewerOptions dialog(info, pages);
diff --git a/win/vncviewer/resource.h b/win/vncviewer/resource.h
index a9a2b969..0487c5e8 100644
--- a/win/vncviewer/resource.h
+++ b/win/vncviewer/resource.h
@@ -16,6 +16,7 @@
#define IDR_TRAY 112
#define IDD_CONNECTION_INFO 113
#define IDD_DEFAULTS 116
+#define IDD_SECURITY 117
#define IDB_BITMAP 120
#define IDB_TOOLBAR 122
#define IDC_PASSWORD 1000
@@ -86,6 +87,15 @@
#define IDC_STATIC_SCALE 1097
#define IDC_COMBO_SCALE 1098
#define IDC_STATIC_PERCENT 1099
+#define IDC_VENCRYPT 1200
+#define IDC_ENC_NONE 1201
+#define IDC_ENC_TLS 1202
+#define IDC_ENC_X509 1203
+#define IDC_LOAD_CACERT 1204
+#define IDC_LOAD_CRLCERT 1205
+#define IDC_AUTH_NONE 1206
+#define IDC_AUTH_VNC 1207
+#define IDC_AUTH_PLAIN 1208
#define ID_TOOLBAR 4002
#define ID_CLOSE 4003
#define ID_OPTIONS 4004
diff --git a/win/vncviewer/vncviewer.rc b/win/vncviewer/vncviewer.rc
index 60aa6363..ed89a4ea 100644
--- a/win/vncviewer/vncviewer.rc
+++ b/win/vncviewer/vncviewer.rc
@@ -316,6 +316,33 @@ BEGIN
END
+IDD_SECURITY DIALOG DISCARDABLE 0, 0, 200, 200
+STYLE DS_MODALFRAME | DS_CONTROL | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Security"
+FONT 8, "MS Sans Serif"
+BEGIN
+ CONTROL "Extended encryption and authentication methods (VeNCrypt)",
+ IDC_VENCRYPT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ 7,10,200,15
+ GROUPBOX "Session encryption", IDC_STATIC, 7,25,120,60
+ CONTROL "None", IDC_ENC_NONE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ 10,35,50,15
+ CONTROL "Anonymous TLS", IDC_ENC_TLS, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 10,50,80,15
+ CONTROL "TLS with X.509 certificates", IDC_ENC_X509, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 10,65,110,15
+ GROUPBOX "X.509 certificates", IDC_STATIC, 7,90,170,30
+ PUSHBUTTON "Load CA certificate", IDC_LOAD_CACERT, 10,100,80,15
+ PUSHBUTTON "Load CRL certificate", IDC_LOAD_CRLCERT, 90,100,80,15
+ GROUPBOX "Authentication", IDC_STATIC, 7,125,100,60
+ CONTROL "None", IDC_AUTH_NONE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
+ 10,135,50,15
+ CONTROL "Standard VNC", IDC_AUTH_VNC, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 10,150,80,15
+ CONTROL "Plaintext", IDC_AUTH_PLAIN, "Button",
+ BS_AUTOCHECKBOX | WS_TABSTOP, 10,165,70,15
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO