]> source.dussan.org Git - tigervnc.git/commitdiff
[Development] Create VeNCrypt security types in Security class.
authorAdam Tkac <atkac@redhat.com>
Tue, 20 Jul 2010 15:16:10 +0000 (15:16 +0000)
committerAdam Tkac <atkac@redhat.com>
Tue, 20 Jul 2010 15:16:10 +0000 (15:16 +0000)
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4103 3789f03b-4d11-0410-bbf8-ca57d06f2519

common/rfb/CSecurityVeNCrypt.cxx
common/rfb/CSecurityVeNCrypt.h
common/rfb/Makefile.am
common/rfb/SSecurityPlain.cxx
common/rfb/SSecurityPlain.h
common/rfb/SSecurityVeNCrypt.cxx
common/rfb/SSecurityVeNCrypt.h
common/rfb/Security.cxx

index 39a95f443dfd7391bf46e82fbde2542fad63bef1..2d91190f64e2ee6add50758a06fae62649153ee2 100644 (file)
@@ -26,9 +26,7 @@
 #include <rdr/InStream.h>\r
 #include <rdr/OutStream.h>\r
 #include <rfb/CConnection.h>\r
-#include <rfb/CSecurityTLS.h>\r
 #include <rfb/CSecurityVeNCrypt.h>\r
-#include <rfb/CSecurityVncAuth.h>\r
 #include <rfb/LogWriter.h>\r
 #include <list>\r
 \r
@@ -173,7 +171,7 @@ bool CSecurityVeNCrypt::processMsg(CConnection* cc)
       if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt)\r
        throw AuthFailureException("No valid VeNCrypt sub-type");\r
 \r
-      csecurity = CSecurityVeNCrypt::getCSecurityStack(chosenType);\r
+      csecurity = security->GetCSecurity(chosenType);\r
 \r
       /* send chosen type to server */\r
       os->writeU32(chosenType);\r
@@ -193,25 +191,3 @@ bool CSecurityVeNCrypt::processMsg(CConnection* cc)
   return csecurity->processMsg(cc);\r
 }\r
 \r
-CSecurityStack* CSecurityVeNCrypt::getCSecurityStack(int secType)\r
-{\r
-  switch (secType) {\r
-  case secTypeTLSNone:\r
-    return new CSecurityStack(secTypeTLSNone, "TLS with no password",\r
-                             new CSecurityTLS());\r
-  case secTypeTLSVnc:\r
-    return new CSecurityStack(secTypeTLSVnc, "TLS with VNCAuth",\r
-                             new CSecurityTLS(), new CSecurityVncAuth());\r
-#if 0\r
-  /* Following subtypes are not implemented, yet */\r
-  case secTypeTLSPlain:\r
-  case secTypeX509None:\r
-  case secTypeX509Vnc:\r
-  case secTypeX509Plain:\r
-#endif\r
-  default:\r
-    throw Exception("Unsupported VeNCrypt subtype");\r
-  }\r
-\r
-  return NULL; /* not reached */\r
-}\r
index 3ad6eb2ca3533b88e0a526759278102c62947a69..1385f5851b7685575b7ec2ec9fc1cfdbb16a1b3e 100644 (file)
@@ -26,7 +26,6 @@
 #define __CSECURITYVENCRYPT_H__\r
 \r
 #include <rfb/CSecurity.h>\r
-#include <rfb/CSecurityStack.h>\r
 #include <rfb/Security.h>\r
 #include <rdr/types.h>\r
 \r
