[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/common/rfb/CConnection.cxx b/common/rfb/CConnection.cxx
index 692fac4..ac3c35e 100644
--- a/common/rfb/CConnection.cxx
+++ b/common/rfb/CConnection.cxx
@@ -32,15 +32,16 @@
static LogWriter vlog("CConnection");
CConnection::CConnection()
- : is(0), os(0), reader_(0), writer_(0),
- shared(false), security(0), nSecTypes(0), clientSecTypeOrder(false),
+ : csecurity(0), is(0), os(0), reader_(0), writer_(0),
+ shared(false), nSecTypes(0), clientSecTypeOrder(false),
state_(RFBSTATE_UNINITIALISED), useProtocol3_3(false)
{
+ security = new Security();
}
CConnection::~CConnection()
{
- if (security) security->destroy();
+ if (csecurity) csecurity->destroy();
deleteReaderAndWriter();
}
@@ -196,14 +197,14 @@
}
state_ = RFBSTATE_SECURITY;
- security = getCSecurity(secType);
+ csecurity = security->GetCSecurity(secType);
processSecurityMsg();
}
void CConnection::processSecurityMsg()
{
vlog.debug("processing security message");
- if (security->processMsg(this)) {
+ if (csecurity->processMsg(this)) {
state_ = RFBSTATE_SECURITY_RESULT;
processSecurityResultMsg();
}
@@ -213,7 +214,7 @@
{
vlog.debug("processing security result message");
int result;
- if (cp.beforeVersion(3,8) && security->getType() == secTypeNone) {
+ if (cp.beforeVersion(3,8) && csecurity->getType() == secTypeNone) {
result = secResultOK;
} else {
if (!is->checkNoWait(1)) return;
diff --git a/common/rfb/CConnection.h b/common/rfb/CConnection.h
index 79110eb..6d3783a 100644
--- a/common/rfb/CConnection.h
+++ b/common/rfb/CConnection.h
@@ -26,7 +26,9 @@
#include <rdr/InStream.h>
#include <rdr/OutStream.h>
#include <rfb/CMsgHandler.h>
+#include <rfb/CSecurity.h>
#include <rfb/util.h>
+#include <rfb/Security.h>
namespace rfb {
@@ -96,15 +98,6 @@
// Methods to be overridden in a derived class
- // getCSecurity() gets the CSecurity object for the given type. The type
- // is guaranteed to be one of the secTypes passed in to addSecType(). The
- // CSecurity object's destroy() method will be called by the CConnection
- // from its destructor.
- virtual CSecurity* getCSecurity(int secType)=0;
-
- // getCurrentCSecurity() gets the CSecurity instance used for this connection.
- const CSecurity* getCurrentCSecurity() const {return security;}
-
// getIdVerifier() returns the identity verifier associated with the connection.
// Ownership of the IdentityVerifier is retained by the CConnection instance.
virtual IdentityVerifier* getIdentityVerifier() {return 0;}
@@ -149,8 +142,10 @@
stateEnum state() { return state_; }
+ CSecurity *csecurity; /* Windows viewer needs it exported. */
protected:
void setState(stateEnum s) { state_ = s; }
+ Security *security;
private:
void processVersionMsg();
@@ -168,7 +163,6 @@
CMsgWriter* writer_;
bool deleteStreamsWhenDone;
bool shared;
- CSecurity* security;
enum { maxSecTypes = 8 };
int nSecTypes;
rdr::U8 secTypes[maxSecTypes];
diff --git a/common/rfb/Security.cxx b/common/rfb/Security.cxx
index daf3ac5..fac2d4b 100644
--- a/common/rfb/Security.cxx
+++ b/common/rfb/Security.cxx
@@ -39,7 +39,7 @@
StringParameter Security::secTypes
("SecurityTypes",
"Specify which security scheme to use (None, VncAuth)",
- "VncAuth");
+ "VncAuth", ConfServer);
Security::Security(void) : upg(NULL)
{