Removes VeNCrypt-checkbox from the security page in the WinVNC options. Fixes bug #142.



git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5159 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/win/rfb_win32/SecurityPage.cxx b/win/rfb_win32/SecurityPage.cxx
index 1515727..f0c21af 100644
--- a/win/rfb_win32/SecurityPage.cxx
+++ b/win/rfb_win32/SecurityPage.cxx
@@ -50,17 +50,16 @@
   list<U8> secTypes;
   list<U8>::iterator i;
 
-  enableVeNCryptFeatures(false);
+  if (isItemChecked(IDC_ENC_X509))
+    enableX509Dialogs();
+  else
+    disableX509Dialogs();
 
   secTypes = security->GetEnabledSecTypes();
 
   /* Process non-VeNCrypt sectypes */
   for (i = secTypes.begin(); i != secTypes.end(); i++) {
     switch (*i) {
-    case secTypeVeNCrypt:
-      enableVeNCryptFeatures(true);
-      setItemChecked(IDC_VENCRYPT, true);
-      break;
     case secTypeNone:
       enableAuthMethod(IDC_ENC_NONE, IDC_AUTH_NONE);
       break;
@@ -76,34 +75,32 @@
   secTypesExt = security->GetEnabledExtSecTypes();
 
   /* Process VeNCrypt subtypes */
-  if (isItemChecked(IDC_VENCRYPT)) {
-    for (iext = secTypesExt.begin(); iext != secTypesExt.end(); iext++) {
-      switch (*iext) {
-      case secTypePlain:
-	enableAuthMethod(IDC_ENC_NONE, IDC_AUTH_PLAIN);
-	break;
-      case secTypeTLSNone:
-	enableAuthMethod(IDC_ENC_TLS, IDC_AUTH_NONE);
-	break;
-      case secTypeTLSVnc:
-	enableAuthMethod(IDC_ENC_TLS, IDC_AUTH_VNC);
-	break;
-      case secTypeTLSPlain:
-	enableAuthMethod(IDC_ENC_TLS, IDC_AUTH_PLAIN);
-	break;
-      case secTypeX509None:
-	enableAuthMethod(IDC_ENC_X509, IDC_AUTH_NONE);
-        enableX509Dialogs();
-	break;
-      case secTypeX509Vnc:
-	enableAuthMethod(IDC_ENC_X509, IDC_AUTH_VNC);
-        enableX509Dialogs();
-	break;
-      case secTypeX509Plain:
-	enableAuthMethod(IDC_ENC_X509, IDC_AUTH_PLAIN);
-        enableX509Dialogs();
-	break;
-      }
+  for (iext = secTypesExt.begin(); iext != secTypesExt.end(); iext++) {
+    switch (*iext) {
+    case secTypePlain:
+      enableAuthMethod(IDC_ENC_NONE, IDC_AUTH_PLAIN);
+      break;
+    case secTypeTLSNone:
+      enableAuthMethod(IDC_ENC_TLS, IDC_AUTH_NONE);
+      break;
+    case secTypeTLSVnc:
+      enableAuthMethod(IDC_ENC_TLS, IDC_AUTH_VNC);
+      break;
+    case secTypeTLSPlain:
+      enableAuthMethod(IDC_ENC_TLS, IDC_AUTH_PLAIN);
+      break;
+    case secTypeX509None:
+      enableAuthMethod(IDC_ENC_X509, IDC_AUTH_NONE);
+      enableX509Dialogs();
+      break;
+    case secTypeX509Vnc:
+      enableAuthMethod(IDC_ENC_X509, IDC_AUTH_VNC);
+      enableX509Dialogs();
+      break;
+    case secTypeX509Plain:
+      enableAuthMethod(IDC_ENC_X509, IDC_AUTH_PLAIN);
+      enableX509Dialogs();
+      break;
     }
   }
 }
@@ -111,9 +108,7 @@
 bool
 SecurityPage::onCommand(int id, int cmd)
 {
-  if (id == IDC_VENCRYPT) {
-    enableVeNCryptFeatures(isItemChecked(IDC_VENCRYPT));
-  } else if (id == IDC_ENC_X509) {
+  if (id == IDC_ENC_X509) {
     if (isItemChecked(IDC_ENC_X509))
       enableX509Dialogs();
     else
@@ -130,45 +125,43 @@
   list<U32> secTypes;
 
   /* Keep same priorities as in common/rfb/SecurityClient::secTypes */
-  if (isItemChecked(IDC_VENCRYPT)) {
-    secTypes.push_back(secTypeVeNCrypt);
+  secTypes.push_back(secTypeVeNCrypt);
 
 #ifdef HAVE_GNUTLS
-    /* X509Plain */
-    if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_PLAIN)) {
-      loadX509Certs(x509_loaded);
-      secTypes.push_back(secTypeX509Plain);
-    }
-
-    /* TLSPlain */
-    if (authMethodEnabled(IDC_ENC_TLS, IDC_AUTH_PLAIN))
-      secTypes.push_back(secTypeTLSPlain);
-
-    /* X509Vnc */
-    if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_VNC)) {
-      loadX509Certs(x509_loaded);
-      loadVncPasswd(vnc_loaded);
-      secTypes.push_back(secTypeX509Vnc);
-    }
-
-    /* TLSVnc */
-    if (authMethodEnabled(IDC_ENC_TLS, IDC_AUTH_VNC)) {
-      loadVncPasswd(vnc_loaded);
-      secTypes.push_back(secTypeTLSVnc);
-    }
-
-    /* X509None */
-    if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_NONE)) {
-      loadX509Certs(x509_loaded);
-      secTypes.push_back(secTypeX509None);
-    }
-
-    /* TLSNone */
-    if (authMethodEnabled(IDC_ENC_TLS, IDC_AUTH_NONE))
-      secTypes.push_back(secTypeTLSNone);
-#endif
+  /* X509Plain */
+  if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_PLAIN)) {
+    loadX509Certs(x509_loaded);
+    secTypes.push_back(secTypeX509Plain);
   }
 
