diff --git a/dix/dispatch.c b/dix/dispatch.c index 2dc32a525..30f44fb1f 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -3519,9 +3519,14 @@ ProcGetFontPath(ClientPtr client) int ProcChangeCloseDownMode(ClientPtr client) { + int rc; REQUEST(xSetCloseDownModeReq); - REQUEST_SIZE_MATCH(xSetCloseDownModeReq); + + rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess); + if (rc != Success) + return rc; + if ((stuff->mode == AllTemporary) || (stuff->mode == RetainPermanent) || (stuff->mode == RetainTemporary)) diff --git a/dix/dixutils.c b/dix/dixutils.c index e8d7daf06..786f4e335 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -254,17 +254,25 @@ _X_EXPORT int dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) { pointer pRes; - int clientIndex = CLIENT_ID(rid); + int rc = BadValue, clientIndex = CLIENT_ID(rid); + + if (!clientIndex || !clients[clientIndex] || (rid & SERVER_BIT)) + goto bad; + + rc = dixLookupResource(&pRes, rid, RC_ANY, client, DixGetAttrAccess); + if (rc != Success) + goto bad; + + rc = XaceHook(XACE_CLIENT_ACCESS, client, clients[clientIndex], access); + if (rc != Success) + goto bad; + + *pClient = clients[clientIndex]; + return Success; +bad: client->errorValue = rid; - - dixLookupResource(&pRes, rid, RC_ANY, client, access); - - if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { - *pClient = clients[clientIndex]; - return Success; - } *pClient = NULL; - return BadValue; + return rc; } int