xace: add hooks + new access codes: core protocol client requests

This commit is contained in:
Eamon Walsh 2007-08-16 10:57:49 -04:00 committed by Eamon Walsh
parent 5bee8db003
commit e89301c879
2 changed files with 23 additions and 10 deletions

View File

@ -3519,9 +3519,14 @@ ProcGetFontPath(ClientPtr client)
int int
ProcChangeCloseDownMode(ClientPtr client) ProcChangeCloseDownMode(ClientPtr client)
{ {
int rc;
REQUEST(xSetCloseDownModeReq); REQUEST(xSetCloseDownModeReq);
REQUEST_SIZE_MATCH(xSetCloseDownModeReq); REQUEST_SIZE_MATCH(xSetCloseDownModeReq);
rc = XaceHook(XACE_CLIENT_ACCESS, client, client, DixManageAccess);
if (rc != Success)
return rc;
if ((stuff->mode == AllTemporary) || if ((stuff->mode == AllTemporary) ||
(stuff->mode == RetainPermanent) || (stuff->mode == RetainPermanent) ||
(stuff->mode == RetainTemporary)) (stuff->mode == RetainTemporary))

View File

@ -254,17 +254,25 @@ _X_EXPORT int
dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access) dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
{ {
pointer pRes; pointer pRes;
int clientIndex = CLIENT_ID(rid); int rc = BadValue, clientIndex = CLIENT_ID(rid);
client->errorValue = rid;
dixLookupResource(&pRes, rid, RC_ANY, client, access); 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;
if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) {
*pClient = clients[clientIndex]; *pClient = clients[clientIndex];
return Success; return Success;
} bad:
client->errorValue = rid;
*pClient = NULL; *pClient = NULL;
return BadValue; return rc;
} }
int int