diff options
-rw-r--r-- | Xext/panoramiXprocs.c | 18 | ||||
-rw-r--r-- | Xext/shape.c | 14 | ||||
-rw-r--r-- | Xext/xprint.c | 7 | ||||
-rw-r--r-- | dbe/dbe.c | 16 | ||||
-rw-r--r-- | dix/devices.c | 8 | ||||
-rw-r--r-- | dix/dispatch.c | 214 | ||||
-rw-r--r-- | dix/events.c | 117 | ||||
-rw-r--r-- | dix/property.c | 45 | ||||
-rw-r--r-- | hw/darwin/quartz/applewm.c | 12 | ||||
-rw-r--r-- | hw/dmx/dmx.c | 14 | ||||
-rw-r--r-- | hw/dmx/glxProxy/glxcmds.c | 23 | ||||
-rwxr-xr-x | hw/xwin/winclipboardwrappers.c | 8 | ||||
-rwxr-xr-x | hw/xwin/winwindowswm.c | 19 | ||||
-rw-r--r-- | randr/rrdispatch.c | 7 | ||||
-rw-r--r-- | randr/rrscreen.c | 40 | ||||
-rwxr-xr-x | xfixes/cursor.c | 8 | ||||
-rwxr-xr-x | xfixes/saveset.c | 7 | ||||
-rwxr-xr-x | xfixes/select.c | 8 |
18 files changed, 273 insertions, 312 deletions
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index a193c4188..1c53a1e1a 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -577,19 +577,17 @@ int PanoramiXTranslateCoords(ClientPtr client) { INT16 x, y; REQUEST(xTranslateCoordsReq); - - register WindowPtr pWin, pDst; + int rc; + WindowPtr pWin, pDst; xTranslateCoordsReply rep; REQUEST_SIZE_MATCH(xTranslateCoordsReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - DixReadAccess); - if (!pWin) - return(BadWindow); - pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - DixReadAccess); - if (!pDst) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; diff --git a/Xext/shape.c b/Xext/shape.c index 58e3a69b3..928eeee31 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -419,12 +419,13 @@ ProcShapeMask (client) RegionPtr *destRgn; PixmapPtr pPixmap; CreateDftPtr createDefault; + int rc; REQUEST_SIZE_MATCH (xShapeMaskReq); UpdateCurrentTime(); - pWin = SecurityLookupWindow (stuff->dest, client, DixWriteAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->dest, client, DixWriteAccess); + if (rc != Success) + return rc; switch (stuff->destKind) { case ShapeBounding: createDefault = CreateBoundingShape; @@ -822,11 +823,12 @@ ProcShapeSelectInput (client) WindowPtr pWin; ShapeEventPtr pShapeEvent, pNewShapeEvent, *pHead; XID clientResource; + int rc; REQUEST_SIZE_MATCH (xShapeSelectInputReq); - pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, EventType, DixWriteAccess); switch (stuff->enable) { diff --git a/Xext/xprint.c b/Xext/xprint.c index 669ad277d..d8fc51713 100644 --- a/Xext/xprint.c +++ b/Xext/xprint.c @@ -1852,9 +1852,10 @@ ProcXpStartPage(ClientPtr client) if(pContext->state & PAGE_STARTED) return XpErrorBase+XPBadSequence; - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin || pWin->drawable.pScreen->myNum != pContext->screenNum) + result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (result != Success) + return result; + if (pWin->drawable.pScreen->myNum != pContext->screenNum) return BadWindow; if((c = (XpStPagePtr)xalloc(sizeof(XpStPageRec))) == (XpStPagePtr)NULL) @@ -405,11 +405,9 @@ ProcDbeAllocateBackBufferName(ClientPtr client) REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq); /* The window must be valid. */ - if (!(pWin = SecurityLookupWindow(stuff->window, client, - DixWriteAccess))) - { - return(BadWindow); - } + status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (status != Success) + return status; /* The window must be InputOutput. */ if (pWin->drawable.class != InputOutput) @@ -729,11 +727,11 @@ ProcDbeSwapBuffers(ClientPtr client) /* Check all windows to swap. */ /* Each window must be a valid window - BadWindow. */ - if (!(pWin = SecurityLookupWindow(dbeSwapInfo[i].window, client, - DixWriteAccess))) - { + error = dixLookupWindow(&pWin, dbeSwapInfo[i].window, client, + DixWriteAccess); + if (error != Success) { DEALLOCATE_LOCAL(swapInfo); - return(BadWindow); + return error; } /* Each window must be double-buffered - BadMatch. */ diff --git a/dix/devices.c b/dix/devices.c index e6a504954..9f4218414 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1840,16 +1840,16 @@ ProcGetMotionEvents(ClientPtr client) WindowPtr pWin; xTimecoord * coords = (xTimecoord *) NULL; xGetMotionEventsReply rep; - int i, count, xmin, xmax, ymin, ymax; + int i, count, xmin, xmax, ymin, ymax, rc; unsigned long nEvents; DeviceIntPtr mouse = inputInfo.pointer; TimeStamp start, stop; REQUEST(xGetMotionEventsReq); REQUEST_SIZE_MATCH(xGetMotionEventsReq); - pWin = SecurityLookupWindow(stuff->window, client, TRUE); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + if (rc != Success) + return rc; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; diff --git a/dix/dispatch.c b/dix/dispatch.c index 0421886a0..3060a4c39 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -554,17 +554,16 @@ ProcBadRequest(ClientPtr client) int ProcCreateWindow(ClientPtr client) { - register WindowPtr pParent, pWin; + WindowPtr pParent, pWin; REQUEST(xCreateWindowReq); - int result; - int len; + int result, len, rc; REQUEST_AT_LEAST_SIZE(xCreateWindowReq); LEGAL_NEW_RESOURCE(stuff->wid, client); - if (!(pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - DixWriteAccess))) - return BadWindow; + rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xCreateWindowReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; @@ -597,16 +596,15 @@ ProcCreateWindow(ClientPtr client) int ProcChangeWindowAttributes(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xChangeWindowAttributesReq); register int result; - int len; + int len, rc; REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xChangeWindowAttributesReq) >> 2); if (len != Ones(stuff->valueMask)) return BadLength; @@ -623,15 +621,15 @@ ProcChangeWindowAttributes(register ClientPtr client) int ProcGetWindowAttributes(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); xGetWindowAttributesReply wa; + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; GetWindowAttributes(pWin, client, &wa); WriteReplyToClient(client, sizeof(xGetWindowAttributesReply), &wa); return(client->noClientException); @@ -640,14 +638,14 @@ ProcGetWindowAttributes(register ClientPtr client) int ProcDestroyWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixDestroyAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; if (pWin->parent) FreeResource(stuff->id, RT_NONE); return(client->noClientException); @@ -656,14 +654,14 @@ ProcDestroyWindow(register ClientPtr client) int ProcDestroySubwindows(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixDestroyAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixDestroyAccess); + if (rc != Success) + return rc; DestroySubwindows(pWin, client); return(client->noClientException); } @@ -671,15 +669,14 @@ ProcDestroySubwindows(register ClientPtr client) int ProcChangeSaveSet(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xChangeSaveSetReq); - register int result; + register int result, rc; REQUEST_SIZE_MATCH(xChangeSaveSetReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode == SetModeInsert) || (stuff->mode == SetModeDelete)) @@ -700,19 +697,17 @@ ProcChangeSaveSet(register ClientPtr client) int ProcReparentWindow(register ClientPtr client) { - register WindowPtr pWin, pParent; + WindowPtr pWin, pParent; REQUEST(xReparentWindowReq); - register int result; + register int result, rc; REQUEST_SIZE_MATCH(xReparentWindowReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); - pParent = (WindowPtr)SecurityLookupWindow(stuff->parent, client, - DixWriteAccess); - if (!pParent) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pParent, stuff->parent, client, DixWriteAccess); + if (rc != Success) + return rc; if (SAME_SCREENS(pWin->drawable, pParent->drawable)) { if ((pWin->backgroundState == ParentRelative) && @@ -735,14 +730,14 @@ ProcReparentWindow(register ClientPtr client) int ProcMapWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; MapWindow(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); @@ -751,14 +746,14 @@ ProcMapWindow(register ClientPtr client) int ProcMapSubwindows(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; MapSubwindows(pWin, client); /* update cache to say it is mapped */ return(client->noClientException); @@ -767,14 +762,14 @@ ProcMapSubwindows(register ClientPtr client) int ProcUnmapWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; UnmapWindow(pWin, FALSE); /* update cache to say it is mapped */ return(client->noClientException); @@ -783,14 +778,14 @@ ProcUnmapWindow(register ClientPtr client) int ProcUnmapSubwindows(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xResourceReq); + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; UnmapSubwindows(pWin); return(client->noClientException); } @@ -798,16 +793,15 @@ ProcUnmapSubwindows(register ClientPtr client) int ProcConfigureWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xConfigureWindowReq); register int result; - int len; + int len, rc; REQUEST_AT_LEAST_SIZE(xConfigureWindowReq); - pWin = (WindowPtr)SecurityLookupWindow( stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; len = client->req_len - (sizeof(xConfigureWindowReq) >> 2); if (Ones((Mask)stuff->mask) != len) return BadLength; @@ -822,8 +816,9 @@ ProcConfigureWindow(register ClientPtr client) int ProcCirculateWindow(register ClientPtr client) { - register WindowPtr pWin; + WindowPtr pWin; REQUEST(xCirculateWindowReq); + int rc; REQUEST_SIZE_MATCH(xCirculateWindowReq); if ((stuff->direction != RaiseLowest) && @@ -832,10 +827,9 @@ ProcCirculateWindow(register ClientPtr client) client->errorValue = stuff->direction; return BadValue; } - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; CirculateWindow(pWin, (int)stuff->direction, client); return(client->noClientException); } @@ -903,16 +897,15 @@ int ProcQueryTree(register ClientPtr client) { xQueryTreeReply reply; - int numChildren = 0; - register WindowPtr pChild, pWin, pHead; + int rc, numChildren = 0; + WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; reply.type = X_Reply; reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id; reply.sequenceNumber = client->sequence; @@ -1025,10 +1018,9 @@ ProcSetSelectionOwner(register ClientPtr client) return Success; if (stuff->window != None) { - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + int rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; } else pWin = (WindowPtr)None; @@ -1142,12 +1134,12 @@ ProcConvertSelection(register ClientPtr client) xEvent event; WindowPtr pWin; REQUEST(xConvertSelectionReq); + int rc; REQUEST_SIZE_MATCH(xConvertSelectionReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->requestor, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->requestor, client, DixReadAccess); + if (rc != Success) + return rc; paramsOkay = (ValidAtom(stuff->selection) && ValidAtom(stuff->target)); if (stuff->property != None) @@ -1262,18 +1254,17 @@ ProcTranslateCoords(register ClientPtr client) { REQUEST(xTranslateCoordsReq); - register WindowPtr pWin, pDst; + WindowPtr pWin, pDst; xTranslateCoordsReply rep; + int rc; REQUEST_SIZE_MATCH(xTranslateCoordsReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, - DixReadAccess); - if (!pWin) - return(BadWindow); - pDst = (WindowPtr)SecurityLookupWindow(stuff->dstWid, client, - DixReadAccess); - if (!pDst) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->srcWid, client, DixReadAccess); + if (rc != Success) + return rc; + rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1762,13 +1753,13 @@ int ProcClearToBackground(register ClientPtr client) { REQUEST(xClearAreaReq); - register WindowPtr pWin; + WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH(xClearAreaReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; if (pWin->drawable.class == InputOnly) { client->errorValue = stuff->window; @@ -2496,7 +2487,7 @@ ProcCreateColormap(register ClientPtr client) VisualPtr pVisual; ColormapPtr pmap; Colormap mid; - register WindowPtr pWin; + WindowPtr pWin; ScreenPtr pScreen; REQUEST(xCreateColormapReq); int i, result; @@ -2510,10 +2501,9 @@ ProcCreateColormap(register ClientPtr client) } mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (result != Success) + return result; pScreen = pWin->drawable.pScreen; for (i = 0, pVisual = pScreen->visuals; @@ -2631,16 +2621,14 @@ int ProcListInstalledColormaps(register ClientPtr client) { xListInstalledColormapsReply *preply; - int nummaps; + int nummaps, rc; WindowPtr pWin; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; preply = (xListInstalledColormapsReply *) ALLOCATE_LOCAL(sizeof(xListInstalledColormapsReply) + diff --git a/dix/events.c b/dix/events.c index c7cf73e46..0053f42d4 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2228,16 +2228,15 @@ static int XineramaWarpPointer(ClientPtr client) { WindowPtr dest = NULL; - int x, y; + int x, y, rc; REQUEST(xWarpPointerReq); - if (stuff->dstWid != None) - { - dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); - if (!dest) - return BadWindow; + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; @@ -2248,8 +2247,9 @@ XineramaWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, DixReadAccess); - if (!source) return BadWindow; + rc = dixLookupWindow(&source, winID, client, DixReadAccess); + if (rc != Success) + return rc; winX = source->drawable.x; winY = source->drawable.y; @@ -2301,7 +2301,7 @@ int ProcWarpPointer(ClientPtr client) { WindowPtr dest = NULL; - int x, y; + int x, y, rc; ScreenPtr newScreen; REQUEST(xWarpPointerReq); @@ -2313,11 +2313,10 @@ ProcWarpPointer(ClientPtr client) return XineramaWarpPointer(client); #endif - if (stuff->dstWid != None) - { - dest = SecurityLookupWindow(stuff->dstWid, client, DixReadAccess); - if (!dest) - return BadWindow; + if (stuff->dstWid != None) { + rc = dixLookupWindow(&dest, stuff->dstWid, client, DixReadAccess); + if (rc != Success) + return rc; } x = sprite.hotPhys.x; y = sprite.hotPhys.y; @@ -2328,8 +2327,9 @@ ProcWarpPointer(ClientPtr client) XID winID = stuff->srcWid; WindowPtr source; - source = SecurityLookupWindow(winID, client, DixReadAccess); - if (!source) return BadWindow; + rc = dixLookupWindow(&source, winID, client, DixReadAccess); + if (rc != Success) + return rc; winX = source->drawable.x; winY = source->drawable.y; @@ -3532,8 +3532,8 @@ SetInputFocus( Bool followOK) { register FocusClassPtr focus; - register WindowPtr focusWin; - int mode; + WindowPtr focusWin; + int mode, rc; TimeStamp time; UpdateCurrentTime(); @@ -3550,14 +3550,12 @@ SetInputFocus( focusWin = (WindowPtr)(long)focusID; else if ((focusID == FollowKeyboard) && followOK) focusWin = inputInfo.keyboard->focus->win; - else if (!(focusWin = SecurityLookupWindow(focusID, client, - DixReadAccess))) - return BadWindow; - else - { + else { + rc = dixLookupWindow(&focusWin, focusID, client, DixReadAccess); + if (rc != Success) + return rc; /* It is a match error to try to set the input focus to an unviewable window. */ - if(!focusWin->realized) return(BadMatch); } @@ -3646,6 +3644,7 @@ ProcGrabPointer(ClientPtr client) CursorPtr cursor, oldCursor; REQUEST(xGrabPointerReq); TimeStamp time; + int rc; REQUEST_SIZE_MATCH(xGrabPointerReq); UpdateCurrentTime(); @@ -3671,17 +3670,17 @@ ProcGrabPointer(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { - confineTo = SecurityLookupWindow(stuff->confineTo, client, - DixReadAccess); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixReadAccess); + if (rc != Success) + return rc; } if (stuff->cursor == None) cursor = NullCursor; @@ -3812,9 +3811,10 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, unsigned this_mode, unsigned other_mode, Window grabWindow, unsigned ownerEvents, Time ctime, Mask mask, CARD8 *status) { - register WindowPtr pWin; + WindowPtr pWin; register GrabPtr grab; TimeStamp time; + int rc; UpdateCurrentTime(); if ((this_mode != GrabModeSync) && (this_mode != GrabModeAsync)) @@ -3832,9 +3832,9 @@ GrabDevice(register ClientPtr client, register DeviceIntPtr dev, client->errorValue = ownerEvents; return BadValue; } - pWin = SecurityLookupWindow(grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; time = ClientTimeToServerTime(ctime); grab = dev->grab; if (grab && !SameClient(grab, client)) @@ -3918,11 +3918,12 @@ ProcQueryPointer(ClientPtr client) WindowPtr pWin, t; REQUEST(xResourceReq); DeviceIntPtr mouse = inputInfo.pointer; + int rc; REQUEST_SIZE_MATCH(xResourceReq); - pWin = SecurityLookupWindow(stuff->id, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; if (mouse->valuator->motionHintWindow) MaybeStopHint(mouse, client); rep.type = X_Reply; @@ -4086,8 +4087,8 @@ ProcSendEvent(ClientPtr client) effectiveFocus = pWin = inputFocus; } else - pWin = SecurityLookupWindow(stuff->destination, client, - DixReadAccess); + dixLookupWindow(&pWin, stuff->destination, client, DixReadAccess); + if (!pWin) return BadWindow; if ((stuff->propagate != xFalse) && (stuff->propagate != xTrue)) @@ -4123,11 +4124,12 @@ ProcUngrabKey(ClientPtr client) WindowPtr pWin; GrabRec tempGrab; DeviceIntPtr keybd = inputInfo.keyboard; + int rc; REQUEST_SIZE_MATCH(xUngrabKeyReq); - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (((stuff->key > keybd->key->curKeySyms.maxKeyCode) || (stuff->key < keybd->key->curKeySyms.minKeyCode)) @@ -4164,6 +4166,7 @@ ProcGrabKey(ClientPtr client) REQUEST(xGrabKeyReq); GrabPtr grab; DeviceIntPtr keybd = inputInfo.keyboard; + int rc; REQUEST_SIZE_MATCH(xGrabKeyReq); if ((stuff->ownerEvents != xTrue) && (stuff->ownerEvents != xFalse)) @@ -4196,9 +4199,9 @@ ProcGrabKey(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; grab = CreateGrab(client->index, keybd, pWin, (Mask)(KeyPressMask | KeyReleaseMask), (Bool)stuff->ownerEvents, @@ -4218,6 +4221,7 @@ ProcGrabButton(ClientPtr client) REQUEST(xGrabButtonReq); CursorPtr cursor; GrabPtr grab; + int rc; REQUEST_SIZE_MATCH(xGrabButtonReq); if ((stuff->pointerMode != GrabModeSync) && @@ -4248,16 +4252,16 @@ ProcGrabButton(ClientPtr client) client->errorValue = stuff->eventMask; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->confineTo == None) confineTo = NullWindow; else { - confineTo = SecurityLookupWindow(stuff->confineTo, client, - DixReadAccess); - if (!confineTo) - return BadWindow; + rc = dixLookupWindow(&confineTo, stuff->confineTo, client, + DixReadAccess); + if (rc != Success) + return rc; } if (stuff->cursor == None) cursor = NullCursor; @@ -4289,6 +4293,7 @@ ProcUngrabButton(ClientPtr client) REQUEST(xUngrabButtonReq); WindowPtr pWin; GrabRec tempGrab; + int rc; REQUEST_SIZE_MATCH(xUngrabButtonReq); if ((stuff->modifiers != AnyModifier) && @@ -4297,9 +4302,9 @@ ProcUngrabButton(ClientPtr client) client->errorValue = stuff->modifiers; return BadValue; } - pWin = SecurityLookupWindow(stuff->grabWindow, client, DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixReadAccess); + if (rc != Success) + return rc; tempGrab.resource = client->clientAsMask; tempGrab.device = inputInfo.pointer; tempGrab.window = pWin; diff --git a/dix/property.c b/dix/property.c index 5c1e957a5..d40284901 100644 --- a/dix/property.c +++ b/dix/property.c @@ -94,7 +94,7 @@ PrintPropertys(WindowPtr pWin) int ProcRotateProperties(ClientPtr client) { - int i, j, delta; + int i, j, delta, rc; REQUEST(xRotatePropertiesReq); WindowPtr pWin; register Atom * atoms; @@ -104,10 +104,9 @@ ProcRotateProperties(ClientPtr client) REQUEST_FIXED_SIZE(xRotatePropertiesReq, stuff->nAtoms << 2); UpdateCurrentTime(); - pWin = (WindowPtr) SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; if (!stuff->nAtoms) return(Success); atoms = (Atom *) & stuff[1]; @@ -181,9 +180,7 @@ ProcChangeProperty(ClientPtr client) WindowPtr pWin; char format, mode; unsigned long len; - int sizeInBytes; - int totalSize; - int err; + int sizeInBytes, totalSize, err; REQUEST(xChangePropertyReq); REQUEST_AT_LEAST_SIZE(xChangePropertyReq); @@ -208,10 +205,9 @@ ProcChangeProperty(ClientPtr client) totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xChangePropertyReq, totalSize); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + err = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (err != Success) + return err; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; @@ -445,7 +441,7 @@ int ProcGetProperty(ClientPtr client) { PropertyPtr pProp, prevProp; - unsigned long n, len, ind; + unsigned long n, len, ind, rc; WindowPtr pWin; xGetPropertyReply reply; Mask access_mode = DixReadAccess; @@ -454,10 +450,9 @@ ProcGetProperty(ClientPtr client) REQUEST_SIZE_MATCH(xGetPropertyReq); if (stuff->delete) UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (!ValidAtom(stuff->property)) { @@ -585,16 +580,15 @@ ProcListProperties(ClientPtr client) { Atom *pAtoms = NULL, *temppAtoms; xListPropertiesReply xlpr; - int numProps = 0; + int rc, numProps = 0; WindowPtr pWin; PropertyPtr pProp; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->id, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->id, client, DixReadAccess); + if (rc != Success) + return rc; pProp = wUserProps (pWin); while (pProp) @@ -636,10 +630,9 @@ ProcDeleteProperty(register ClientPtr client) REQUEST_SIZE_MATCH(xDeletePropertyReq); UpdateCurrentTime(); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixWriteAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (result != Success) + return result; if (!ValidAtom(stuff->property)) { client->errorValue = stuff->property; diff --git a/hw/darwin/quartz/applewm.c b/hw/darwin/quartz/applewm.c index a9d8b5659..224d6c5e0 100644 --- a/hw/darwin/quartz/applewm.c +++ b/hw/darwin/quartz/applewm.c @@ -490,11 +490,9 @@ ProcAppleWMSetWindowLevel( REQUEST_SIZE_MATCH(xAppleWMSetWindowLevelReq); - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { + if (Success != dixLookupWindow(&pWin, stuff->window, client, + DixReadAccess)) return BadValue; - } if (stuff->level < 0 || stuff->level >= AppleWMNumWindowLevels) { return BadValue; @@ -602,11 +600,9 @@ ProcAppleWMFrameDraw( REQUEST_AT_LEAST_SIZE(xAppleWMFrameDrawReq); - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { + if (Success != dixLookupWindow(&pWin, stuff->window, client, + DixReadAccess)) return BadValue; - } ir = make_box (stuff->ix, stuff->iy, stuff->iw, stuff->ih); or = make_box (stuff->ox, stuff->oy, stuff->ow, stuff->oh); diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c index 02e8b1e7c..b7c81ee57 100644 --- a/hw/dmx/dmx.c +++ b/hw/dmx/dmx.c @@ -286,8 +286,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client) return -1; /* BadWindow */ FOR_NSCREENS(i) { - if (!(pWin = SecurityLookupWindow(win->info[i].id, client, - DixReadAccess))) + if (Success != dixLookupWindow(&pWin, win->info[i].id, client, + DixReadAccess)) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); @@ -296,8 +296,8 @@ static int ProcDMXForceWindowCreation(ClientPtr client) } #endif - if (!(pWin = SecurityLookupWindow(stuff->window, client, - DixReadAccess))) + if (Success != dixLookupWindow(&pWin, stuff->window, client, + DixReadAccess)) return -1; /* BadWindow */ dmxForceWindowCreation(pWin); @@ -560,8 +560,8 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window, return -1; /* BadWindow */ FOR_NSCREENS(i) { - if (!(pWin = SecurityLookupWindow(win->info[i].id, client, - DixReadAccess))) + if (Success != dixLookupWindow(&pWin, win->info[i].id, client, + DixReadAccess)) return -1; /* BadWindow */ if (dmxGetWindowAttributes(pWin, &attr)) { screens[count] = attr.screen; @@ -587,7 +587,7 @@ static int dmxPopulate(ClientPtr client, Window window, CARD32 *screens, pos, vis); #endif - if (!(pWin = SecurityLookupWindow(window, client, DixReadAccess))) + if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess)) return -1; /* BadWindow */ dmxGetWindowAttributes(pWin, &attr); diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index 20a02a173..aa9d8318c 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -1137,9 +1137,7 @@ static int MakeCurrent(__GLXclientState *cl, } #ifdef PANORAMIX else if (pXinDraw) { - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); } #endif else if (pGlxWindow) { @@ -1195,9 +1193,8 @@ static int MakeCurrent(__GLXclientState *cl, } #ifdef PANORAMIX else if (pXinReadDraw) { - pReadWin = (WindowPtr)SecurityLookupWindow(pXinReadDraw->info[s].id, - client, - DixReadAccess); + dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client, + DixReadAccess); } #endif else if (pGlxReadWindow) { @@ -2058,9 +2055,7 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) } #ifdef PANORAMIX else if (pXinDraw) { - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[s].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); } #endif else if (pGlxWindow) { @@ -3359,9 +3354,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) return __glXBadDrawable; } - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, + DixReadAccess); } #endif @@ -3521,9 +3515,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) return __glXBadDrawable; } - pWin = (WindowPtr)SecurityLookupWindow(pXinDraw->info[screen].id, - client, - DixReadAccess); + dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, + DixReadAccess); } #endif diff --git a/hw/xwin/winclipboardwrappers.c b/hw/xwin/winclipboardwrappers.c index e9bcea9a8..825d3dc70 100755 --- a/hw/xwin/winclipboardwrappers.c +++ b/hw/xwin/winclipboardwrappers.c @@ -344,13 +344,11 @@ winProcSetSelectionOwner (ClientPtr client) if (None != stuff->window) { /* Grab the Window from the request */ - pWindow = (WindowPtr) SecurityLookupWindow (stuff->window, client, - DixReadAccess); - if (!pWindow) - { + int rc = dixLookupWindow(&pWindow, stuff->window, client, DixReadAccess); + if (rc != Success) { ErrorF ("winProcSetSelectionOwner - Found BadWindow, aborting.\n"); goto winProcSetSelectionOwner_Done; - } + } } /* Now we either have a valid window or None */ diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index ac92e26df..e1994de84 100755 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -441,7 +441,7 @@ ProcWindowsWMFrameDraw (register ClientPtr client) WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; RECT rcNew; - int nCmdShow; + int nCmdShow, rc; RegionRec newShape; ScreenPtr pScreen; @@ -450,11 +450,9 @@ ProcWindowsWMFrameDraw (register ClientPtr client) #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameDraw\n"); #endif - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { - return BadValue; - } + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameDraw - Window found\n"); #endif @@ -538,6 +536,7 @@ ProcWindowsWMFrameSetTitle( REQUEST(xWindowsWMFrameSetTitleReq); WindowPtr pWin; win32RootlessWindowPtr pRLWinPriv; + int rc; #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameSetTitle\n"); @@ -545,11 +544,9 @@ ProcWindowsWMFrameSetTitle( REQUEST_AT_LEAST_SIZE(xWindowsWMFrameSetTitleReq); - if (!(pWin = SecurityLookupWindow((Drawable)stuff->window, - client, DixReadAccess))) - { - return BadValue; - } + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; #if CYGMULTIWINDOW_DEBUG ErrorF ("ProcWindowsWMFrameSetTitle - Window found\n"); #endif diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index b1ec68b83..7f98965a4 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -70,11 +70,12 @@ ProcRRSelectInput (ClientPtr client) WindowPtr pWin; RREventPtr pRREvent, *pHead; XID clientResource; + int rc; REQUEST_SIZE_MATCH(xRRSelectInputReq); - pWin = SecurityLookupWindow (stuff->window, client, DixWriteAccess); - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); + if (rc != Success) + return rc; pHead = (RREventPtr *)SecurityLookupIDByType(client, pWin->drawable.id, RREventType, DixWriteAccess); diff --git a/randr/rrscreen.c b/randr/rrscreen.c index f1d8fc5d9..6f7afaf7a 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -217,13 +217,12 @@ ProcRRGetScreenSizeRange (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; + int rc; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -268,14 +267,12 @@ ProcRRSetScreenSize (ClientPtr client) WindowPtr pWin; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; - int i; + int i, rc; REQUEST_SIZE_MATCH(xRRSetScreenSizeReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -336,19 +333,16 @@ ProcRRGetScreenResources (ClientPtr client) rrScrPrivPtr pScrPriv; CARD8 *extra; unsigned long extraLen; - int i; + int i, n, rc; RRCrtc *crtcs; RROutput *outputs; xRRModeInfo *modeinfos; CARD8 *names; - int n; REQUEST_SIZE_MATCH(xRRGetScreenResourcesReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); @@ -580,7 +574,7 @@ ProcRRGetScreenInfo (ClientPtr client) REQUEST(xRRGetScreenInfoReq); xRRGetScreenInfoReply rep; WindowPtr pWin; - int n; + int n, rc; ScreenPtr pScreen; rrScrPrivPtr pScrPriv; CARD8 *extra; @@ -588,11 +582,9 @@ ProcRRGetScreenInfo (ClientPtr client) RROutputPtr output; REQUEST_SIZE_MATCH(xRRGetScreenInfoReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - - if (!pWin) - return BadWindow; + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; pScreen = pWin->drawable.pScreen; pScrPriv = rrGetScrPriv(pScreen); diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 21dbcc2cb..86a512c25 100755 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -239,12 +239,12 @@ ProcXFixesSelectCursorInput (ClientPtr client) { REQUEST (xXFixesSelectCursorInputReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xXFixesSelectCursorInputReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->eventMask & ~CursorAllEvents) { client->errorValue = stuff->eventMask; diff --git a/xfixes/saveset.c b/xfixes/saveset.c index 9ad2627c0..ab75619e8 100755 --- a/xfixes/saveset.c +++ b/xfixes/saveset.c @@ -37,10 +37,9 @@ ProcXFixesChangeSaveSet(ClientPtr client) REQUEST(xXFixesChangeSaveSetReq); REQUEST_SIZE_MATCH(xXFixesChangeSaveSetReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + result = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (result != Success) + return result; if (client->clientAsMask == (CLIENT_BITS(pWin->drawable.id))) return BadMatch; if ((stuff->mode != SetModeInsert) && (stuff->mode != SetModeDelete)) diff --git a/xfixes/select.c b/xfixes/select.c index a718715a1..d1c22c552 100755 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -193,12 +193,12 @@ ProcXFixesSelectSelectionInput (ClientPtr client) { REQUEST (xXFixesSelectSelectionInputReq); WindowPtr pWin; + int rc; REQUEST_SIZE_MATCH (xXFixesSelectSelectionInputReq); - pWin = (WindowPtr)SecurityLookupWindow(stuff->window, client, - DixReadAccess); - if (!pWin) - return(BadWindow); + rc = dixLookupWindow(&pWin, stuff->window, client, DixReadAccess); + if (rc != Success) + return rc; if (stuff->eventMask & ~SelectionAllEvents) { client->errorValue = stuff->eventMask; |