Convert callers of SecurityLookupWindow() to dixLookupWindow().

This commit is contained in:
Eamon Walsh 2006-12-15 15:50:46 -05:00 committed by Eamon Walsh
parent 04c721854f
commit 25d5e0a629
18 changed files with 273 additions and 312 deletions

View File

@ -577,19 +577,17 @@ int PanoramiXTranslateCoords(ClientPtr client)
{ {
INT16 x, y; INT16 x, y;
REQUEST(xTranslateCoordsReq); REQUEST(xTranslateCoordsReq);
int rc;
register WindowPtr pWin, pDst; WindowPtr pWin, pDst;
xTranslateCoordsReply rep; xTranslateCoordsReply rep;
REQUEST_SIZE_MATCH(xTranslateCoordsReq); REQUEST_SIZE_MATCH(xTranslateCoordsReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow); rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, if (rc != Success)
DixReadAccess); return rc;
if (!pDst)
return(BadWindow);
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;

View File

@ -419,12 +419,13 @@ ProcShapeMask (client)
RegionPtr *destRgn; RegionPtr *destRgn;
PixmapPtr pPixmap; PixmapPtr pPixmap;
CreateDftPtr createDefault; CreateDftPtr createDefault;
int rc;
REQUEST_SIZE_MATCH (xShapeMaskReq); REQUEST_SIZE_MATCH (xShapeMaskReq);
UpdateCurrentTime(); UpdateCurrentTime();
pWin = SecurityLookupWindow (stuff->dest, client, DixWriteAccess); rc = dixLookupWindow(&pWin, stuff->dest, client, DixWriteAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
switch (stuff->destKind) { switch (stuff->destKind) {
case ShapeBounding: case ShapeBounding:
createDefault = CreateBoundingShape; createDefault = CreateBoundingShape;
@ -822,11 +823,12 @@ ProcShapeSelectInput (client)
WindowPtr pWin; WindowPtr pWin;
ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead; ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead;
XID clientResource; XID clientResource;
int rc;
REQUEST_SIZE_MATCH (xShapeSelectInputReq); REQUEST_SIZE_MATCH (xShapeSelectInputReq);
pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
pWin->drawable.id, EventType, DixWriteAccess); pWin->drawable.id, EventType, DixWriteAccess);
switch (stuff->enable) { switch (stuff->enable) {

View File

@ -1852,9 +1852,10 @@ ProcXpStartPage(ClientPtr client)
if(pContext->state & PAGE_STARTED) if(pContext->state & PAGE_STARTED)
return XpErrorBase+XPBadSequence; return XpErrorBase+XPBadSequence;
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (result != Success)
if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum) return result;
if (pWin->drawable.pScreen->myNum != pContext->screenNum)
return BadWindow; return BadWindow;
if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL) if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL)

View File

@ -405,11 +405,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
/* The window must be valid. */ /* The window must be valid. */
if (!(pWin = SecurityLookupWindow(stuff->window, client, status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess))) if (status != Success)
{ return status;
return(BadWindow);
}
/* The window must be InputOutput. */ /* The window must be InputOutput. */
if (pWin->drawable.class != InputOutput) if (pWin->drawable.class != InputOutput)
@ -729,11 +727,11 @@ ProcDbeSwapBuffers(ClientPtr client)
/* Check all windows to swap. */ /* Check all windows to swap. */
/* Each window must be a valid window - BadWindow. */ /* Each window must be a valid window - BadWindow. */
if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client,
DixWriteAccess))) DixWriteAccess);
{ if (error != Success) {
DEALLOCATE_LOCAL(swapInfo); DEALLOCATE_LOCAL(swapInfo);
return(BadWindow); return error;
} }
/* Each window must be double-buffered - BadMatch. */ /* Each window must be double-buffered - BadMatch. */

View File

@ -1840,16 +1840,16 @@ ProcGetMotionEvents(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
xTimecoord * coords = (xTimecoord *) NULL; xTimecoord * coords = (xTimecoord *) NULL;
xGetMotionEventsReply rep; xGetMotionEventsReply rep;
int i, count, xmin, xmax, ymin, ymax; int i, count, xmin, xmax, ymin, ymax, rc;
unsigned long nEvents; unsigned long nEvents;
DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr mouse = inputInfo.pointer;
TimeStamp start, stop; TimeStamp start, stop;
REQUEST(xGetMotionEventsReq); REQUEST(xGetMotionEventsReq);
REQUEST_SIZE_MATCH(xGetMotionEventsReq); REQUEST_SIZE_MATCH(xGetMotionEventsReq);
pWin = SecurityLookupWindow(stuff->window, client, TRUE); rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
rep.type = X_Reply; rep.type = X_Reply;

View File

@ -554,17 +554,16 @@ ProcBadRequest(ClientPtr client)
int int
ProcCreateWindow(ClientPtr client) ProcCreateWindow(ClientPtr client)
{ {
register WindowPtr pParent, pWin; WindowPtr pParent, pWin;
REQUEST(xCreateWindowReq); REQUEST(xCreateWindowReq);
int result; int result, len, rc;
int len;
REQUEST_AT_LEAST_SIZE(xCreateWindowReq); REQUEST_AT_LEAST_SIZE(xCreateWindowReq);
LEGAL_NEW_RESOURCE(stuff->wid, client); LEGAL_NEW_RESOURCE(stuff->wid, client);
if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess);
DixWriteAccess))) if (rc != Success)
return BadWindow; return rc;
len = client->req_len - (sizeof(xCreateWindowReq) >> 2); len = client->req_len - (sizeof(xCreateWindowReq) >> 2);
if (Ones(stuff->mask) != len) if (Ones(stuff->mask) != len)
return BadLength; return BadLength;
@ -597,16 +596,15 @@ ProcCreateWindow(ClientPtr client)
int int
ProcChangeWindowAttributes(register ClientPtr client) ProcChangeWindowAttributes(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq); REQUEST(xChangeWindowAttributesReq);
register int result; register int result;
int len; int len, rc;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2);
if (len != Ones(stuff->valueMask)) if (len != Ones(stuff->valueMask))
return BadLength; return BadLength;
@ -623,15 +621,15 @@ ProcChangeWindowAttributes(register ClientPtr client)
int int
ProcGetWindowAttributes(register ClientPtr client) ProcGetWindowAttributes(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
xGetWindowAttributesReply wa; xGetWindowAttributesReply wa;
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
GetWindowAttributes(pWin, client, &wa); GetWindowAttributes(pWin, client, &wa);
WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa);
return(client->noClientException); return(client->noClientException);
@ -640,14 +638,14 @@ ProcGetWindowAttributes(register ClientPtr client)
int int
ProcDestroyWindow(register ClientPtr client) ProcDestroyWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
DixDestroyAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (pWin->parent) if (pWin->parent)
FreeResource(stuff->id, RT_NONE); FreeResource(stuff->id, RT_NONE);
return(client->noClientException); return(client->noClientException);
@ -656,14 +654,14 @@ ProcDestroyWindow(register ClientPtr client)
int int
ProcDestroySubwindows(register ClientPtr client) ProcDestroySubwindows(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess);
DixDestroyAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
DestroySubwindows(pWin, client); DestroySubwindows(pWin, client);
return(client->noClientException); return(client->noClientException);
} }
@ -671,15 +669,14 @@ ProcDestroySubwindows(register ClientPtr client)
int int
ProcChangeSaveSet(register ClientPtr client) ProcChangeSaveSet(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xChangeSaveSetReq); REQUEST(xChangeSaveSetReq);
register int result; register int result, rc;
REQUEST_SIZE_MATCH(xChangeSaveSetReq); REQUEST_SIZE_MATCH(xChangeSaveSetReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch; return BadMatch;
if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete))
@ -700,19 +697,17 @@ ProcChangeSaveSet(register ClientPtr client)
int int
ProcReparentWindow(register ClientPtr client) ProcReparentWindow(register ClientPtr client)
{ {
register WindowPtr pWin, pParent; WindowPtr pWin, pParent;
REQUEST(xReparentWindowReq); REQUEST(xReparentWindowReq);
register int result; register int result, rc;
REQUEST_SIZE_MATCH(xReparentWindowReq); REQUEST_SIZE_MATCH(xReparentWindowReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow); rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess);
pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, if (rc != Success)
DixWriteAccess); return rc;
if (!pParent)
return(BadWindow);
if (SAME_SCREENS(pWin->drawable, pParent->drawable)) if (SAME_SCREENS(pWin->drawable, pParent->drawable))
{ {
if ((pWin->backgroundState == ParentRelative) && if ((pWin->backgroundState == ParentRelative) &&
@ -735,14 +730,14 @@ ProcReparentWindow(register ClientPtr client)
int int
ProcMapWindow(register ClientPtr client) ProcMapWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
MapWindow(pWin, client); MapWindow(pWin, client);
/* update cache to say it is mapped */ /* update cache to say it is mapped */
return(client->noClientException); return(client->noClientException);
@ -751,14 +746,14 @@ ProcMapWindow(register ClientPtr client)
int int
ProcMapSubwindows(register ClientPtr client) ProcMapSubwindows(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
MapSubwindows(pWin, client); MapSubwindows(pWin, client);
/* update cache to say it is mapped */ /* update cache to say it is mapped */
return(client->noClientException); return(client->noClientException);
@ -767,14 +762,14 @@ ProcMapSubwindows(register ClientPtr client)
int int
ProcUnmapWindow(register ClientPtr client) ProcUnmapWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
UnmapWindow(pWin, FALSE); UnmapWindow(pWin, FALSE);
/* update cache to say it is mapped */ /* update cache to say it is mapped */
return(client->noClientException); return(client->noClientException);
@ -783,14 +778,14 @@ ProcUnmapWindow(register ClientPtr client)
int int
ProcUnmapSubwindows(register ClientPtr client) ProcUnmapSubwindows(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
UnmapSubwindows(pWin); UnmapSubwindows(pWin);
return(client->noClientException); return(client->noClientException);
} }
@ -798,16 +793,15 @@ ProcUnmapSubwindows(register ClientPtr client)
int int
ProcConfigureWindow(register ClientPtr client) ProcConfigureWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xConfigureWindowReq); REQUEST(xConfigureWindowReq);
register int result; register int result;
int len; int len, rc;
REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); REQUEST_AT_LEAST_SIZE(xConfigureWindowReq);
pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); len = client->req_len - (sizeof(xConfigureWindowReq) >> 2);
if (Ones((Mask)stuff->mask) != len) if (Ones((Mask)stuff->mask) != len)
return BadLength; return BadLength;
@ -822,8 +816,9 @@ ProcConfigureWindow(register ClientPtr client)
int int
ProcCirculateWindow(register ClientPtr client) ProcCirculateWindow(register ClientPtr client)
{ {
register WindowPtr pWin; WindowPtr pWin;
REQUEST(xCirculateWindowReq); REQUEST(xCirculateWindowReq);
int rc;
REQUEST_SIZE_MATCH(xCirculateWindowReq); REQUEST_SIZE_MATCH(xCirculateWindowReq);
if ((stuff->direction != RaiseLowest) && if ((stuff->direction != RaiseLowest) &&
@ -832,10 +827,9 @@ ProcCirculateWindow(register ClientPtr client)
client->errorValue = stuff->direction; client->errorValue = stuff->direction;
return BadValue; return BadValue;
} }
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
CirculateWindow(pWin, (int)stuff->direction, client); CirculateWindow(pWin, (int)stuff->direction, client);
return(client->noClientException); return(client->noClientException);
} }
@ -903,16 +897,15 @@ int
ProcQueryTree(register ClientPtr client) ProcQueryTree(register ClientPtr client)
{ {
xQueryTreeReply reply; xQueryTreeReply reply;
int numChildren = 0; int rc, numChildren = 0;
register WindowPtr pChild, pWin, pHead; WindowPtr pChild, pWin, pHead;
Window *childIDs = (Window *)NULL; Window *childIDs = (Window *)NULL;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
reply.type = X_Reply; reply.type = X_Reply;
reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
reply.sequenceNumber = client->sequence; reply.sequenceNumber = client->sequence;
@ -1025,10 +1018,9 @@ ProcSetSelectionOwner(register ClientPtr client)
return Success; return Success;
if (stuff->window != None) if (stuff->window != None)
{ {
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, int rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
} }
else else
pWin = (WindowPtr)None; pWin = (WindowPtr)None;
@ -1142,12 +1134,12 @@ ProcConvertSelection(register ClientPtr client)
xEvent event; xEvent event;
WindowPtr pWin; WindowPtr pWin;
REQUEST(xConvertSelectionReq); REQUEST(xConvertSelectionReq);
int rc;
REQUEST_SIZE_MATCH(xConvertSelectionReq); REQUEST_SIZE_MATCH(xConvertSelectionReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, rc = dixLookupWindow(&pWin, stuff->requestor, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target));
if (stuff->property != None) if (stuff->property != None)
@ -1262,18 +1254,17 @@ ProcTranslateCoords(register ClientPtr client)
{ {
REQUEST(xTranslateCoordsReq); REQUEST(xTranslateCoordsReq);
register WindowPtr pWin, pDst; WindowPtr pWin, pDst;
xTranslateCoordsReply rep; xTranslateCoordsReply rep;
int rc;
REQUEST_SIZE_MATCH(xTranslateCoordsReq); REQUEST_SIZE_MATCH(xTranslateCoordsReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow); rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, if (rc != Success)
DixReadAccess); return rc;
if (!pDst)
return(BadWindow);
rep.type = X_Reply; rep.type = X_Reply;
rep.length = 0; rep.length = 0;
rep.sequenceNumber = client->sequence; rep.sequenceNumber = client->sequence;
@ -1762,13 +1753,13 @@ int
ProcClearToBackground(register ClientPtr client) ProcClearToBackground(register ClientPtr client)
{ {
REQUEST(xClearAreaReq); REQUEST(xClearAreaReq);
register WindowPtr pWin; WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH(xClearAreaReq); REQUEST_SIZE_MATCH(xClearAreaReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (pWin->drawable.class == InputOnly) if (pWin->drawable.class == InputOnly)
{ {
client->errorValue = stuff->window; client->errorValue = stuff->window;
@ -2496,7 +2487,7 @@ ProcCreateColormap(register ClientPtr client)
VisualPtr pVisual; VisualPtr pVisual;
ColormapPtr pmap; ColormapPtr pmap;
Colormap mid; Colormap mid;
register WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
REQUEST(xCreateColormapReq); REQUEST(xCreateColormapReq);
int i, result; int i, result;
@ -2510,10 +2501,9 @@ ProcCreateColormap(register ClientPtr client)
} }
mid = stuff->mid; mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client); LEGAL_NEW_RESOURCE(mid, client);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (result != Success)
if (!pWin) return result;
return(BadWindow);
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
for (i = 0, pVisual = pScreen->visuals; for (i = 0, pVisual = pScreen->visuals;
@ -2631,16 +2621,14 @@ int
ProcListInstalledColormaps(register ClientPtr client) ProcListInstalledColormaps(register ClientPtr client)
{ {
xListInstalledColormapsReply *preply; xListInstalledColormapsReply *preply;
int nummaps; int nummaps, rc;
WindowPtr pWin; WindowPtr pWin;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
return rc;
if (!pWin)
return(BadWindow);
preply = (xListInstalledColormapsReply *) preply = (xListInstalledColormapsReply *)
ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) +

View File

@ -2228,16 +2228,15 @@ static int
XineramaWarpPointer(ClientPtr client) XineramaWarpPointer(ClientPtr client)
{ {
WindowPtr dest = NULL; WindowPtr dest = NULL;
int x, y; int x, y, rc;
REQUEST(xWarpPointerReq); REQUEST(xWarpPointerReq);
if (stuff->dstWid != None) if (stuff->dstWid != None) {
{ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (rc != Success)
if (!dest) return rc;
return BadWindow;
} }
x = sprite.hotPhys.x; x = sprite.hotPhys.x;
y = sprite.hotPhys.y; y = sprite.hotPhys.y;
@ -2248,8 +2247,9 @@ XineramaWarpPointer(ClientPtr client)
XID winID = stuff->srcWid; XID winID = stuff->srcWid;
WindowPtr source; WindowPtr source;
source = SecurityLookupWindow(winID, client, DixReadAccess); rc = dixLookupWindow(&source, winID, client, DixReadAccess);
if (!source) return BadWindow; if (rc != Success)
return rc;
winX = source->drawable.x; winX = source->drawable.x;
winY = source->drawable.y; winY = source->drawable.y;
@ -2301,7 +2301,7 @@ int
ProcWarpPointer(ClientPtr client) ProcWarpPointer(ClientPtr client)
{ {
WindowPtr dest = NULL; WindowPtr dest = NULL;
int x, y; int x, y, rc;
ScreenPtr newScreen; ScreenPtr newScreen;
REQUEST(xWarpPointerReq); REQUEST(xWarpPointerReq);
@ -2313,11 +2313,10 @@ ProcWarpPointer(ClientPtr client)
return XineramaWarpPointer(client); return XineramaWarpPointer(client);
#endif #endif
if (stuff->dstWid != None) if (stuff->dstWid != None) {
{ rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess);
dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); if (rc != Success)
if (!dest) return rc;
return BadWindow;
} }
x = sprite.hotPhys.x; x = sprite.hotPhys.x;
y = sprite.hotPhys.y; y = sprite.hotPhys.y;
@ -2328,8 +2327,9 @@ ProcWarpPointer(ClientPtr client)
XID winID = stuff->srcWid; XID winID = stuff->srcWid;
WindowPtr source; WindowPtr source;
source = SecurityLookupWindow(winID, client, DixReadAccess); rc = dixLookupWindow(&source, winID, client, DixReadAccess);
if (!source) return BadWindow; if (rc != Success)
return rc;
winX = source->drawable.x; winX = source->drawable.x;
winY = source->drawable.y; winY = source->drawable.y;
@ -3532,8 +3532,8 @@ SetInputFocus(
Bool followOK) Bool followOK)
{ {
register FocusClassPtr focus; register FocusClassPtr focus;
register WindowPtr focusWin; WindowPtr focusWin;
int mode; int mode, rc;
TimeStamp time; TimeStamp time;
UpdateCurrentTime(); UpdateCurrentTime();
@ -3550,14 +3550,12 @@ SetInputFocus(
focusWin = (WindowPtr)(long)focusID; focusWin = (WindowPtr)(long)focusID;
else if ((focusID == FollowKeyboard) && followOK) else if ((focusID == FollowKeyboard) && followOK)
focusWin = inputInfo.keyboard->focus->win; focusWin = inputInfo.keyboard->focus->win;
else if (!(focusWin = SecurityLookupWindow(focusID, client, else {
DixReadAccess))) rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess);
return BadWindow; if (rc != Success)
else return rc;
{
/* It is a match error to try to set the input focus to an /* It is a match error to try to set the input focus to an
unviewable window. */ unviewable window. */
if(!focusWin->realized) if(!focusWin->realized)
return(BadMatch); return(BadMatch);
} }
@ -3646,6 +3644,7 @@ ProcGrabPointer(ClientPtr client)
CursorPtr cursor, oldCursor; CursorPtr cursor, oldCursor;
REQUEST(xGrabPointerReq); REQUEST(xGrabPointerReq);
TimeStamp time; TimeStamp time;
int rc;
REQUEST_SIZE_MATCH(xGrabPointerReq); REQUEST_SIZE_MATCH(xGrabPointerReq);
UpdateCurrentTime(); UpdateCurrentTime();
@ -3671,17 +3670,17 @@ ProcGrabPointer(ClientPtr client)
client->errorValue = stuff->eventMask; client->errorValue = stuff->eventMask;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (stuff->confineTo == None) if (stuff->confineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else else
{ {
confineTo = SecurityLookupWindow(stuff->confineTo, client, rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
DixReadAccess); DixReadAccess);
if (!confineTo) if (rc != Success)
return BadWindow; return rc;
} }
if (stuff->cursor == None) if (stuff->cursor == None)
cursor = NullCursor; cursor = NullCursor;
@ -3812,9 +3811,10 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned this_mode, unsigned other_mode, Window grabWindow,
unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status) unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status)
{ {
register WindowPtr pWin; WindowPtr pWin;
register GrabPtr grab; register GrabPtr grab;
TimeStamp time; TimeStamp time;
int rc;
UpdateCurrentTime(); UpdateCurrentTime();
if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync))
@ -3832,9 +3832,9 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev,
client->errorValue = ownerEvents; client->errorValue = ownerEvents;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
time = ClientTimeToServerTime(ctime); time = ClientTimeToServerTime(ctime);
grab = dev->grab; grab = dev->grab;
if (grab && !SameClient(grab, client)) if (grab && !SameClient(grab, client))
@ -3918,11 +3918,12 @@ ProcQueryPointer(ClientPtr client)
WindowPtr pWin, t; WindowPtr pWin, t;
REQUEST(xResourceReq); REQUEST(xResourceReq);
DeviceIntPtr mouse = inputInfo.pointer; DeviceIntPtr mouse = inputInfo.pointer;
int rc;
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = SecurityLookupWindow(stuff->id, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
rep.type = X_Reply; rep.type = X_Reply;
@ -4086,8 +4087,8 @@ ProcSendEvent(ClientPtr client)
effectiveFocus = pWin = inputFocus; effectiveFocus = pWin = inputFocus;
} }
else else
pWin = SecurityLookupWindow(stuff->destination, client, dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess);
DixReadAccess);
if (!pWin) if (!pWin)
return BadWindow; return BadWindow;
if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue))
@ -4123,11 +4124,12 @@ ProcUngrabKey(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
GrabRec tempGrab; GrabRec tempGrab;
DeviceIntPtr keybd = inputInfo.keyboard; DeviceIntPtr keybd = inputInfo.keyboard;
int rc;
REQUEST_SIZE_MATCH(xUngrabKeyReq); REQUEST_SIZE_MATCH(xUngrabKeyReq);
pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) ||
(stuff->key < keybd->key->curKeySyms.minKeyCode)) (stuff->key < keybd->key->curKeySyms.minKeyCode))
@ -4164,6 +4166,7 @@ ProcGrabKey(ClientPtr client)
REQUEST(xGrabKeyReq); REQUEST(xGrabKeyReq);
GrabPtr grab; GrabPtr grab;
DeviceIntPtr keybd = inputInfo.keyboard; DeviceIntPtr keybd = inputInfo.keyboard;
int rc;
REQUEST_SIZE_MATCH(xGrabKeyReq); REQUEST_SIZE_MATCH(xGrabKeyReq);
if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse))
@ -4196,9 +4199,9 @@ ProcGrabKey(ClientPtr client)
client->errorValue = stuff->modifiers; client->errorValue = stuff->modifiers;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
grab = CreateGrab(client->index, keybd, pWin, grab = CreateGrab(client->index, keybd, pWin,
(Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents,
@ -4218,6 +4221,7 @@ ProcGrabButton(ClientPtr client)
REQUEST(xGrabButtonReq); REQUEST(xGrabButtonReq);
CursorPtr cursor; CursorPtr cursor;
GrabPtr grab; GrabPtr grab;
int rc;
REQUEST_SIZE_MATCH(xGrabButtonReq); REQUEST_SIZE_MATCH(xGrabButtonReq);
if ((stuff->pointerMode != GrabModeSync) && if ((stuff->pointerMode != GrabModeSync) &&
@ -4248,16 +4252,16 @@ ProcGrabButton(ClientPtr client)
client->errorValue = stuff->eventMask; client->errorValue = stuff->eventMask;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
if (stuff->confineTo == None) if (stuff->confineTo == None)
confineTo = NullWindow; confineTo = NullWindow;
else { else {
confineTo = SecurityLookupWindow(stuff->confineTo, client, rc = dixLookupWindow(&confineTo, stuff->confineTo, client,
DixReadAccess); DixReadAccess);
if (!confineTo) if (rc != Success)
return BadWindow; return rc;
} }
if (stuff->cursor == None) if (stuff->cursor == None)
cursor = NullCursor; cursor = NullCursor;
@ -4289,6 +4293,7 @@ ProcUngrabButton(ClientPtr client)
REQUEST(xUngrabButtonReq); REQUEST(xUngrabButtonReq);
WindowPtr pWin; WindowPtr pWin;
GrabRec tempGrab; GrabRec tempGrab;
int rc;
REQUEST_SIZE_MATCH(xUngrabButtonReq); REQUEST_SIZE_MATCH(xUngrabButtonReq);
if ((stuff->modifiers != AnyModifier) && if ((stuff->modifiers != AnyModifier) &&
@ -4297,9 +4302,9 @@ ProcUngrabButton(ClientPtr client)
client->errorValue = stuff->modifiers; client->errorValue = stuff->modifiers;
return BadValue; return BadValue;
} }
pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
tempGrab.resource = client->clientAsMask; tempGrab.resource = client->clientAsMask;
tempGrab.device = inputInfo.pointer; tempGrab.device = inputInfo.pointer;
tempGrab.window = pWin; tempGrab.window = pWin;

View File

@ -94,7 +94,7 @@ PrintPropertys(WindowPtr pWin)
int int
ProcRotateProperties(ClientPtr client) ProcRotateProperties(ClientPtr client)
{ {
int i, j, delta; int i, j, delta, rc;
REQUEST(xRotatePropertiesReq); REQUEST(xRotatePropertiesReq);
WindowPtr pWin; WindowPtr pWin;
register Atom * atoms; register Atom * atoms;
@ -104,10 +104,9 @@ ProcRotateProperties(ClientPtr client)
REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2);
UpdateCurrentTime(); UpdateCurrentTime();
pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (!stuff->nAtoms) if (!stuff->nAtoms)
return(Success); return(Success);
atoms = (Atom *) & stuff[1]; atoms = (Atom *) & stuff[1];
@ -181,9 +180,7 @@ ProcChangeProperty(ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
char format, mode; char format, mode;
unsigned long len; unsigned long len;
int sizeInBytes; int sizeInBytes, totalSize, err;
int totalSize;
int err;
REQUEST(xChangePropertyReq); REQUEST(xChangePropertyReq);
REQUEST_AT_LEAST_SIZE(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq);
@ -208,10 +205,9 @@ ProcChangeProperty(ClientPtr client)
totalSize = len * sizeInBytes; totalSize = len * sizeInBytes;
REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (err != Success)
if (!pWin) return err;
return(BadWindow);
if (!ValidAtom(stuff->property)) if (!ValidAtom(stuff->property))
{ {
client->errorValue = stuff->property; client->errorValue = stuff->property;
@ -445,7 +441,7 @@ int
ProcGetProperty(ClientPtr client) ProcGetProperty(ClientPtr client)
{ {
PropertyPtr pProp, prevProp; PropertyPtr pProp, prevProp;
unsigned long n, len, ind; unsigned long n, len, ind, rc;
WindowPtr pWin; WindowPtr pWin;
xGetPropertyReply reply; xGetPropertyReply reply;
Mask access_mode = DixReadAccess; Mask access_mode = DixReadAccess;
@ -454,10 +450,9 @@ ProcGetProperty(ClientPtr client)
REQUEST_SIZE_MATCH(xGetPropertyReq); REQUEST_SIZE_MATCH(xGetPropertyReq);
if (stuff->delete) if (stuff->delete)
UpdateCurrentTime(); UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return BadWindow;
if (!ValidAtom(stuff->property)) if (!ValidAtom(stuff->property))
{ {
@ -585,16 +580,15 @@ ProcListProperties(ClientPtr client)
{ {
Atom *pAtoms = NULL, *temppAtoms; Atom *pAtoms = NULL, *temppAtoms;
xListPropertiesReply xlpr; xListPropertiesReply xlpr;
int numProps = 0; int rc, numProps = 0;
WindowPtr pWin; WindowPtr pWin;
PropertyPtr pProp; PropertyPtr pProp;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
pProp = wUserProps (pWin); pProp = wUserProps (pWin);
while (pProp) while (pProp)
@ -636,10 +630,9 @@ ProcDeleteProperty(register ClientPtr client)
REQUEST_SIZE_MATCH(xDeletePropertyReq); REQUEST_SIZE_MATCH(xDeletePropertyReq);
UpdateCurrentTime(); UpdateCurrentTime();
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
DixWriteAccess); if (result != Success)
if (!pWin) return result;
return(BadWindow);
if (!ValidAtom(stuff->property)) if (!ValidAtom(stuff->property))
{ {
client->errorValue = stuff->property; client->errorValue = stuff->property;

View File

@ -490,11 +490,9 @@ ProcAppleWMSetWindowLevel(
REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq);
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, if (Success != dixLookupWindow(&pWin, stuff->window, client,
client, DixReadAccess))) DixReadAccess))
{
return BadValue; return BadValue;
}
if (stuff->level < 0 || stuff->level >= AppleWMNumWindowLevels) { if (stuff->level < 0 || stuff->level >= AppleWMNumWindowLevels) {
return BadValue; return BadValue;
@ -602,11 +600,9 @@ ProcAppleWMFrameDraw(
REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq); REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq);
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, if (Success != dixLookupWindow(&pWin, stuff->window, client,
client, DixReadAccess))) DixReadAccess))
{
return BadValue; return BadValue;
}
ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih); ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih);
or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh); or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh);

View File

@ -286,8 +286,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
return -1; /* BadWindow */ return -1; /* BadWindow */
FOR_NSCREENS(i) { FOR_NSCREENS(i) {
if (!(pWin = SecurityLookupWindow(win->info[i].id, client, if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
DixReadAccess))) DixReadAccess))
return -1; /* BadWindow */ return -1; /* BadWindow */
dmxForceWindowCreation(pWin); dmxForceWindowCreation(pWin);
@ -296,8 +296,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client)
} }
#endif #endif
if (!(pWin = SecurityLookupWindow(stuff->window, client, if (Success != dixLookupWindow(&pWin, stuff->window, client,
DixReadAccess))) DixReadAccess))
return -1; /* BadWindow */ return -1; /* BadWindow */
dmxForceWindowCreation(pWin); dmxForceWindowCreation(pWin);
@ -560,8 +560,8 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window,
return -1; /* BadWindow */ return -1; /* BadWindow */
FOR_NSCREENS(i) { FOR_NSCREENS(i) {
if (!(pWin = SecurityLookupWindow(win->info[i].id, client, if (Success != dixLookupWindow(&pWin, win->info[i].id, client,
DixReadAccess))) DixReadAccess))
return -1; /* BadWindow */ return -1; /* BadWindow */
if (dmxGetWindowAttributes(pWin, &attr)) { if (dmxGetWindowAttributes(pWin, &attr)) {
screens[count] = attr.screen; screens[count] = attr.screen;
@ -587,7 +587,7 @@ static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens,
pos, vis); pos, vis);
#endif #endif
if (!(pWin = SecurityLookupWindow(window, client, DixReadAccess))) if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess))
return -1; /* BadWindow */ return -1; /* BadWindow */
dmxGetWindowAttributes(pWin, &attr); dmxGetWindowAttributes(pWin, &attr);

View File

@ -1137,9 +1137,7 @@ static int MakeCurrent(__GLXclientState *cl,
} }
#ifdef PANORAMIX #ifdef PANORAMIX
else if (pXinDraw) { else if (pXinDraw) {
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
client,
DixReadAccess);
} }
#endif #endif
else if (pGlxWindow) { else if (pGlxWindow) {
@ -1195,9 +1193,8 @@ static int MakeCurrent(__GLXclientState *cl,
} }
#ifdef PANORAMIX #ifdef PANORAMIX
else if (pXinReadDraw) { else if (pXinReadDraw) {
pReadWin = (WindowPtr)SecurityLookupWindow(pXinReadDraw->info[s].id, dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client,
client, DixReadAccess);
DixReadAccess);
} }
#endif #endif
else if (pGlxReadWindow) { else if (pGlxReadWindow) {
@ -2058,9 +2055,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag)
} }
#ifdef PANORAMIX #ifdef PANORAMIX
else if (pXinDraw) { else if (pXinDraw) {
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess);
client,
DixReadAccess);
} }
#endif #endif
else if (pGlxWindow) { else if (pGlxWindow) {
@ -3359,9 +3354,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
return __glXBadDrawable; return __glXBadDrawable;
} }
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
client, DixReadAccess);
DixReadAccess);
} }
#endif #endif
@ -3521,9 +3515,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc)
return __glXBadDrawable; return __glXBadDrawable;
} }
pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, dixLookupWindow(&pWin, pXinDraw->info[screen].id, client,
client, DixReadAccess);
DixReadAccess);
} }
#endif #endif