@@ -43,8 +42,6 @@ namespace rfb {
 \r
     static StringParameter secTypesStr;\r
   protected:\r
-    static CSecurityStack* getCSecurityStack(int secType);\r
-\r
     CSecurity *csecurity;\r
     Security *security;\r
     bool haveRecvdMajorVersion;\r
index c683fe0c4328a47aa47d75d8ed096c652993ce7a..7df6b6b94529094040f7eac2a17cd594f50de6bd 100644 (file)
@@ -1,17 +1,16 @@
 noinst_LTLIBRARIES = librfb.la
 
-VENCRYPT_HDRS = CSecurityStack.h CSecurityTLS.h CSecurityTLSBase.h \
-       CSecurityVeNCrypt.h SSecurityPlain.h SSecurityStack.h SSecurityTLS.h \
-       SSecurityTLSBase.h SSecurityVeNCrypt.h
+VENCRYPT_HDRS = CSecurityTLS.h CSecurityTLSBase.h \
+       SSecurityTLS.h SSecurityTLSBase.h
 
-VENCRYPT_SRCS = CSecurityStack.cxx CSecurityTLS.cxx CSecurityTLSBase.cxx \
-       CSecurityVeNCrypt.cxx SSecurityPlain.cxx SSecurityStack.cxx \
-       SSecurityTLS.cxx SSecurityTLSBase.cxx SSecurityVeNCrypt.cxx
+VENCRYPT_SRCS = CSecurityTLS.cxx CSecurityTLSBase.cxx \
+       SSecurityTLS.cxx SSecurityTLSBase.cxx
 
 HDRS = Blacklist.h CapsContainer.h CapsList.h CConnection.h \
        CMsgHandler.h CMsgReader.h CMsgReaderV3.h CMsgWriter.h \
        CMsgWriterV3.h ColourCube.h ColourMap.h ComparingUpdateTracker.h \
        Configuration.h ConnParams.h CSecurity.h CSecurityNone.h \
+       CSecurityStack.h CSecurityVeNCrypt.h \
        CSecurityVncAuth.h Cursor.h Decoder.h d3des.h Encoder.h \
        encodings.h Exception.h hextileConstants.h hextileDecode.h \
        HextileDecoder.h hextileEncodeBetter.h hextileEncode.h \
@@ -23,6 +22,7 @@ HDRS = Blacklist.h CapsContainer.h CapsList.h CConnection.h \
        ScaledPixelBuffer.h ScaleFilters.h SConnection.h ScreenSet.h \
        screenTypes.h SDesktop.h ServerCore.h SMsgHandler.h SMsgReader.h \
        SMsgReaderV3.h SMsgWriter.h SMsgWriterV3.h SSecurity.h SSecurityNone.h \
+       SSecurityPlain.h SSecurityStack.h SSecurityVeNCrypt.h \
        SSecurityVncAuth.h Threading.h tightDecode.h \
        TightDecoder.h tightEncode.h TightEncoder.h TightPalette.h Timer.h \
        TransImageGetter.h transInitTempl.h transTempl.h TrueColourMap.h \
@@ -32,6 +32,7 @@ HDRS = Blacklist.h CapsContainer.h CapsList.h CConnection.h \
 
 librfb_la_SOURCES = $(HDRS) Blacklist.cxx CConnection.cxx CMsgHandler.cxx \
        CMsgReader.cxx CMsgReaderV3.cxx CMsgWriter.cxx CMsgWriterV3.cxx \
+       CSecurityStack.cxx CSecurityVeNCrypt.cxx \
        CSecurityVncAuth.cxx CapsContainer.cxx CapsList.cxx \
        ComparingUpdateTracker.cxx Configuration.cxx ConnParams.cxx \
        Cursor.cxx Decoder.cxx d3des.c Encoder.cxx \
@@ -41,7 +42,8 @@ librfb_la_SOURCES = $(HDRS) Blacklist.cxx CConnection.cxx CMsgHandler.cxx \
        RREEncoder.cxx RREDecoder.cxx RawDecoder.cxx RawEncoder.cxx \
        Region.cxx SConnection.cxx SMsgHandler.cxx \
        SMsgReader.cxx SMsgReaderV3.cxx SMsgWriter.cxx SMsgWriterV3.cxx \
-       ServerCore.cxx Security.cxx SSecurityVncAuth.cxx \
+       ServerCore.cxx Security.cxx SSecurityPlain.cxx SSecurityStack.cxx \
+       SSecurityVncAuth.cxx SSecurityVeNCrypt.cxx \
        ScaledPixelBuffer.cxx ScaleFilters.cxx Timer.cxx TightDecoder.cxx \
        TightEncoder.cxx TightPalette.cxx TransImageGetter.cxx \
        UpdateTracker.cxx VNCSConnectionST.cxx \
index 6b7bd9e7dd8d36b7761a5775ea18543a9cd51133..04eabe0dcd578ca8ddb8bdcd55149e6df425c41f 100644 (file)
 #include <config.h>\r
 #endif\r
 \r
-#ifndef HAVE_GNUTLS\r
-#error "This source should not be compiled without HAVE_GNUTLS defined"\r
-#endif\r
-\r
 #include <rfb/SSecurityPlain.h>\r
 #include <rfb/SConnection.h>\r
 #include <rfb/Exception.h>\r
index ecdd618b1fe25fb9529ef956c16c9200190869b8..f7a9c3dd40b459a230561519cfe0dd3aacb1a15e 100644 (file)
 #include <config.h>\r
 #endif\r
 \r
-#ifndef HAVE_GNUTLS\r
-#error "This header should not be included without HAVE_GNUTLS defined"\r
-#endif\r
-\r
 #include <rfb/SConnection.h>\r
 #include <rfb/SSecurity.h>\r
 #include <rfb/SSecurityVeNCrypt.h>\r
index 2dd331e926d2803eea69600cd46407081e5e3810..c704d1e5ac484bc7782d373b5df85a2c57ea6adc 100644 (file)
 #include <config.h>\r
 #endif\r
 \r
-#ifndef HAVE_GNUTLS\r
-#error "This source should not be compiled without HAVE_GNUTLS defined"\r
-#endif\r
-\r
 #include <rfb/SSecurityVeNCrypt.h>\r
 #include <rfb/Exception.h>\r
 #include <rfb/LogWriter.h>\r
 #include <rdr/InStream.h>\r
 #include <rdr/OutStream.h>\r
-#include <rfb/SSecurityVncAuth.h>\r
-#include <rfb/SSecurityTLS.h>\r
 \r
 using namespace rfb;\r
 using namespace rdr;\r
@@ -180,29 +174,10 @@ bool SSecurityVeNCrypt::processMsg(SConnection* sc)
     if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt)\r
       throw AuthFailureException("No valid VeNCrypt sub-type");\r
 \r
