[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/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx
index 3d7f99a..97ef520 100644
--- a/win/vncviewer/CConn.cxx
+++ b/win/vncviewer/CConn.cxx
@@ -102,6 +102,7 @@
   // - Set which auth schemes we support, in order of preference
   addSecType(secTypeVncAuth);
   addSecType(secTypeNone);
+  security->upg = this; /* Security instance is created in CConnection costructor. */
 
   // Start the RFB protocol
   sock = s;
@@ -406,20 +407,6 @@
   }
 }
 
-
-CSecurity* CConn::getCSecurity(int secType)
-{
-  switch (secType) {
-  case secTypeNone:
-    return new CSecurityNone();
-  case secTypeVncAuth:
-    return new CSecurityVncAuth(this);
-  default:
-    throw Exception("Unsupported secType?");
-  }
-}
-
-
 void
 CConn::setColourMapEntries(int first, int count, U16* rgbs) {
   vlog.debug("setColourMapEntries: first=%d, count=%d", first, count);
@@ -817,7 +804,7 @@
   if ((user && !*user) || (password && !*password)) {
     // Missing username or password - prompt the user
     UserPasswdDialog userPasswdDialog;
-    userPasswdDialog.setCSecurity(getCurrentCSecurity());
+    userPasswdDialog.setCSecurity(csecurity);
     userPasswdDialog.getUserPasswd(user, password);
   }
   if (user) options.setUserName(*user);
diff --git a/win/vncviewer/InfoDialog.cxx b/win/vncviewer/InfoDialog.cxx
index 34644cd..551ccf2 100644
--- a/win/vncviewer/InfoDialog.cxx
+++ b/win/vncviewer/InfoDialog.cxx
@@ -59,7 +59,7 @@
   sprintf(buf, "%d.%d", conn->cp.majorVersion, conn->cp.minorVersion);
   setItemString(IDC_INFO_VERSION, TStr(buf));
 
-  const CSecurity* cSec = conn->getCurrentCSecurity();
+  const CSecurity* cSec = conn->csecurity;
   setItemString(IDC_INFO_SECURITY, TStr(secTypeName(cSec->getType())));
   setItemString(IDC_INFO_ENCRYPTION, TStr(cSec->description()));
 }