Commit 94fcd86c authored by dscho's avatar dscho

Security is global. This was a misguided attempt to evade a global list.

I eventually saw the light and went with Rohit´s original approach.
parent 6bdd2e46
...@@ -33,16 +33,18 @@ ...@@ -33,16 +33,18 @@
* Handle security types * Handle security types
*/ */
static rfbSecurityHandler* securityHandlers = NULL;
void void
rfbRegisterSecurityHandler(rfbScreenInfoPtr server, rfbSecurityHandler* handler) rfbRegisterSecurityHandler(rfbSecurityHandler* handler)
{ {
rfbSecurityHandler* last = handler; rfbSecurityHandler* last = handler;
while(last->next) while(last->next)
last = last->next; last = last->next;
last->next = server->securityHandlers; last->next = securityHandlers;
server->securityHandlers = handler; securityHandlers = handler;
} }
...@@ -93,10 +95,10 @@ rfbSendSecurityTypeList(rfbClientPtr cl, int primaryType) ...@@ -93,10 +95,10 @@ rfbSendSecurityTypeList(rfbClientPtr cl, int primaryType)
handler->type = primaryType; handler->type = primaryType;
handler->handler = rfbVncAuthSendChallenge; handler->handler = rfbVncAuthSendChallenge;
handler->next = NULL; handler->next = NULL;
rfbRegisterSecurityHandler(cl->screen, handler); rfbRegisterSecurityHandler(handler);
} }
for (handler = cl->screen->securityHandlers; for (handler = securityHandlers;
handler && size<MAX_SECURITY_TYPES; handler = handler->next) { handler && size<MAX_SECURITY_TYPES; handler = handler->next) {
buffer[size] = handler->type; buffer[size] = handler->type;
size++; size++;
...@@ -227,7 +229,7 @@ rfbProcessClientSecurityType(rfbClientPtr cl) ...@@ -227,7 +229,7 @@ rfbProcessClientSecurityType(rfbClientPtr cl)
/* Make sure it was present in the list sent by the server. */ /* Make sure it was present in the list sent by the server. */
for (handler = cl->screen->securityHandlers; handler; for (handler = securityHandlers; handler;
handler = handler->next) handler = handler->next)
if (chosenType == handler->type) { if (chosenType == handler->type) {
handler->handler(cl); handler->handler(cl);
......
...@@ -668,7 +668,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv, ...@@ -668,7 +668,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->newClientHook = rfbDefaultNewClientHook; screen->newClientHook = rfbDefaultNewClientHook;
screen->displayHook = NULL; screen->displayHook = NULL;
screen->processCustomClientMessage = rfbDefaultProcessCustomClientMessage; screen->processCustomClientMessage = rfbDefaultProcessCustomClientMessage;
screen->securityHandlers = NULL;
/* initialize client list and iterator mutex */ /* initialize client list and iterator mutex */
rfbClientListInit(screen); rfbClientListInit(screen);
......
...@@ -278,8 +278,6 @@ typedef struct _rfbScreenInfo ...@@ -278,8 +278,6 @@ typedef struct _rfbScreenInfo
rfbProcessCustomClientMessageProcPtr processCustomClientMessage; rfbProcessCustomClientMessageProcPtr processCustomClientMessage;
in_addr_t listenInterface; in_addr_t listenInterface;
rfbSecurityHandler* securityHandlers;
} rfbScreenInfo, *rfbScreenInfoPtr; } rfbScreenInfo, *rfbScreenInfoPtr;
...@@ -601,8 +599,7 @@ extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen); ...@@ -601,8 +599,7 @@ extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen);
extern void rfbAuthNewClient(rfbClientPtr cl); extern void rfbAuthNewClient(rfbClientPtr cl);
extern void rfbAuthProcessClientMessage(rfbClientPtr cl); extern void rfbAuthProcessClientMessage(rfbClientPtr cl);
extern void rfbRegisterSecurityHandler(rfbScreenInfoPtr server, extern void rfbRegisterSecurityHandler(rfbSecurityHandler* handler);
rfbSecurityHandler* handler);
/* rre.c */ /* rre.c */
......
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