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 @@
* Handle security types
*/
static rfbSecurityHandler* securityHandlers = NULL;
void
rfbRegisterSecurityHandler(rfbScreenInfoPtr server, rfbSecurityHandler* handler)
rfbRegisterSecurityHandler(rfbSecurityHandler* handler)
{
rfbSecurityHandler* last = handler;
while(last->next)
last = last->next;
last->next = server->securityHandlers;
server->securityHandlers = handler;
last->next = securityHandlers;
securityHandlers = handler;
}
......@@ -93,10 +95,10 @@ rfbSendSecurityTypeList(rfbClientPtr cl, int primaryType)
handler->type = primaryType;
handler->handler = rfbVncAuthSendChallenge;
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) {
buffer[size] = handler->type;
size++;
......@@ -227,7 +229,7 @@ rfbProcessClientSecurityType(rfbClientPtr cl)
/* 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)
if (chosenType == handler->type) {
handler->handler(cl);
......
......@@ -668,7 +668,6 @@ rfbScreenInfoPtr rfbGetScreen(int* argc,char** argv,
screen->newClientHook = rfbDefaultNewClientHook;
screen->displayHook = NULL;
screen->processCustomClientMessage = rfbDefaultProcessCustomClientMessage;
screen->securityHandlers = NULL;
/* initialize client list and iterator mutex */
rfbClientListInit(screen);
......
......@@ -278,8 +278,6 @@ typedef struct _rfbScreenInfo
rfbProcessCustomClientMessageProcPtr processCustomClientMessage;
in_addr_t listenInterface;
rfbSecurityHandler* securityHandlers;
} rfbScreenInfo, *rfbScreenInfoPtr;
......@@ -601,8 +599,7 @@ extern void rfbHttpCheckFds(rfbScreenInfoPtr rfbScreen);
extern void rfbAuthNewClient(rfbClientPtr cl);
extern void rfbAuthProcessClientMessage(rfbClientPtr cl);
extern void rfbRegisterSecurityHandler(rfbScreenInfoPtr server,
rfbSecurityHandler* handler);
extern void rfbRegisterSecurityHandler(rfbSecurityHandler* handler);
/* 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