Strongly bind security objects to connection object
There is already an implicit connection between them, so let's make
it explicit. This allows easy lookup outside of the processMsg() function.
diff --git a/common/rfb/CSecurityVeNCrypt.cxx b/common/rfb/CSecurityVeNCrypt.cxx
index f9597cc..22201dd 100644
--- a/common/rfb/CSecurityVeNCrypt.cxx
+++ b/common/rfb/CSecurityVeNCrypt.cxx
@@ -36,7 +36,8 @@
static LogWriter vlog("CVeNCrypt");
-CSecurityVeNCrypt::CSecurityVeNCrypt(SecurityClient* sec) : csecurity(NULL), security(sec)
+CSecurityVeNCrypt::CSecurityVeNCrypt(CConnection* cc, SecurityClient* sec)
+ : CSecurity(cc), csecurity(NULL), security(sec)
{
haveRecvdMajorVersion = false;
haveRecvdMinorVersion = false;
@@ -59,7 +60,7 @@
delete[] availableTypes;
}
-bool CSecurityVeNCrypt::processMsg(CConnection* cc)
+bool CSecurityVeNCrypt::processMsg()
{
InStream* is = cc->getInStream();
OutStream* os = cc->getOutStream();
@@ -171,7 +172,7 @@
if (chosenType == secTypeInvalid || chosenType == secTypeVeNCrypt)
throw AuthFailureException("No valid VeNCrypt sub-type");
- csecurity = security->GetCSecurity(chosenType);
+ csecurity = security->GetCSecurity(cc, chosenType);
/* send chosen type to server */
os->writeU32(chosenType);
@@ -188,7 +189,7 @@
throw AuthFailureException("The server reported 0 VeNCrypt sub-types");
}
- return csecurity->processMsg(cc);
+ return csecurity->processMsg();
}
const char* CSecurityVeNCrypt::description() const