View File

@ -344,13 +344,11 @@ winProcSetSelectionOwner (ClientPtr client)
if (None != stuff->window) if (None != stuff->window)
{ {
/* Grab the Window from the request */ /* Grab the Window from the request */
pWindow = (WindowPtr) SecurityLookupWindow (stuff->window, client, int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success) {
if (!pWindow)
{
ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n"); ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n");
goto winProcSetSelectionOwner_Done; goto winProcSetSelectionOwner_Done;
} }
} }
/* Now we either have a valid window or None */ /* Now we either have a valid window or None */

View File

@ -441,7 +441,7 @@ ProcWindowsWMFrameDraw (register ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
win32RootlessWindowPtr pRLWinPriv; win32RootlessWindowPtr pRLWinPriv;
RECT rcNew; RECT rcNew;
int nCmdShow; int nCmdShow, rc;
RegionRec newShape; RegionRec newShape;
ScreenPtr pScreen; ScreenPtr pScreen;
@ -450,11 +450,9 @@ ProcWindowsWMFrameDraw (register ClientPtr client)
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameDraw\n"); ErrorF ("ProcWindowsWMFrameDraw\n");
#endif #endif
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
client, DixReadAccess))) if (rc != Success)
{ return rc;
return BadValue;
}
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameDraw - Window found\n"); ErrorF ("ProcWindowsWMFrameDraw - Window found\n");
#endif #endif
@ -538,6 +536,7 @@ ProcWindowsWMFrameSetTitle(
REQUEST(xWindowsWMFrameSetTitleReq); REQUEST(xWindowsWMFrameSetTitleReq);
WindowPtr pWin; WindowPtr pWin;
win32RootlessWindowPtr pRLWinPriv; win32RootlessWindowPtr pRLWinPriv;
int rc;
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameSetTitle\n"); ErrorF ("ProcWindowsWMFrameSetTitle\n");
@ -545,11 +544,9 @@ ProcWindowsWMFrameSetTitle(
REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq);
if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
client, DixReadAccess))) if (rc != Success)
{ return rc;
return BadValue;
}
#if CYGMULTIWINDOW_DEBUG #if CYGMULTIWINDOW_DEBUG
ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n"); ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n");
#endif #endif

