diff options
author | rohit_99129 <rohit_99129> | 2006-02-24 08:23:55 +0000 |
---|---|---|
committer | rohit_99129 <rohit_99129> | 2006-02-24 08:23:55 +0000 |
commit | eb08d83d62d0440b946b1b13fcbabb12314dbba9 (patch) | |
tree | d915206b3854fbd3e98571db88f6834d62266a8a | |
parent | d3599be1b822b2afa3d27c2eca50c08edb9e5622 (diff) | |
download | libtdevnc-eb08d83d62d0440b946b1b13fcbabb12314dbba9.tar.gz libtdevnc-eb08d83d62d0440b946b1b13fcbabb12314dbba9.zip |
Added method to get extension specific client data
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | libvncserver/main.c | 16 | ||||
-rw-r--r-- | libvncserver/tightvnc-filetransfer/rfbtightserver.c | 55 | ||||
-rw-r--r-- | rfb/rfb.h | 1 |
4 files changed, 42 insertions, 34 deletions
@@ -1,3 +1,7 @@ +2006-02-24 Rohit Kumar <[email protected]> + * main.c, rfbtightserver.c, rfb.h: added method to get + extension specific client data. + 2006-02-22 Rohit Kumar <[email protected]> * auth.c, main.c, rfbtightserver.c, rfb.h: add methods to unregister extensions and security types. diff --git a/libvncserver/main.c b/libvncserver/main.c index bf14062..6cf21ea 100644 --- a/libvncserver/main.c +++ b/libvncserver/main.c @@ -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 */ diff --git a/libvncserver/tightvnc-filetransfer/rfbtightserver.c b/libvncserver/tightvnc-filetransfer/rfbtightserver.c index 2acfa9c..cb9530f 100644 --- a/libvncserver/tightvnc-filetransfer/rfbtightserver.c +++ b/libvncserver/tightvnc-filetransfer/rfbtightserver.c @@ -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); |