Revision: 4215
          http://tigervnc.svn.sourceforge.net/tigervnc/?rev=4215&view=rev
Author:   atkac
Date:     2010-12-08 13:45:40 +0000 (Wed, 08 Dec 2010)

Log Message:
-----------
[Development] Add "Security" options dialog for Windows viewer.

Modified Paths:
--------------
    trunk/common/rfb/CConnection.h
    trunk/win/vncviewer/OptionsDialog.cxx
    trunk/win/vncviewer/resource.h
    trunk/win/vncviewer/vncviewer.rc

Modified: trunk/common/rfb/CConnection.h
===================================================================
--- trunk/common/rfb/CConnection.h      2010-12-08 13:44:38 UTC (rev 4214)
+++ trunk/common/rfb/CConnection.h      2010-12-08 13:45:40 UTC (rev 4215)
@@ -131,10 +131,10 @@
 
     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();

Modified: trunk/win/vncviewer/OptionsDialog.cxx
===================================================================
--- trunk/win/vncviewer/OptionsDialog.cxx       2010-12-08 13:44:38 UTC (rev 
4214)
+++ trunk/win/vncviewer/OptionsDialog.cxx       2010-12-08 13:45:40 UTC (rev 
4215)
@@ -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,7 +354,139 @@
   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 @@
   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);

Modified: trunk/win/vncviewer/resource.h
===================================================================
--- trunk/win/vncviewer/resource.h      2010-12-08 13:44:38 UTC (rev 4214)
+++ trunk/win/vncviewer/resource.h      2010-12-08 13:45:40 UTC (rev 4215)
@@ -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

Modified: trunk/win/vncviewer/vncviewer.rc
===================================================================
--- trunk/win/vncviewer/vncviewer.rc    2010-12-08 13:44:38 UTC (rev 4214)
+++ trunk/win/vncviewer/vncviewer.rc    2010-12-08 13:45:40 UTC (rev 4215)
@@ -316,6 +316,33 @@
 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


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
What happens now with your Lotus Notes apps - do you make another costly 
upgrade, or settle for being marooned without product support? Time to move
off Lotus Notes and onto the cloud with Force.com, apps are easier to build,
use, and manage than apps on traditional platforms. Sign up for the Lotus 
Notes Migration Kit to learn more. http://p.sf.net/sfu/salesforce-d2d
_______________________________________________
Tigervnc-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tigervnc-commits

Reply via email to