Commit eb08d83d authored by rohit_99129's avatar rohit_99129

Added method to get extension specific client data

parent d3599be1
2006-02-24 Rohit Kumar <rokumar@novell.com>
* main.c, rfbtightserver.c, rfb.h: added method to get
extension specific client data.
2006-02-22 Rohit Kumar <rokumar@novell.com>
* auth.c, main.c, rfbtightserver.c, rfb.h: add methods to
unregister extensions and security types.
......
......@@ -194,6 +194,22 @@ rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension* extension)
return FALSE;
}
void* rfbGetExtensionClientData(rfbClientPtr cl, rfbExtensionData* extension)
{
rfbExtensionData* data = cl->extensions;
while(data && data->extension != extension)
data = data->next;
if(data == NULL) {
rfbLog("Extension is not enabled !\n");
/* rfbCloseClient(cl); */
return NULL;
}
return data->data;
}
/*
* Logging
*/
......
......@@ -37,20 +37,18 @@
extern rfbProtocolExtension tightVncFileTransferExtension;
rfbTightClientPtr rfbGetTightClientData(rfbClientPtr cl)
rfbTightClientPtr
rfbGetTightClientData(rfbClientPtr cl)
{
rfbExtensionData* data = cl->extensions;
while(data && data->extension != &tightVncFileTransferExtension)
data = data->next;
if(data == NULL) {
rfbLog("TightVNC enabled, but client data missing?!\n");
rfbTightClientPtr rtcp = (rfbTightClientPtr)
rfbGetExtensionClientData(cl,
&tightVncFileTransferExtension);
if(rtcp == NULL) {
rfbLog("Extension client data is null, closing the connection !\n");
rfbCloseClient(cl);
return NULL;
}
return (rfbTightClientPtr)data->data;
return rtcp;
}
/*
......@@ -58,8 +56,7 @@ rfbTightClientPtr rfbGetTightClientData(rfbClientPtr cl)
*/
static void
rfbVncAuthSendChallenge(cl)
rfbClientPtr cl;
rfbVncAuthSendChallenge(rfbClientPtr cl)
{
/* 4 byte header is alreay sent. Which is rfbSecTypeVncAuth (same as rfbVncAuth). Just send the challenge. */
......@@ -81,8 +78,7 @@ rfbVncAuthSendChallenge(cl)
*/
void
rfbProcessClientAuthType(cl)
rfbClientPtr cl;
rfbProcessClientAuthType(rfbClientPtr cl)
{
uint32_t auth_type;
int n, i;
......@@ -137,8 +133,7 @@ rfbProcessClientAuthType(cl)
*/
void
rfbProcessClientTunnelingType(cl)
rfbClientPtr cl;
rfbProcessClientTunnelingType(rfbClientPtr cl)
{
/* If we were called, then something's really wrong. */
rfbLog("rfbProcessClientTunnelingType: not implemented\n");
......@@ -153,8 +148,7 @@ rfbProcessClientTunnelingType(cl)
*/
static void
rfbSendAuthCaps(cl)
rfbClientPtr cl;
rfbSendAuthCaps(rfbClientPtr cl)
{
rfbAuthenticationCapsMsg caps;
rfbCapabilityInfo caplist[MAX_AUTH_CAPS];
......@@ -195,16 +189,12 @@ rfbSendAuthCaps(cl)
}
/*
* Send the list of our tunneling capabilities (protocol 3.7t).
*/
static void
rfbSendTunnelingCaps(cl)
rfbClientPtr cl;
rfbSendTunnelingCaps(rfbClientPtr cl)
{
rfbTunnelingCapsMsg caps;
uint32_t nTypes = 0; /* we don't support tunneling yet */
......@@ -241,8 +231,7 @@ rfbSendTunnelingCaps(cl)
#define N_ENC_CAPS 12
void
rfbSendInteractionCaps(cl)
rfbClientPtr cl;
rfbSendInteractionCaps(rfbClientPtr cl)
{
rfbInteractionCapsMsg intr_caps;
rfbCapabilityInfo smsg_list[N_SMSG_CAPS];
......@@ -331,9 +320,7 @@ rfbSendInteractionCaps(cl)
rfbBool
rfbTightExtensionInit(cl, data)
rfbClientPtr cl;
void** data;
rfbTightExtensionInit(rfbClientPtr cl, void** data)
{
rfbSendInteractionCaps(cl);
......@@ -364,10 +351,8 @@ handleMessage(rfbClientPtr cl,
}
rfbBool
rfbTightExtensionMsgHandler(cl, data, msg)
struct _rfbClientRec* cl;
void* data;
const rfbClientToServerMsg* msg;
rfbTightExtensionMsgHandler(struct _rfbClientRec* cl, void* data,
const rfbClientToServerMsg* msg)
{
switch (msg->type) {
......@@ -406,7 +391,8 @@ const rfbClientToServerMsg* msg;
/*
We shouldn't close the connection here for unhandled msg, it should be left to libvncserver.
We shouldn't close the connection here for unhandled msg,
it should be left to libvncserver.
rfbLog(" ... closing connection\n");
rfbCloseClient(cl);
......@@ -469,7 +455,8 @@ rfbHandleSecTypeTight(rfbClientPtr cl) {
if(rtcp == NULL) {
/* Error condition close socket */
rfbLog("Memory error has occured while handling Tight security type... closing connection.\n");
rfbLog("Memory error has occured while handling "
"Tight security type... closing connection.\n");
rfbCloseClient(cl);
return;
}
......
......@@ -799,6 +799,7 @@ void rfbReleaseExtensionIterator();
rfbBool rfbEnableExtension(rfbClientPtr cl, rfbProtocolExtension* extension,
void* data);
rfbBool rfbDisableExtension(rfbClientPtr cl, rfbProtocolExtension* extension);
void* rfbGetExtensionClientData(rfbClientPtr cl, rfbExtensionData* extension);
/* to check against plain passwords */
rfbBool rfbCheckPasswordByList(rfbClientPtr cl,const char* response,int len);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment