From 60610bdacdee7d1cc8ca7792d376db37010cfc13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Mon, 9 Aug 2010 19:01:46 +0200 Subject: [PATCH] Delete the XDM client on connection close. Keep trace of the 'xclient' in xdm auth list and drop the auth whenever the client is disconnected. This should fix issue #10665. --- dix/dispatch.c | 1 + include/os.h | 2 ++ os/xdmauth.c | 24 ++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 0 deletions(-) diff --git a/dix/dispatch.c b/dix/dispatch.c index 4f760bd..943e731 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3432,6 +3432,7 @@ CloseDownClient(ClientPtr client) DeleteClientFromAnySelections(client); ReleaseActiveGrabs(client); DeleteClientFontStuff(client); + XdmDeleteClient(client); if (!really_close_down) { /* This frees resources that should never be retained diff --git a/include/os.h b/include/os.h index efa202c..15be6b4 100644 --- a/include/os.h +++ b/include/os.h @@ -554,4 +554,6 @@ extern _X_EXPORT void LogPrintMarkers(void); extern _X_EXPORT void xorg_backtrace(void); +extern _X_EXPORT void XdmDeleteClient(ClientPtr /*client*/); + #endif /* OS_H */ diff --git a/os/xdmauth.c b/os/xdmauth.c index ac421aa..6b48e87 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -178,6 +178,7 @@ typedef struct _XdmClientAuth { XdmAuthKeyRec rho; char client[6]; long time; + ClientPtr xclient; } XdmClientAuthRec, *XdmClientAuthPtr; static XdmClientAuthPtr xdmClients; @@ -393,6 +394,7 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie, XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, xclient, reason)) != NULL) { + client->xclient = xclient; client->next = xdmClients; xdmClients = client; free(plain); @@ -497,4 +499,26 @@ XdmRemoveCookie (unsigned short data_length, const char *data) return 0; } +void +XdmDeleteClient (ClientPtr xclient) +{ + XdmClientAuthPtr client, next, prev; + + prev = 0; + for (client = xdmClients; client; client=next) + { + next = client->next; + if (client->xclient == xclient) + { + if (prev) + prev->next = next; + else + xdmClients = next; + free(client); + } + else + prev = client; + } +} + #endif -- 1.7.2