[Development] Use enhanced Security class by both UNIX and Windows viewers.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4042 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/vncviewer/CConn.cxx b/unix/vncviewer/CConn.cxx
index 8bbc621..556d058 100644
--- a/unix/vncviewer/CConn.cxx
+++ b/unix/vncviewer/CConn.cxx
@@ -71,6 +71,8 @@
   setShared(shared);
   addSecType(secTypeNone);
   addSecType(secTypeVncAuth);
+  security->upg = this; /* Security instance is created in CConnection costructor. */
+
   CharArray encStr(preferredEncoding.getData());
   int encNum = encodingNum(encStr.buf);
   if (encNum != -1) {
@@ -214,7 +216,7 @@
     return;
   }
 
-  const char* secType = secTypeName(getCurrentCSecurity()->getType());
+  const char* secType = secTypeName(csecurity->getType());
   const char* titlePrefix = _("VNC authentication");
   unsigned int titleLen = strlen(titlePrefix) + strlen(secType) + 4;
   CharArray title(titleLen);
@@ -229,19 +231,6 @@
 
 // CConnection callback methods
 
-// getCSecurity() gets the appropriate CSecurity object for the security
-// types which we support.
-CSecurity* CConn::getCSecurity(int secType) {
-  switch (secType) {
-  case secTypeNone:
-    return new CSecurityNone();
-  case secTypeVncAuth:
-    return new CSecurityVncAuth(this);
-  default:
-    throw rfb::Exception("Unsupported secType?");
-  }
-}
-
 // serverInit() is called when the serverInit message has been received.  At
 // this point we create the desktop window and display it.  We also tell the
 // server the pixel format and encodings to use and request the first update.
@@ -510,7 +499,7 @@
       char spfStr[100];
       cp.pf().print(pfStr, 100);
       serverPF.print(spfStr, 100);
-      int secType = getCurrentCSecurity()->getType();
+      int secType = csecurity->getType();
       char infoText[1024];
       snprintf(infoText, sizeof(infoText),
 	       _("Desktop name: %.80s\n"