-    ssecurity = SSecurityVeNCrypt::getSSecurityStack(chosenType);\r
+    ssecurity = security->GetSSecurity(chosenType);\r
   }\r
 \r
   /* continue processing the messages */\r
   return ssecurity->processMsg(sc);\r
 }\r
 \r
-SSecurityStack* SSecurityVeNCrypt::getSSecurityStack(int secType)\r
-{\r
-  switch (secType) {\r
-  case secTypeTLSNone:\r
-    return new SSecurityStack(secTypeTLSNone, new SSecurityTLS());\r
-  case secTypeTLSVnc:\r
-    return new SSecurityStack(secTypeTLSVnc, new SSecurityTLS(), new SSecurityVncAuth());\r
-#if 0\r
-  /* Following types are not implemented, yet */\r
-  case secTypeTLSPlain:\r
-  case secTypeX509None:\r
-  case secTypeX509Vnc:\r
-  case secTypeX509Plain:\r
-#endif\r
-  default:\r
-    throw Exception("Bug in the SSecurityVeNCrypt::getSSecurityStack");\r
-  }\r
-}\r
-\r
index 3d5949ef267076fac76ea4f90e73ee919832917b..6201a7b7ffcb762ddffb7cbc402491c06cdc01bc 100644 (file)
 #include <config.h>\r
 #endif\r
 \r
-#ifndef HAVE_GNUTLS\r
-#error "This header should not be included without HAVE_GNUTLS defined"\r
-#endif\r
-\r
 #include <rfb/SSecurityStack.h>\r
 #include <rfb/SConnection.h>\r
 \r
@@ -49,8 +45,6 @@ namespace rfb {
     static StringParameter X509_CertFile, X509_KeyFile;\r
 \r
   protected:\r
-    static SSecurityStack* getSSecurityStack(int secType);\r
-\r
     SSecurity *ssecurity;\r
     Security *security;\r
     bool haveSentVersion, haveRecvdMajorVersion, haveRecvdMinorVersion;\r
index 4dea41ea78445a4202b123c6a1b71c974f8d8e24..e6a51bcc6183cfc6be4b3880ca63d3aafac99222 100644 (file)
 #define strcasecmp _stricmp
 #endif
 #include <rfb/CSecurityNone.h>
+#include <rfb/CSecurityStack.h>
 #include <rfb/CSecurityVeNCrypt.h>
 #include <rfb/CSecurityVncAuth.h>
 #include <rdr/Exception.h>
 #include <rfb/LogWriter.h>
 #include <rfb/Security.h>
 #include <rfb/SSecurityNone.h>
+#include <rfb/SSecurityStack.h>
 #include <rfb/SSecurityVncAuth.h>
-#ifdef HAVE_GNUTLS
 #include <rfb/SSecurityVeNCrypt.h>
+#ifdef HAVE_GNUTLS
+#include <rfb/CSecurityTLS.h>
+#include <rfb/SSecurityTLS.h>
 #endif
 #include <rfb/util.h>
 
@@ -116,8 +120,12 @@ SSecurity* Security::GetSSecurity(U32 secType)
   switch (secType) {
   case secTypeNone: return new SSecurityNone();
   case secTypeVncAuth: return new SSecurityVncAuth();
-#ifdef HAVE_GNUTLS
   case secTypeVeNCrypt: return new SSecurityVeNCrypt(this);
+#ifdef HAVE_GNUTLS
+  case secTypeTLSNone:
+    return new SSecurityStack(secTypeTLSNone, new SSecurityTLS());
+  case secTypeTLSVnc:
+    return new SSecurityStack(secTypeTLSVnc, new SSecurityTLS(), new SSecurityVncAuth());
 #endif
   }
 
@@ -135,8 +143,14 @@ CSecurity* Security::GetCSecurity(U32 secType)
   switch (secType) {
   case secTypeNone: return new CSecurityNone();
   case secTypeVncAuth: return new CSecurityVncAuth();
-#ifdef HAVE_GNUTLS
   case secTypeVeNCrypt: return new CSecurityVeNCrypt(this);
+#ifdef HAVE_GNUTLS
+  case secTypeTLSNone:
+    return new CSecurityStack(secTypeTLSNone, "TLS with no password",
+                             new CSecurityTLS());
+  case secTypeTLSVnc:
+    return new CSecurityStack(secTypeTLSVnc, "TLS with VNCAuth",
+                             new CSecurityTLS(), new CSecurityVncAuth());
 #endif
   }