+  /* TLSPlain */
+  if (authMethodEnabled(IDC_ENC_TLS, IDC_AUTH_PLAIN))
+    secTypes.push_back(secTypeTLSPlain);
+
+  /* X509Vnc */
+  if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_VNC)) {
+    loadX509Certs(x509_loaded);
+    loadVncPasswd(vnc_loaded);
+    secTypes.push_back(secTypeX509Vnc);
+  }
+
+  /* TLSVnc */
+  if (authMethodEnabled(IDC_ENC_TLS, IDC_AUTH_VNC)) {
+    loadVncPasswd(vnc_loaded);
+    secTypes.push_back(secTypeTLSVnc);
+  }
+
+  /* X509None */
+  if (authMethodEnabled(IDC_ENC_X509, IDC_AUTH_NONE)) {
+    loadX509Certs(x509_loaded);
+    secTypes.push_back(secTypeX509None);
+  }
+
+  /* TLSNone */
+  if (authMethodEnabled(IDC_ENC_TLS, IDC_AUTH_NONE))
+    secTypes.push_back(secTypeTLSNone);
+#endif
+
   /* VncAuth */
   if (authMethodEnabled(IDC_ENC_NONE, IDC_AUTH_VNC)) {
     loadVncPasswd(vnc_loaded);
@@ -185,21 +178,6 @@
 }
 
 inline void
-SecurityPage::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);
-    disableX509Dialogs();
-  }
-}
-
-inline void
 SecurityPage::disableFeature(int id)
 {
   enableItem(id, false);
diff --git a/win/rfb_win32/resource.h b/win/rfb_win32/resource.h
index aedfbda..652deb2 100644
--- a/win/rfb_win32/resource.h
+++ b/win/rfb_win32/resource.h
@@ -27,7 +27,6 @@
 
 #define IDD_SECURITY		117
 
-#define IDC_VENCRYPT		1200
 #define IDC_ENC_NONE		1201
 #define IDC_ENC_TLS		1202
 #define IDC_ENC_X509		1203
diff --git a/win/vncconfig/vncconfig.rc b/win/vncconfig/vncconfig.rc
index 5ca892a..b49d744 100644
--- a/win/vncconfig/vncconfig.rc
+++ b/win/vncconfig/vncconfig.rc
@@ -71,35 +71,32 @@
 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
+    GROUPBOX		"Session encryption", IDC_STATIC, 7,10,120,60
     CONTROL		"None", IDC_ENC_NONE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-			10,35,50,15
+			10,20,50,15
     CONTROL		"Anonymous TLS", IDC_ENC_TLS, "Button",
-			BS_AUTOCHECKBOX | WS_TABSTOP, 10,50,80,15
+			BS_AUTOCHECKBOX | WS_TABSTOP, 10,35,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,185,30
-    PUSHBUTTON		"Load X.509 Certificate", IDC_LOAD_CERT, 10,100,80,15
-    PUSHBUTTON		"Load X.509 Certificate key", IDC_LOAD_CERTKEY, 90,100,100,15
-    GROUPBOX		"Authentication", IDC_STATIC, 7,125,170,60
+			BS_AUTOCHECKBOX | WS_TABSTOP, 10,50,110,15
+    GROUPBOX		"X.509 certificates", IDC_STATIC, 7,75,185,30
+    PUSHBUTTON		"Load X.509 Certificate", IDC_LOAD_CERT, 10,85,80,15
+    PUSHBUTTON		"Load X.509 Certificate key", IDC_LOAD_CERTKEY, 90,85,100,15
+    GROUPBOX		"Authentication", IDC_STATIC, 7,110,170,60
     CONTROL		"None", IDC_AUTH_NONE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-			10,135,50,15
+			10,120,50,15
     CONTROL		"Standard VNC", IDC_AUTH_VNC, "Button",
-			BS_AUTOCHECKBOX | WS_TABSTOP, 10,150,80,15
-    PUSHBUTTON		"Configure", IDC_AUTH_VNC_PASSWD, 100,150,61,15
+			BS_AUTOCHECKBOX | WS_TABSTOP, 10,135,80,15
+    PUSHBUTTON		"Configure", IDC_AUTH_VNC_PASSWD, 100,135,61,15
 /*
     CONTROL		"Plaintext", IDC_AUTH_PLAIN, "Button",
-			BS_AUTOCHECKBOX | WS_TABSTOP, 10,165,70,15
+			BS_AUTOCHECKBOX | WS_TABSTOP, 10,150,70,15
 */
     CONTROL		"Prompt local user to accept connections",
 			IDC_QUERY_CONNECT, "Button", BS_AUTOCHECKBOX | WS_TABSTOP,
-			7,185,181,15
+			7,170,181,15
     CONTROL		"Only prompt when there is a user logged on",
 			IDC_QUERY_LOGGED_ON, "Button", BS_AUTOCHECKBOX | 
-			WS_TABSTOP,20,200,166,15
+			WS_TABSTOP,20,185,166,15
 END
 
 IDD_CONNECTIONS DIALOG DISCARDABLE  0, 0, 218, 198