浏览代码

[Development] Create VeNCrypt security types in Security class.

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
tags/v1.0.90
Adam Tkac 14 年前
父节点
当前提交
707d361a50

+ 1
- 25
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>
@@ -173,7 +171,7 @@ bool CSecurityVeNCrypt::processMsg(CConnection* cc)
if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt)
throw AuthFailureException("No valid VeNCrypt sub-type");
csecurity = CSecurityVeNCrypt::getCSecurityStack(chosenType);
csecurity = security->GetCSecurity(chosenType);
/* send chosen type to server */
os->writeU32(chosenType);
@@ -193,25 +191,3 @@ bool CSecurityVeNCrypt::processMsg(CConnection* cc)
return csecurity->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 */
}

+ 0
- 3
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,8 +42,6 @@ namespace rfb {
static StringParameter secTypesStr;
protected:
static CSecurityStack* getCSecurityStack(int secType);
CSecurity *csecurity;
Security *security;
bool haveRecvdMajorVersion;

+ 9
- 7
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 \

+ 0
- 4
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>

+ 0
- 4
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>

+ 1
- 26
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;
@@ -180,29 +174,10 @@ bool SSecurityVeNCrypt::processMsg(SConnection* sc)
if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt)
throw AuthFailureException("No valid VeNCrypt sub-type");
ssecurity = SSecurityVeNCrypt::getSSecurityStack(chosenType);
ssecurity = security->GetSSecurity(chosenType);
}
/* continue processing the messages */
return ssecurity->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");
}
}

+ 0
- 6
common/rfb/SSecurityVeNCrypt.h 查看文件

@@ -29,10 +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>
@@ -49,8 +45,6 @@ namespace rfb {
static StringParameter X509_CertFile, X509_KeyFile;
protected:
static SSecurityStack* getSSecurityStack(int secType);
SSecurity *ssecurity;
Security *security;
bool haveSentVersion, haveRecvdMajorVersion, haveRecvdMinorVersion;

+ 17
- 3
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>

@@ -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
}


正在加载...
取消
保存