View File

@ -70,11 +70,12 @@ ProcRRSelectInput (ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
RREventPtr pRREvent, *pHead; RREventPtr pRREvent, *pHead;
XID clientResource; XID clientResource;
int rc;
REQUEST_SIZE_MATCH(xRRSelectInputReq); REQUEST_SIZE_MATCH(xRRSelectInputReq);
pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
if (!pWin) if (rc != Success)
return BadWindow; return rc;
pHead = (RREventPtr *)SecurityLookupIDByType(client, pHead = (RREventPtr *)SecurityLookupIDByType(client,
pWin->drawable.id, RREventType, pWin->drawable.id, RREventType,
DixWriteAccess); DixWriteAccess);

View File

@ -217,13 +217,12 @@ ProcRRGetScreenSizeRange (ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
int rc;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
return rc;
if (!pWin)
return BadWindow;
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
@ -268,14 +267,12 @@ ProcRRSetScreenSize (ClientPtr client)
WindowPtr pWin; WindowPtr pWin;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
int i; int i, rc;
REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); REQUEST_SIZE_MATCH(xRRSetScreenSizeReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
return rc;
if (!pWin)
return BadWindow;
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
@ -336,19 +333,16 @@ ProcRRGetScreenResources (ClientPtr client)
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
CARD8 *extra; CARD8 *extra;
unsigned long extraLen; unsigned long extraLen;
int i; int i, n, rc;
RRCrtc *crtcs; RRCrtc *crtcs;
RROutput *outputs; RROutput *outputs;
xRRModeInfo *modeinfos; xRRModeInfo *modeinfos;
CARD8 *names; CARD8 *names;
int n;
REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
return rc;
if (!pWin)
return BadWindow;
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);
@ -580,7 +574,7 @@ ProcRRGetScreenInfo (ClientPtr client)
REQUEST(xRRGetScreenInfoReq); REQUEST(xRRGetScreenInfoReq);
xRRGetScreenInfoReply rep; xRRGetScreenInfoReply rep;
WindowPtr pWin; WindowPtr pWin;
int n; int n, rc;
ScreenPtr pScreen; ScreenPtr pScreen;
rrScrPrivPtr pScrPriv; rrScrPrivPtr pScrPriv;
CARD8 *extra; CARD8 *extra;
@ -588,11 +582,9 @@ ProcRRGetScreenInfo (ClientPtr client)
RROutputPtr output; RROutputPtr output;
REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); REQUEST_SIZE_MATCH(xRRGetScreenInfoReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
return rc;
if (!pWin)
return BadWindow;
pScreen = pWin->drawable.pScreen; pScreen = pWin->drawable.pScreen;
pScrPriv = rrGetScrPriv(pScreen); pScrPriv = rrGetScrPriv(pScreen);

View File

@ -239,12 +239,12 @@ ProcXFixesSelectCursorInput (ClientPtr client)
{ {
REQUEST (xXFixesSelectCursorInputReq); REQUEST (xXFixesSelectCursorInputReq);
WindowPtr pWin; WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (stuff->eventMask & ~CursorAllEvents) if (stuff->eventMask & ~CursorAllEvents)
{ {
client->errorValue = stuff->eventMask; client->errorValue = stuff->eventMask;

View File

@ -37,10 +37,9 @@ ProcXFixesChangeSaveSet(ClientPtr client)
REQUEST(xXFixesChangeSaveSetReq); REQUEST(xXFixesChangeSaveSetReq);
REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (result != Success)
if (!pWin) return result;
return(BadWindow);
if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id)))
return BadMatch; return BadMatch;
if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete))

View File

@ -193,12 +193,12 @@ ProcXFixesSelectSelectionInput (ClientPtr client)
{ {
REQUEST (xXFixesSelectSelectionInputReq); REQUEST (xXFixesSelectSelectionInputReq);
WindowPtr pWin; WindowPtr pWin;
int rc;
REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq);
pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess);
DixReadAccess); if (rc != Success)
if (!pWin) return rc;
return(BadWindow);
if (stuff->eventMask & ~SelectionAllEvents) if (stuff->eventMask & ~SelectionAllEvents)
{ {
client->errorValue = stuff->eventMask; client->errorValue = stuff->eventMask;