Convert callers of LookupClient() to dixLookupClient().

This commit is contained in:
Eamon Walsh 2006-12-15 17:26:58 -05:00 committed by Eamon Walsh
parent f11dafaafc
commit ab1d5b0c31
5 changed files with 27 additions and 20 deletions

View File

@ -485,10 +485,13 @@ int ProcXagQuery(
ClientPtr pClient; ClientPtr pClient;
AppGroupPtr pAppGrp; AppGroupPtr pAppGrp;
REQUEST (xXagQueryReq); REQUEST (xXagQueryReq);
int n; int n, rc;
REQUEST_SIZE_MATCH (xXagQueryReq); REQUEST_SIZE_MATCH (xXagQueryReq);
pClient = LookupClient (stuff->resource, client); rc = dixLookupClient(&pClient, stuff->resource, client, DixUnknownAccess);
if (rc != Success)
return rc;
for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next) for (pAppGrp = appGrpList; pAppGrp != NULL; pAppGrp = pAppGrp->next)
for (n = 0; n < pAppGrp->nclients; n++) for (n = 0; n < pAppGrp->nclients; n++)
if (pAppGrp->clients[n] == pClient) { if (pAppGrp->clients[n] == pClient) {

View File

@ -1452,15 +1452,17 @@ ProcSyncSetPriority(client)
{ {
REQUEST(xSyncSetPriorityReq); REQUEST(xSyncSetPriorityReq);
ClientPtr priorityclient; ClientPtr priorityclient;
int rc;
REQUEST_SIZE_MATCH(xSyncSetPriorityReq); REQUEST_SIZE_MATCH(xSyncSetPriorityReq);
if (stuff->id == None) if (stuff->id == None)
priorityclient = client; priorityclient = client;
else if (!(priorityclient = LookupClient(stuff->id, client))) else {
{ rc = dixLookupClient(&priorityclient, stuff->id, client,
client->errorValue = stuff->id; DixUnknownAccess);
return BadMatch; if (rc != Success)
return rc;
} }
if (priorityclient->priority != stuff->priority) if (priorityclient->priority != stuff->priority)
@ -1487,15 +1489,17 @@ ProcSyncGetPriority(client)
REQUEST(xSyncGetPriorityReq); REQUEST(xSyncGetPriorityReq);
xSyncGetPriorityReply rep; xSyncGetPriorityReply rep;
ClientPtr priorityclient; ClientPtr priorityclient;
int rc;
REQUEST_SIZE_MATCH(xSyncGetPriorityReq); REQUEST_SIZE_MATCH(xSyncGetPriorityReq);
if (stuff->id == None) if (stuff->id == None)
priorityclient = client; priorityclient = client;
else if (!(priorityclient = LookupClient(stuff->id, client))) else {
{ rc = dixLookupClient(&priorityclient, stuff->id, client,
client->errorValue = stuff->id; DixUnknownAccess);
return BadMatch; if (rc != Success)
return rc;
} }
rep.type = X_Reply; rep.type = X_Reply;

View File

@ -3388,7 +3388,8 @@ int
ProcKillClient(register ClientPtr client) ProcKillClient(register ClientPtr client)
{ {
REQUEST(xResourceReq); REQUEST(xResourceReq);
ClientPtr killclient; ClientPtr killclient;
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
if (stuff->id == AllTemporary) if (stuff->id == AllTemporary)
@ -3397,8 +3398,8 @@ ProcKillClient(register ClientPtr client)
return (client->noClientException); return (client->noClientException);
} }
if ((killclient = LookupClient(stuff->id, client))) rc = dixLookupClient(&killclient, stuff->id, client, DixDestroyAccess);
{ if (rc == Success) {
CloseDownClient(killclient); CloseDownClient(killclient);
/* if an LBX proxy gets killed, isItTimeToYield will be set */ /* if an LBX proxy gets killed, isItTimeToYield will be set */
if (isItTimeToYield || (client == killclient)) if (isItTimeToYield || (client == killclient))
@ -3412,10 +3413,7 @@ ProcKillClient(register ClientPtr client)
return (client->noClientException); return (client->noClientException);
} }
else else
{ return rc;
client->errorValue = stuff->id;
return (BadValue);
}
} }
int int

View File

@ -262,11 +262,12 @@ dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access)
} }
_X_EXPORT int _X_EXPORT int
dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client) dixLookupClient(ClientPtr *pClient, XID rid, ClientPtr client, Mask access)
{ {
pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY, pointer pRes = (pointer)SecurityLookupIDByClass(client, rid, RC_ANY,
DixReadAccess); DixReadAccess);
int clientIndex = CLIENT_ID(rid); int clientIndex = CLIENT_ID(rid);
client->errorValue = rid;
if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) { if (clientIndex && pRes && clients[clientIndex] && !(rid & SERVER_BIT)) {
*pClient = clients[clientIndex]; *pClient = clients[clientIndex];
@ -312,7 +313,7 @@ _X_EXPORT ClientPtr
LookupClient(XID id, ClientPtr client) LookupClient(XID id, ClientPtr client)
{ {
ClientPtr pClient; ClientPtr pClient;
int i = dixLookupClient(&pClient, id, client); int i = dixLookupClient(&pClient, id, client, DixUnknownAccess);
return (i == Success) ? pClient : NULL; return (i == Success) ? pClient : NULL;
} }

View File

@ -301,7 +301,8 @@ extern int dixLookupGC(
extern int dixLookupClient( extern int dixLookupClient(
ClientPtr *result, ClientPtr *result,
XID id, XID id,
ClientPtr client); ClientPtr client,
Mask access_mode);
/* /*
* These are deprecated compatibility functions and will be removed soon! * These are deprecated compatibility functions and will be removed soon!