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