Signed-off-by: Martin Koegler <mkoeg...@auto.tuwien.ac.at> --- common/rfb/CSecurityVeNCrypt.cxx | 26 +------------------------- common/rfb/CSecurityVeNCrypt.h | 2 -- common/rfb/Makefile.am | 16 +++++++++------- common/rfb/SSecurityPlain.cxx | 4 ---- common/rfb/SSecurityPlain.h | 4 ---- common/rfb/SSecurityVeNCrypt.cxx | 28 +--------------------------- common/rfb/SSecurityVeNCrypt.h | 6 ------ common/rfb/Security.cxx | 29 ++++++++++++++++++++++++++--- 8 files changed, 37 insertions(+), 78 deletions(-)
diff --git a/common/rfb/CSecurityVeNCrypt.cxx b/common/rfb/CSecurityVeNCrypt.cxx index 5871922..e28e4dd 100644 --- a/common/rfb/CSecurityVeNCrypt.cxx +++ b/common/rfb/CSecurityVeNCrypt.cxx @@ -26,9 +26,7 @@ #include <rdr/InStream.h> #include <rdr/OutStream.h> #include <rfb/CConnection.h> -#include <rfb/CSecurityTLS.h> #include <rfb/CSecurityVeNCrypt.h> -#include <rfb/CSecurityVncAuth.h> #include <rfb/LogWriter.h> #include <list> @@ -170,7 +168,7 @@ bool CSecurityVeNCrypt::processMsg(CConnection* cc) /* Set up the stack according to the chosen type: */ if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt) throw AuthFailureException("No valid VeNCrypt sub-type"); - csecurityStack = CSecurityVeNCrypt::getCSecurityStack(chosenType); + csecurityStack = security->GetCSecurity(chosenType); /* send chosen type to server */ os->writeU32(chosenType); @@ -190,25 +188,3 @@ bool CSecurityVeNCrypt::processMsg(CConnection* cc) return csecurityStack->processMsg(cc); } -CSecurityStack* CSecurityVeNCrypt::getCSecurityStack(int secType) -{ - switch (secType) { - 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()); -#if 0 - /* Following subtypes are not implemented, yet */ - case secTypeTLSPlain: - case secTypeX509None: - case secTypeX509Vnc: - case secTypeX509Plain: -#endif - default: - throw Exception("Unsupported VeNCrypt subtype"); - } - - return NULL; /* not reached */ -} diff --git a/common/rfb/CSecurityVeNCrypt.h b/common/rfb/CSecurityVeNCrypt.h index 4e61fda..af06b1e 100644 --- a/common/rfb/CSecurityVeNCrypt.h +++ b/common/rfb/CSecurityVeNCrypt.h @@ -26,7 +26,6 @@ #define __CSECURITYVENCRYPT_H__ #include <rfb/CSecurity.h> -#include <rfb/CSecurityStack.h> #include <rfb/Security.h> #include <rdr/types.h> @@ -43,7 +42,6 @@ namespace rfb { static StringParameter secTypesStr; protected: - static CSecurityStack* getCSecurityStack(int secType); CSecurity *csecurityStack; bool haveRecvdMajorVersion; diff --git a/common/rfb/Makefile.am b/common/rfb/Makefile.am index c683fe0..1e7c945 100644 --- a/common/rfb/Makefile.am +++ b/common/rfb/Makefile.am @@ -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 \ diff --git a/common/rfb/SSecurityPlain.cxx b/common/rfb/SSecurityPlain.cxx index 6b7bd9e..04eabe0 100644 --- a/common/rfb/SSecurityPlain.cxx +++ b/common/rfb/SSecurityPlain.cxx @@ -21,10 +21,6 @@ #include <config.h> #endif -#ifndef HAVE_GNUTLS -#error "This source should not be compiled without HAVE_GNUTLS defined" -#endif - #include <rfb/SSecurityPlain.h> #include <rfb/SConnection.h> #include <rfb/Exception.h> diff --git a/common/rfb/SSecurityPlain.h b/common/rfb/SSecurityPlain.h index ecdd618..f7a9c3d 100644 --- a/common/rfb/SSecurityPlain.h +++ b/common/rfb/SSecurityPlain.h @@ -24,10 +24,6 @@ #include <config.h> #endif -#ifndef HAVE_GNUTLS -#error "This header should not be included without HAVE_GNUTLS defined" -#endif - #include <rfb/SConnection.h> #include <rfb/SSecurity.h> #include <rfb/SSecurityVeNCrypt.h> diff --git a/common/rfb/SSecurityVeNCrypt.cxx b/common/rfb/SSecurityVeNCrypt.cxx index 2d14ae4..3cdab8e 100644 --- a/common/rfb/SSecurityVeNCrypt.cxx +++ b/common/rfb/SSecurityVeNCrypt.cxx @@ -26,17 +26,11 @@ #include <config.h> #endif -#ifndef HAVE_GNUTLS -#error "This source should not be compiled without HAVE_GNUTLS defined" -#endif - #include <rfb/SSecurityVeNCrypt.h> #include <rfb/Exception.h> #include <rfb/LogWriter.h> #include <rdr/InStream.h> #include <rdr/OutStream.h> -#include <rfb/SSecurityVncAuth.h> -#include <rfb/SSecurityTLS.h> using namespace rfb; using namespace rdr; @@ -176,29 +170,9 @@ bool SSecurityVeNCrypt::processMsg(SConnection* sc) /* Set up the stack according to the chosen type */ if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt) throw AuthFailureException("No valid VeNCrypt sub-type"); - ssecurityStack = SSecurityVeNCrypt::getSSecurityStack(chosenType); + ssecurityStack = security->GetSSecurity(chosenType); } /* continue processing the messages */ return ssecurityStack->processMsg(sc); } - -SSecurityStack* SSecurityVeNCrypt::getSSecurityStack(int secType) -{ - switch (secType) { - case secTypeTLSNone: - return new SSecurityStack(secTypeTLSNone, new SSecurityTLS()); - case secTypeTLSVnc: - return new SSecurityStack(secTypeTLSVnc, new SSecurityTLS(), new SSecurityVncAuth()); -#if 0 - /* Following types are not implemented, yet */ - case secTypeTLSPlain: - case secTypeX509None: - case secTypeX509Vnc: - case secTypeX509Plain: -#endif - default: - throw Exception("Bug in the SSecurityVeNCrypt::getSSecurityStack"); - } -} - diff --git a/common/rfb/SSecurityVeNCrypt.h b/common/rfb/SSecurityVeNCrypt.h index 4d7b457..bd0a241 100644 --- a/common/rfb/SSecurityVeNCrypt.h +++ b/common/rfb/SSecurityVeNCrypt.h @@ -29,11 +29,6 @@ #include <config.h> #endif -#ifndef HAVE_GNUTLS -#error "This header should not be included without HAVE_GNUTLS defined" -#endif - -#include <rfb/SSecurityStack.h> #include <rfb/SConnection.h> namespace rfb { @@ -49,7 +44,6 @@ namespace rfb { static StringParameter X509_CertFile, X509_KeyFile; protected: - static SSecurityStack* getSSecurityStack(int secType); SSecurity *ssecurityStack; bool haveSentVersion, haveRecvdMajorVersion, haveRecvdMinorVersion; diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx index 4aa8eda..d0e8290 100644 --- a/common/rfb/Security.cxx +++ b/common/rfb/Security.cxx @@ -28,15 +28,19 @@ #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> @@ -114,8 +118,13 @@ 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 } @@ -133,8 +142,22 @@ 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()); +#if 0 + /* Following subtypes are not implemented, yet */ + case secTypeTLSPlain: + case secTypeX509None: + case secTypeX509Vnc: + case secTypeX509Plain: +#endif #endif } -- 1.6.4.2 ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Tigervnc-devel mailing list Tigervnc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tigervnc-devel