diff --git a/Xext/mbuf.c b/Xext/mbuf.c index 81b704f..94334c7 100644 --- a/Xext/mbuf.c +++ b/Xext/mbuf.c @@ -517,8 +517,8 @@ ProcDisplayImageBuffers (client) activateTime.milliseconds = 0; for (i = 0; i < nbuf; i++) { - pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], -MultibufferResType); + dixLookupResource((pointer) &pMultibuffer[i], ids[i], + MultibufferResType, NullClient, DixUnknownAccess); if (!pMultibuffer[i]) { xfree(ppMultibuffers); @@ -590,7 +590,8 @@ ProcSetMBufferAttributes (client) rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); if (rc != Success) return rc; - pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); + dixLookupResource((pointer) &pMultibuffers, pWin->drawable.id, + MultibuffersResType, NullClient, DixUnknownAccess); if (!pMultibuffers) return BadMatch; len = stuff->length - (sizeof (xMbufSetMBufferAttributesReq) >> 2); @@ -642,7 +643,8 @@ ProcGetMBufferAttributes (client) rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); if (rc != Success) return rc; - pMultibuffers = (MultibuffersPtr)LookupIDByType (pWin->drawable.id, MultibuffersResType); + dixLookupResource((pointer) &pMultibuffers, pWin->drawable.id, + MultibuffersResType, NullClient, DixUnknownAccess); if (!pMultibuffers) return BadAccess; ids = (XID *) xalloc (pMultibuffers->numMultibuffer * sizeof (XID)); @@ -685,7 +687,8 @@ ProcSetBufferAttributes (client) int result; REQUEST_AT_LEAST_SIZE (xMbufSetBufferAttributesReq); - pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType); + dixLookupResource((pointer) &pMultibuffer, stuff->buffer, + MultibuffersResType, NullClient, DixUnknownAccess); if (!pMultibuffer) return MultibufferErrorBase + MultibufferBadBuffer; len = stuff->length - (sizeof (xMbufSetBufferAttributesReq) >> 2); @@ -725,7 +728,8 @@ ProcGetBufferAttributes (client) int n; REQUEST_SIZE_MATCH (xMbufGetBufferAttributesReq); - pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType); + dixLookupResource((pointer) &pMultibuffer, stuff->buffer, + MultibuffersResType, NullClient, DixUnknownAccess); if (!pMultibuffer) return MultibufferErrorBase + MultibufferBadBuffer; rep.type = X_Reply; @@ -836,7 +840,8 @@ ProcClearImageBufferArea (client) ScreenPtr pScreen; REQUEST_SIZE_MATCH (xMbufClearImageBufferAreaReq); - pMultibuffer = (MultibufferPtr) LookupIDByType (stuff->buffer, MultibufferResType); + dixLookupResource((pointer) &pMultibuffer, stuff->buffer, + MultibuffersResType, NullClient, DixUnknownAccess); if (!pMultibuffer) return MultibufferErrorBase + MultibufferBadBuffer; if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) @@ -1243,7 +1248,8 @@ DisplayImageBuffers (ids, nbuf) pMultibuffers = (MultibuffersPtr *) (pMultibuffer + nbuf); for (i = 0; i < nbuf; i++) { - pMultibuffer[i] = (MultibufferPtr) LookupIDByType (ids[i], MultibufferResType); + dixLookupResource((pointer) &pMultibuffer[i], ids[i], + MultibuffersResType, NullClient, DixUnknownAccess); if (!pMultibuffer[i]) { xfree (pMultibuffer); diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 0439668..f946774 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -352,9 +352,12 @@ PanoramiXRes * PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen) { PanoramiXSearchData data; + pointer p; - if(!screen) - return LookupIDByType(id, type); + if(!screen) { + dixLookupResource((pointer) &p, id, type, NullClient, DixUnknownAccess); + return p; + } data.screen = screen; data.id = id; diff --git a/Xext/panoramiX.h b/Xext/panoramiX.h index 89c7547..1292429 100644 --- a/Xext/panoramiX.h +++ b/Xext/panoramiX.h @@ -95,6 +95,4 @@ typedef struct { #define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared) -#define SKIP_FAKE_WINDOW(a) if(!LookupIDByType(a, XRT_WINDOW)) return - #endif /* _PANORAMIX_H_ */ diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index 0f9096f..24afa6b 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -78,8 +78,8 @@ int PanoramiXCreateWindow(ClientPtr client) if (Ones(stuff->mask) != len) return BadLength; - if (!(parent = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->parent, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); + if (!parent) return BadWindow; if(stuff->class == CopyFromParent) @@ -92,8 +92,8 @@ int PanoramiXCreateWindow(ClientPtr client) pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { - if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &backPix, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!backPix) return BadPixmap; } } @@ -101,8 +101,8 @@ int PanoramiXCreateWindow(ClientPtr client) pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { - if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!bordPix) return BadPixmap; } } @@ -110,8 +110,8 @@ int PanoramiXCreateWindow(ClientPtr client) cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { - if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, DixReadAccess))) + dixLookupResource((pointer) &cmap, tmp, XRT_COLORMAP, client, DixReadAccess); + if(!cmap) return BadColor; } } @@ -179,8 +179,8 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) if (Ones(stuff->valueMask) != len) return BadLength; - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); + if (!win) return BadWindow; if((win->u.win.class == InputOnly) && @@ -191,8 +191,8 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) pback_offset = Ones((Mask)stuff->valueMask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { - if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &backPix, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!backPix) return BadPixmap; } } @@ -200,8 +200,8 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) pbord_offset = Ones((Mask)stuff->valueMask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { - if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!bordPix) return BadPixmap; } } @@ -209,8 +209,8 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) cmap_offset = Ones((Mask)stuff->valueMask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { - if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, DixReadAccess))) + dixLookupResource((pointer) &cmap, tmp, XRT_COLORMAP, client, DixReadAccess); + if(!cmap) return BadColor; } } @@ -238,8 +238,8 @@ int PanoramiXDestroyWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, DixDestroyAccess))) + dixLookupResource((pointer) &win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); + if(!win) return BadWindow; FOR_NSCREENS_BACKWARD(j) { @@ -263,8 +263,8 @@ int PanoramiXDestroySubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, DixDestroyAccess))) + dixLookupResource((pointer) &win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); + if(!win) return BadWindow; FOR_NSCREENS_BACKWARD(j) { @@ -288,8 +288,8 @@ int PanoramiXChangeSaveSet(ClientPtr client) REQUEST_SIZE_MATCH(xChangeSaveSetReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixReadAccess); + if(!win) return BadWindow; FOR_NSCREENS_BACKWARD(j) { @@ -312,12 +312,12 @@ int PanoramiXReparentWindow(ClientPtr client) REQUEST_SIZE_MATCH(xReparentWindowReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); + if(!win) return BadWindow; - if(!(parent = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->parent, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); + if(!parent) return BadWindow; x = stuff->x; @@ -347,8 +347,8 @@ int PanoramiXMapWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); + if(!win) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -369,8 +369,8 @@ int PanoramiXMapSubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); + if(!win) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -391,8 +391,8 @@ int PanoramiXUnmapWindow(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); + if(!win) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -413,8 +413,8 @@ int PanoramiXUnmapSubwindows(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->id, XRT_WINDOW, client, DixReadAccess); + if(!win) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -444,20 +444,20 @@ int PanoramiXConfigureWindow(ClientPtr client) return BadLength; /* because we need the parent */ - if (!(pWin = (WindowPtr)SecurityLookupIDByType( - client, stuff->window, RT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &pWin, stuff->window, RT_WINDOW, client, DixWriteAccess); + if (!pWin) return BadWindow; - if (!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); + if (!win) return BadWindow; if ((Mask)stuff->mask & CWSibling) { XID tmp; sib_offset = Ones((Mask)stuff->mask & (CWSibling - 1)); if ((tmp = *((CARD32 *) &stuff[1] + sib_offset))) { - if(!(sib = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &sib, tmp, XRT_WINDOW, client, DixReadAccess); + if(!sib) return BadWindow; } } @@ -501,8 +501,8 @@ int PanoramiXCirculateWindow(ClientPtr client) REQUEST_SIZE_MATCH(xCirculateWindowReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); + if(!win) return BadWindow; FOR_NSCREENS_FORWARD(j) { @@ -640,8 +640,8 @@ int PanoramiXCreatePixmap(ClientPtr client) REQUEST_SIZE_MATCH(xCreatePixmapReq); client->errorValue = stuff->pid; - if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) + dixLookupResource((pointer) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixReadAccess); + if(!refDraw) return BadDrawable; if(!(newPix = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) @@ -679,8 +679,8 @@ int PanoramiXFreePixmap(ClientPtr client) client->errorValue = stuff->id; - if(!(pix = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_PIXMAP, DixDestroyAccess))) + dixLookupResource((pointer) &pix, stuff->id, XRT_PIXMAP, client, DixDestroyAccess); + if(!pix) return BadPixmap; FOR_NSCREENS_BACKWARD(j) { @@ -715,31 +715,31 @@ int PanoramiXCreateGC(ClientPtr client) if (Ones(stuff->mask) != len) return BadLength; - if (!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixReadAccess))) + dixLookupResource((pointer) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixReadAccess); + if (!refDraw) return BadDrawable; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { - if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &tile, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!tile) return BadPixmap; } } if ((Mask)stuff->mask & GCStipple) { stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { - if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &stip, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!stip) return BadPixmap; } } if ((Mask)stuff->mask & GCClipMask) { clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { - if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &clip, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!clip) return BadPixmap; } } @@ -789,32 +789,31 @@ int PanoramiXChangeGC(ClientPtr client) len = client->req_len - (sizeof(xChangeGCReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; - - if (!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if (!gc) return BadGC; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); if ((tmp = *((CARD32 *) &stuff[1] + tile_offset))) { - if(!(tile = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &tile, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!tile) return BadPixmap; } } if ((Mask)stuff->mask & GCStipple) { stip_offset = Ones((Mask)stuff->mask & (GCStipple - 1)); if ((tmp = *((CARD32 *) &stuff[1] + stip_offset))) { - if(!(stip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &stip, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!stip) return BadPixmap; } } if ((Mask)stuff->mask & GCClipMask) { clip_offset = Ones((Mask)stuff->mask & (GCClipMask - 1)); if ((tmp = *((CARD32 *) &stuff[1] + clip_offset))) { - if(!(clip = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &clip, tmp, XRT_PIXMAP, client, DixReadAccess); + if(!clip) return BadPixmap; } } @@ -844,12 +843,12 @@ int PanoramiXCopyGC(ClientPtr client) REQUEST_SIZE_MATCH(xCopyGCReq); - if(!(srcGC = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->srcGC, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &srcGC, stuff->srcGC, XRT_GC, client, DixReadAccess); + if(!srcGC) return BadGC; - if(!(dstGC = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dstGC, XRT_GC, DixWriteAccess))) + dixLookupResource((pointer) &dstGC, stuff->dstGC, XRT_GC, client, DixWriteAccess); + if(!dstGC) return BadGC; FOR_NSCREENS(j) { @@ -871,8 +870,8 @@ int PanoramiXSetDashes(ClientPtr client) REQUEST_FIXED_SIZE(xSetDashesReq, stuff->nDashes); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixWriteAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixWriteAccess); + if(!gc) return BadGC; FOR_NSCREENS_BACKWARD(j) { @@ -893,8 +892,8 @@ int PanoramiXSetClipRectangles(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixWriteAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixWriteAccess); + if(!gc) return BadGC; FOR_NSCREENS_BACKWARD(j) { @@ -915,8 +914,8 @@ int PanoramiXFreeGC(ClientPtr client) REQUEST_SIZE_MATCH(xResourceReq); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_GC, DixDestroyAccess))) + dixLookupResource((pointer) &gc, stuff->id, XRT_GC, client, DixDestroyAccess); + if(!gc) return BadGC; FOR_NSCREENS_BACKWARD(j) { @@ -941,8 +940,8 @@ int PanoramiXClearToBackground(ClientPtr client) REQUEST_SIZE_MATCH(xClearAreaReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixWriteAccess); + if(!win) return BadWindow; x = stuff->x; @@ -983,14 +982,14 @@ int PanoramiXCopyArea(ClientPtr client) REQUEST_SIZE_MATCH(xCopyAreaReq); - if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess))) + dixLookupResource((pointer) &src, stuff->srcDrawable, XRC_DRAWABLE, client, DixReadAccess); + if(!src) return BadDrawable; srcShared = IS_SHARED_PIXMAP(src); - if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &dst, stuff->dstDrawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!dst) return BadDrawable; dstShared = IS_SHARED_PIXMAP(dst); @@ -998,8 +997,8 @@ int PanoramiXCopyArea(ClientPtr client) if(dstShared && srcShared) return (* SavedProcVector[X_CopyArea])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; if((dst->type == XRT_WINDOW) && dst->u.win.root) @@ -1139,14 +1138,14 @@ int PanoramiXCopyPlane(ClientPtr client) REQUEST_SIZE_MATCH(xCopyPlaneReq); - if(!(src = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->srcDrawable, XRC_DRAWABLE, DixReadAccess))) + dixLookupResource((pointer) &src, stuff->srcDrawable, XRC_DRAWABLE, client, DixReadAccess); + if(!src) return BadDrawable; srcShared = IS_SHARED_PIXMAP(src); - if(!(dst = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->dstDrawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &dst, stuff->dstDrawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!dst) return BadDrawable; dstShared = IS_SHARED_PIXMAP(dst); @@ -1154,8 +1153,8 @@ int PanoramiXCopyPlane(ClientPtr client) if(dstShared && srcShared) return (* SavedProcVector[X_CopyPlane])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; if((dst->type == XRT_WINDOW) && dst->u.win.root) @@ -1242,15 +1241,15 @@ int PanoramiXPolyPoint(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyPointReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyPoint])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1300,15 +1299,15 @@ int PanoramiXPolyLine(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyLineReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyLine])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1358,15 +1357,15 @@ int PanoramiXPolySegment(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolySegmentReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolySegment])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1420,15 +1419,15 @@ int PanoramiXPolyRectangle(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyRectangleReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyRectangle])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1480,15 +1479,15 @@ int PanoramiXPolyArc(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyArcReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyArc])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1538,15 +1537,15 @@ int PanoramiXFillPoly(ClientPtr client) REQUEST_AT_LEAST_SIZE(xFillPolyReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_FillPoly])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1597,15 +1596,15 @@ int PanoramiXPolyFillRectangle(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillRectangle])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1656,15 +1655,15 @@ int PanoramiXPolyFillArc(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyFillArcReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyFillArc])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1714,15 +1713,15 @@ int PanoramiXPutImage(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPutImageReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PutImage])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1765,8 +1764,8 @@ int PanoramiXGetImage(ClientPtr client) return(BadValue); } - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(draw->type == XRT_PIXMAP) @@ -1912,15 +1911,15 @@ PanoramiXPolyText8(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyTextReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText8])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1951,15 +1950,15 @@ PanoramiXPolyText16(ClientPtr client) REQUEST_AT_LEAST_SIZE(xPolyTextReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_PolyText16])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1990,15 +1989,15 @@ int PanoramiXImageText8(ClientPtr client) REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText8])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2029,15 +2028,15 @@ int PanoramiXImageText16(ClientPtr client) REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if(IS_SHARED_PIXMAP(draw)) return (*SavedProcVector[X_ImageText16])(client); - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2067,8 +2066,8 @@ int PanoramiXCreateColormap(ClientPtr client) REQUEST_SIZE_MATCH(xCreateColormapReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->window, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, client, DixReadAccess); + if(!win) return BadWindow; if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) @@ -2107,8 +2106,8 @@ int PanoramiXFreeColormap(ClientPtr client) client->errorValue = stuff->id; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, DixDestroyAccess))) + dixLookupResource((pointer) &cmap, stuff->id, XRT_COLORMAP, client, DixDestroyAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j) { @@ -2135,9 +2134,8 @@ PanoramiXCopyColormapAndFree(ClientPtr client) client->errorValue = stuff->srcCmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->srcCmap, XRT_COLORMAP, - DixReadAccess | DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->srcCmap, XRT_COLORMAP, client, DixReadAccess | DixWriteAccess); + if(!cmap) return BadColor; if(!(newCmap = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) @@ -2174,8 +2172,8 @@ int PanoramiXInstallColormap(ClientPtr client) client->errorValue = stuff->id; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, DixReadAccess))) + dixLookupResource((pointer) &cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2197,8 +2195,8 @@ int PanoramiXUninstallColormap(ClientPtr client) client->errorValue = stuff->id; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->id, XRT_COLORMAP, DixReadAccess))) + dixLookupResource((pointer) &cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j) { @@ -2220,8 +2218,8 @@ int PanoramiXAllocColor(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2243,8 +2241,8 @@ int PanoramiXAllocNamedColor(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2266,8 +2264,8 @@ int PanoramiXAllocColorCells(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2289,8 +2287,8 @@ int PanoramiXAllocColorPlanes(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2313,8 +2311,8 @@ int PanoramiXFreeColors(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j) { @@ -2335,8 +2333,8 @@ int PanoramiXStoreColors(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ @@ -2358,8 +2356,8 @@ int PanoramiXStoreNamedColor(ClientPtr client) client->errorValue = stuff->cmap; - if(!(cmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->cmap, XRT_COLORMAP, DixWriteAccess))) + dixLookupResource((pointer) &cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); + if(!cmap) return BadColor; FOR_NSCREENS_BACKWARD(j){ diff --git a/Xext/saver.c b/Xext/saver.c index 7a5b2c7..9e6a83c 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -553,7 +553,7 @@ UninstallSaverColormap (pScreen) if (pPriv && pPriv->installedMap != None) { - pCmap = (ColormapPtr) LookupIDByType (pPriv->installedMap, RT_COLORMAP); + dixLookupResource((pointer) &pCmap, pPriv->installedMap, RT_COLORMAP, NullClient, DixUnknownAccess); if (pCmap) (*pCmap->pScreen->UninstallColormap) (pCmap); pPriv->installedMap = None; @@ -670,7 +670,7 @@ CreateSaverWindow (pScreen) if (i < numInstalled) return TRUE; - pCmap = (ColormapPtr) LookupIDByType (wantMap, RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wantMap, RT_COLORMAP, NullClient, DixUnknownAccess); if (!pCmap) return TRUE; @@ -1284,20 +1284,20 @@ ProcScreenSaverSetAttributes (ClientPtr client) REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if (!draw) return BadDrawable; len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2); if (Ones(stuff->mask) != len) return BadLength; - if((Mask)stuff->mask & CWBackPixmap) { + if ((Mask)stuff->mask & CWBackPixmap) { pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pback_offset); if ((tmp != None) && (tmp != ParentRelative)) { - if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &backPix, tmp, XRT_PIXMAP, client, DixReadAccess); + if (!backPix) return BadPixmap; } } @@ -1306,8 +1306,8 @@ ProcScreenSaverSetAttributes (ClientPtr client) pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1)); tmp = *((CARD32 *) &stuff[1] + pbord_offset); if (tmp != CopyFromParent) { - if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_PIXMAP, DixReadAccess))) + dixLookupResource((pointer) &bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); + if (!bordPix) return BadPixmap; } } @@ -1316,8 +1316,8 @@ ProcScreenSaverSetAttributes (ClientPtr client) cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1)); tmp = *((CARD32 *) &stuff[1] + cmap_offset); if ((tmp != CopyFromParent) && (tmp != None)) { - if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType( - client, tmp, XRT_COLORMAP, DixReadAccess))) + dixLookupResource((pointer) &cmap, tmp, XRT_COLORMAP, client, DixReadAccess); + if (!cmap) return BadColor; } } @@ -1355,8 +1355,8 @@ ProcScreenSaverUnsetAttributes (ClientPtr client) PanoramiXRes *draw; int i; - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if (!draw) return BadDrawable; for(i = PanoramiXNumScreens - 1; i > 0; i--) { diff --git a/Xext/security.c b/Xext/security.c index e379063..8040697 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -625,8 +625,8 @@ ProcSecurityRevokeAuthorization( REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); - pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client, - stuff->authId, SecurityAuthorizationResType, DixDestroyAccess); + dixLookupResource((pointer) &pAuth, stuff->authId, SecurityAuthorizationResType, + client, DixDestroyAccess); if (!pAuth) return SecurityErrorBase + XSecurityBadAuthorization; diff --git a/Xext/shape.c b/Xext/shape.c index 8e1da87..bf7fe4a 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -371,8 +371,8 @@ ProcPanoramiXShapeRectangles( REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); + if (!win) return BadWindow; FOR_NSCREENS(j) { @@ -470,13 +470,13 @@ ProcPanoramiXShapeMask( REQUEST_SIZE_MATCH (xShapeMaskReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); + if (!win) return BadWindow; - if(stuff->src != None) { - if(!(pmap = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->src, XRT_PIXMAP, DixReadAccess))) + if (stuff->src != None) { + dixLookupResource((pointer) &pmap, stuff->src, XRT_PIXMAP, client, DixReadAccess); + if (!pmap) return BadPixmap; } else pmap = NULL; @@ -599,12 +599,12 @@ ProcPanoramiXShapeCombine( REQUEST_AT_LEAST_SIZE (xShapeCombineReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); + if (!win) return BadWindow; - if(!(win2 = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->src, XRT_WINDOW, DixReadAccess))) + dixLookupResource((pointer) &win, stuff->src, XRT_WINDOW, client, DixReadAccess); + if (!win2) return BadWindow; FOR_NSCREENS(j) { @@ -672,8 +672,8 @@ ProcPanoramiXShapeOffset( REQUEST_AT_LEAST_SIZE (xShapeOffsetReq); - if(!(win = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->dest, XRT_WINDOW, DixWriteAccess))) + dixLookupResource((pointer) &win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); + if (!win) return BadWindow; FOR_NSCREENS(j) { @@ -762,7 +762,8 @@ ShapeFreeClient (data, id) pShapeEvent = (ShapeEventPtr) data; pWin = pShapeEvent->window; - pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); + dixLookupResource((pointer) &pHead, pWin->drawable.id, EventType, + NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pShapeEvent; pCur=pCur->next) @@ -811,8 +812,7 @@ ProcShapeSelectInput (client) rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (rc != Success) return rc; - pHead = (ShapeEventPtr *)SecurityLookupIDByType(client, - pWin->drawable.id, EventType, DixWriteAccess); + dixLookupResource((pointer) &pHead, pWin->drawable.id, EventType, client, DixWriteAccess); switch (stuff->enable) { case xTrue: if (pHead) { @@ -905,7 +905,8 @@ SendShapeNotify (pWin, which) RegionPtr region; BYTE shaped; - pHead = (ShapeEventPtr *) LookupIDByType(pWin->drawable.id, EventType); + dixLookupResource((pointer) &pHead, pWin->drawable.id, EventType, + NullClient, DixUnknownAccess); if (!pHead) return; switch (which) { @@ -984,8 +985,8 @@ ProcShapeInputSelected (client) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; - pHead = (ShapeEventPtr *) SecurityLookupIDByType(client, - pWin->drawable.id, EventType, DixReadAccess); + dixLookupResource((pointer) &pHead, pWin->drawable.id, EventType, + client, DixReadAccess); enabled = xFalse; if (pHead) { for (pShapeEvent = *pHead; diff --git a/Xext/shm.c b/Xext/shm.c index ce566b6..2c4fcac 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -144,7 +144,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL}; #define VERIFY_SHMSEG(shmseg,shmdesc,client) \ { \ - shmdesc = (ShmDescPtr)LookupIDByType(shmseg, ShmSegType); \ + dixLookupResource((pointer) &shmdesc, shmseg, ShmSegType, NullClient, DixUnknownAccess); \ if (!shmdesc) \ { \ client->errorValue = shmseg; \ @@ -519,12 +519,12 @@ ProcPanoramiXShmPutImage(ClientPtr client) REQUEST(xShmPutImageReq); REQUEST_SIZE_MATCH(xShmPutImageReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -569,8 +569,8 @@ ProcPanoramiXShmGetImage(ClientPtr client) return(BadValue); } - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; if (draw->type == XRT_PIXMAP) diff --git a/Xext/sync.c b/Xext/sync.c index f8870a7..196e2ed 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -1344,16 +1344,13 @@ ProcSyncSetCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncSetCounterReq); - pCounter = SecurityLookupIDByType(client, stuff->cid, RTCounter, - DixWriteAccess); - if (pCounter == NULL) - { + dixLookupResource((pointer) &pCounter, stuff->cid, RTCounter, client, DixWriteAccess); + if (pCounter == NULL) { client->errorValue = stuff->cid; return SyncErrorBase + XSyncBadCounter; } - if (IsSystemCounter(pCounter)) - { + if (IsSystemCounter(pCounter)) { client->errorValue = stuff->cid; return BadAccess; } @@ -1376,24 +1373,20 @@ ProcSyncChangeCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncChangeCounterReq); - pCounter = SecurityLookupIDByType(client, stuff->cid, RTCounter, - DixWriteAccess); - if (pCounter == NULL) - { + dixLookupResource((pointer) &pCounter, stuff->cid, RTCounter, client, DixWriteAccess); + if (pCounter == NULL) { client->errorValue = stuff->cid; return SyncErrorBase + XSyncBadCounter; } - if (IsSystemCounter(pCounter)) - { + if (IsSystemCounter(pCounter)) { client->errorValue = stuff->cid; return BadAccess; } XSyncIntsToValue(&newvalue, stuff->value_lo, stuff->value_hi); XSyncValueAdd(&newvalue, pCounter->value, newvalue, &overflow); - if (overflow) - { + if (overflow) { /* XXX 64 bit value can't fit in 32 bits; do the best we can */ client->errorValue = stuff->value_hi; return BadValue; @@ -1413,15 +1406,12 @@ ProcSyncDestroyCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncDestroyCounterReq); - pCounter = SecurityLookupIDByType(client, stuff->counter, RTCounter, - DixDestroyAccess); - if (pCounter == NULL) - { + dixLookupResource((pointer) &pCounter, stuff->counter, RTCounter, client, DixDestroyAccess); + if (pCounter == NULL) { client->errorValue = stuff->counter; return SyncErrorBase + XSyncBadCounter; } - if (IsSystemCounter(pCounter)) - { + if (IsSystemCounter(pCounter)) { client->errorValue = stuff->counter; return BadAccess; } @@ -1557,10 +1547,8 @@ ProcSyncQueryCounter(ClientPtr client) REQUEST_SIZE_MATCH(xSyncQueryCounterReq); - pCounter = SecurityLookupIDByType(client, stuff->counter, RTCounter, - DixReadAccess); - if (pCounter == NULL) - { + dixLookupResource((pointer) &pCounter, stuff->counter, RTCounter, client, DixReadAccess); + if (pCounter == NULL) { client->errorValue = stuff->counter; return SyncErrorBase + XSyncBadCounter; } @@ -1571,16 +1559,14 @@ ProcSyncQueryCounter(ClientPtr client) /* if system counter, ask it what the current value is */ - if (IsSystemCounter(pCounter)) - { + if (IsSystemCounter(pCounter)) { (*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter, &pCounter->value); } rep.value_hi = XSyncValueHigh32(pCounter->value); rep.value_lo = XSyncValueLow32(pCounter->value); - if (client->swapped) - { + if (client->swapped) { char n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); @@ -1684,9 +1670,8 @@ ProcSyncChangeAlarm(ClientPtr client) REQUEST_AT_LEAST_SIZE(xSyncChangeAlarmReq); - if (!(pAlarm = SecurityLookupIDByType(client, stuff->alarm, RTAlarm, - DixWriteAccess))) - { + dixLookupResource((pointer) &pAlarm, stuff->alarm, RTAlarm, client, DixWriteAccess); + if (!pAlarm) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } @@ -1707,8 +1692,7 @@ ProcSyncChangeAlarm(ClientPtr client) if (!pAlarm->trigger.pCounter || (*pAlarm->trigger.CheckTrigger)(&pAlarm->trigger, - pAlarm->trigger.pCounter->value)) - { + pAlarm->trigger.pCounter->value)) { (*pAlarm->trigger.TriggerFired)(&pAlarm->trigger); } return Success; @@ -1724,10 +1708,8 @@ ProcSyncQueryAlarm(ClientPtr client) REQUEST_SIZE_MATCH(xSyncQueryAlarmReq); - pAlarm = SecurityLookupIDByType(client, stuff->alarm, RTAlarm, - DixReadAccess); - if (!pAlarm) - { + dixLookupResource((pointer) &pAlarm, stuff->alarm, RTAlarm, client, DixReadAccess); + if (!pAlarm) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } @@ -1758,8 +1740,7 @@ ProcSyncQueryAlarm(ClientPtr client) rep.events = pAlarm->events; rep.state = pAlarm->state; - if (client->swapped) - { + if (client->swapped) { char n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); @@ -1778,13 +1759,13 @@ ProcSyncQueryAlarm(ClientPtr client) static int ProcSyncDestroyAlarm(ClientPtr client) { + pointer p; REQUEST(xSyncDestroyAlarmReq); REQUEST_SIZE_MATCH(xSyncDestroyAlarmReq); - if (!(SecurityLookupIDByType(client, stuff->alarm, RTAlarm, - DixDestroyAccess))) - { + dixLookupResource(&p, stuff->alarm, RTAlarm, client, DixDestroyAccess); + if (!p) { client->errorValue = stuff->alarm; return SyncErrorBase + XSyncBadAlarm; } diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index dabbdd6..9707ab3 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -427,11 +427,11 @@ ProcXF86BigfontQueryFont( } #endif client->errorValue = stuff->id; /* EITHER font or gc */ - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - DixGetAttrAccess); + dixLookupResource((pointer) &pFont, stuff->id, RT_FONT, client, DixGetAttrAccess); if (!pFont) { - GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC, - DixGetAttrAccess); + GC *pGC; + dixLookupResource((pointer) &pGC, stuff->id, RT_GC, + client, DixGetAttrAccess); if (!pGC) { client->errorValue = stuff->id; return BadFont; /* procotol spec says only error is BadFont */ diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index 770c53a..7fceb4c 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -479,7 +479,8 @@ ProcXvQueryEncodings(ClientPtr client) REQUEST(xvQueryEncodingsReq); REQUEST_SIZE_MATCH(xvQueryEncodingsReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -541,7 +542,8 @@ ProcXvPutVideo(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -584,7 +586,8 @@ ProcXvPutStill(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -627,7 +630,8 @@ ProcXvGetVideo(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -670,7 +674,8 @@ ProcXvGetStill(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -723,7 +728,8 @@ ProcXvSelectPortNotify(ClientPtr client) REQUEST(xvSelectPortNotifyReq); REQUEST_SIZE_MATCH(xvSelectPortNotifyReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -747,7 +753,8 @@ ProcXvGrabPort(ClientPtr client) REQUEST(xvGrabPortReq); REQUEST_SIZE_MATCH(xvGrabPortReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -784,7 +791,8 @@ ProcXvUngrabPort(ClientPtr client) REQUEST(xvGrabPortReq); REQUEST_SIZE_MATCH(xvGrabPortReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -808,7 +816,8 @@ ProcXvStopVideo(ClientPtr client) REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -835,7 +844,8 @@ ProcXvSetPortAttribute(ClientPtr client) REQUEST(xvSetPortAttributeReq); REQUEST_SIZE_MATCH(xvSetPortAttributeReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -873,7 +883,8 @@ ProcXvGetPortAttribute(ClientPtr client) REQUEST(xvGetPortAttributeReq); REQUEST_SIZE_MATCH(xvGetPortAttributeReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -918,7 +929,8 @@ ProcXvQueryBestSize(ClientPtr client) REQUEST(xvQueryBestSizeReq); REQUEST_SIZE_MATCH(xvQueryBestSizeReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -959,7 +971,8 @@ ProcXvQueryPortAttributes(ClientPtr client) REQUEST(xvQueryPortAttributesReq); REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -1020,7 +1033,8 @@ ProcXvPutImage(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -1106,7 +1120,8 @@ ProcXvShmPutImage(ClientPtr client) VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -1141,7 +1156,8 @@ ProcXvShmPutImage(ClientPtr client) if(!pImage) return BadMatch; - if(!(shmdesc = (ShmDescPtr)LookupIDByType(stuff->shmseg, ShmSegType))) + dixLookupResource((pointer) &shmdesc, stuff->shmseg, ShmSegType, NullClient, DixUnknownAccess); + if(!shmdesc) { client->errorValue = stuff->shmseg; return BadShmSegCode; @@ -1206,7 +1222,8 @@ ProcXvQueryImageAttributes(ClientPtr client) REQUEST_SIZE_MATCH(xvQueryImageAttributesReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -1269,7 +1286,8 @@ ProcXvListImageFormats(ClientPtr client) REQUEST_SIZE_MATCH(xvListImageFormatsReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client) )) + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return (_XvBadPort); @@ -1684,12 +1702,12 @@ XineramaXvStopVideo(ClientPtr client) REQUEST(xvStopVideoReq); REQUEST_SIZE_MATCH(xvStopVideoReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; - if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, DixReadAccess))) + dixLookupResource((pointer) &port, stuff->port, XvXRTPort, client, DixReadAccess); + if(!port) return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { @@ -1712,8 +1730,8 @@ XineramaXvSetPortAttribute(ClientPtr client) REQUEST_SIZE_MATCH(xvSetPortAttributeReq); - if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, DixReadAccess))) + dixLookupResource((pointer) &port, stuff->port, XvXRTPort, client, DixReadAccess); + if(!port) return _XvBadPort; FOR_NSCREENS_BACKWARD(i) { @@ -1737,16 +1755,16 @@ XineramaXvShmPutImage(ClientPtr client) REQUEST_SIZE_MATCH(xvShmPutImageReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; - if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, DixReadAccess))) + dixLookupResource((pointer) &port, stuff->port, XvXRTPort, client, DixReadAccess); + if(!port) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1786,16 +1804,16 @@ XineramaXvPutImage(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutImageReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; - if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, DixReadAccess))) + dixLookupResource((pointer) &port, stuff->port, XvXRTPort, client, DixReadAccess); + if(!port) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1831,16 +1849,16 @@ XineramaXvPutVideo(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutVideoReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; - if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, DixReadAccess))) + dixLookupResource((pointer) &port, stuff->port, XvXRTPort, client, DixReadAccess); + if(!port) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1876,16 +1894,16 @@ XineramaXvPutStill(ClientPtr client) REQUEST_AT_LEAST_SIZE(xvPutImageReq); - if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &draw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!draw) return BadDrawable; - if(!(gc = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->gc, XRT_GC, DixReadAccess))) + dixLookupResource((pointer) &gc, stuff->gc, XRT_GC, client, DixReadAccess); + if(!gc) return BadGC; - if(!(port = (PanoramiXRes *)SecurityLookupIDByType( - client, stuff->port, XvXRTPort, DixReadAccess))) + dixLookupResource((pointer) &port, stuff->port, XvXRTPort, client, DixReadAccess); + if(!port) return _XvBadPort; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; diff --git a/Xext/xvdix.h b/Xext/xvdix.h index 265c03d..a9f5e1b 100644 --- a/Xext/xvdix.h +++ b/Xext/xvdix.h @@ -201,18 +201,6 @@ typedef struct _XvPortRec { DevUnion devPriv; } XvPortRec, *XvPortPtr; -#define LOOKUP_PORT(_id, client)\ - ((XvPortPtr)LookupIDByType(_id, XvRTPort)) - -#define LOOKUP_ENCODING(_id, client)\ - ((XvEncodingPtr)LookupIDByType(_id, XvRTEncoding)) - -#define LOOKUP_VIDEONOTIFY_LIST(_id, client)\ - ((XvVideoNotifyPtr)LookupIDByType(_id, XvRTVideoNotifyList)) - -#define LOOKUP_PORTNOTIFY_LIST(_id, client)\ - ((XvPortNotifyPtr)LookupIDByType(_id, XvRTPortNotifyList)) - typedef struct { int version, revision; int nAdaptors; diff --git a/Xext/xvmain.c b/Xext/xvmain.c index f5c80f3..dae28ae 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -530,7 +530,7 @@ int reason; xvEvent event; XvVideoNotifyPtr pn; - pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList); + dixLookupResource((pointer) &pn, pDraw->id, XvRTVideoNotifyList, NullClient, DixUnknownAccess); while (pn) { @@ -915,7 +915,7 @@ XvdiSelectVideoNotify( /* FIND VideoNotify LIST */ - pn = (XvVideoNotifyPtr)LookupIDByType(pDraw->id, XvRTVideoNotifyList); + dixLookupResource((pointer) &pn, pDraw->id, XvRTVideoNotifyList, NullClient, DixUnknownAccess); /* IF ONE DONES'T EXIST AND NO MASK, THEN JUST RETURN */ diff --git a/Xext/xvmc.c b/Xext/xvmc.c index 091e5a1..5659b5c 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -136,7 +136,8 @@ ProcXvMCListSurfaceTypes(ClientPtr client) REQUEST(xvmcListSurfaceTypesReq); REQUEST_SIZE_MATCH(xvmcListSurfaceTypesReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return _XvBadPort; } @@ -192,7 +193,8 @@ ProcXvMCCreateContext(ClientPtr client) REQUEST(xvmcCreateContextReq); REQUEST_SIZE_MATCH(xvmcCreateContextReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return _XvBadPort; } @@ -273,10 +275,12 @@ ProcXvMCCreateContext(ClientPtr client) static int ProcXvMCDestroyContext(ClientPtr client) { + pointer p; REQUEST(xvmcDestroyContextReq); REQUEST_SIZE_MATCH(xvmcDestroyContextReq); - if(!LookupIDByType(stuff->context_id, XvMCRTContext)) + dixLookupResource(&p, stuff->context_id, XvMCRTContext, NullClient, DixUnknownAccess); + if(!p) return (XvMCBadContext + XvMCErrorBase); FreeResource(stuff->context_id, RT_NONE); @@ -297,7 +301,8 @@ ProcXvMCCreateSurface(ClientPtr client) REQUEST(xvmcCreateSurfaceReq); REQUEST_SIZE_MATCH(xvmcCreateSurfaceReq); - if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) + dixLookupResource((pointer) &pContext, stuff->context_id, XvMCRTContext, NullClient, DixUnknownAccess); + if(!pContext) return (XvMCBadContext + XvMCErrorBase); pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -337,10 +342,12 @@ ProcXvMCCreateSurface(ClientPtr client) static int ProcXvMCDestroySurface(ClientPtr client) { + pointer p; REQUEST(xvmcDestroySurfaceReq); REQUEST_SIZE_MATCH(xvmcDestroySurfaceReq); - if(!LookupIDByType(stuff->surface_id, XvMCRTSurface)) + dixLookupResource(&p, stuff->surface_id, XvMCRTSurface, NullClient, DixUnknownAccess); + if(!p) return (XvMCBadSurface + XvMCErrorBase); FreeResource(stuff->surface_id, RT_NONE); @@ -363,7 +370,8 @@ ProcXvMCCreateSubpicture(ClientPtr client) REQUEST(xvmcCreateSubpictureReq); REQUEST_SIZE_MATCH(xvmcCreateSubpictureReq); - if(!(pContext = LookupIDByType(stuff->context_id, XvMCRTContext))) + dixLookupResource((pointer) &pContext, stuff->context_id, XvMCRTContext, NullClient, DixUnknownAccess); + if(!pContext) return (XvMCBadContext + XvMCErrorBase); pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -448,10 +456,12 @@ ProcXvMCCreateSubpicture(ClientPtr client) static int ProcXvMCDestroySubpicture(ClientPtr client) { + pointer p; REQUEST(xvmcDestroySubpictureReq); REQUEST_SIZE_MATCH(xvmcDestroySubpictureReq); - if(!LookupIDByType(stuff->subpicture_id, XvMCRTSubpicture)) + dixLookupResource(&p, stuff->subpicture_id, XvMCRTSubpicture, NullClient, DixUnknownAccess); + if(!p) return (XvMCBadSubpicture + XvMCErrorBase); FreeResource(stuff->subpicture_id, RT_NONE); @@ -475,7 +485,8 @@ ProcXvMCListSubpictureTypes(ClientPtr client) REQUEST(xvmcListSubpictureTypesReq); REQUEST_SIZE_MATCH(xvmcListSubpictureTypesReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return _XvBadPort; } @@ -572,7 +583,8 @@ ProcXvMCGetDRInfo(ClientPtr client) REQUEST_SIZE_MATCH(xvmcGetDRInfoReq); - if(!(pPort = LOOKUP_PORT(stuff->port, client))) { + dixLookupResource((pointer) &pPort, stuff->port, XvRTPort, NullClient, DixUnknownAccess); + if(!pPort) { client->errorValue = stuff->port; return _XvBadPort; } diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c index b0d3ce3..d019f8a 100644 --- a/Xi/chdevcur.c +++ b/Xi/chdevcur.c @@ -94,13 +94,11 @@ int ProcXChangeDeviceCursor(ClientPtr client) } else { - pCursor = (CursorPtr)SecurityLookupIDByType(client, stuff->cursor, - RT_CURSOR, DixReadAccess); + dixLookupResource((pointer) &pCursor, stuff->cursor, RT_CURSOR, + client, DixReadAccess); if (!pCursor) - { return BadCursor; } - } ChangeWindowDeviceCursor(pWin, pDev, pCursor); diff --git a/Xi/extgrbdev.c b/Xi/extgrbdev.c index af87063..972fcc4 100644 --- a/Xi/extgrbdev.c +++ b/Xi/extgrbdev.c @@ -143,14 +143,10 @@ ProcXExtendedGrabDevice(ClientPtr client) } } - if (stuff->cursor) - { - cursor = (CursorPtr)SecurityLookupIDByType(client, - stuff->cursor, - RT_CURSOR, - DixReadAccess); - if (!cursor) - { + if (stuff->cursor) { + dixLookupResource((pointer) &cursor, stuff->cursor, RT_CURSOR, + client, DixReadAccess); + if (!cursor) { errval = stuff->cursor; rc = BadCursor; goto cleanup; diff --git a/composite/compext.c b/composite/compext.c index c154402..cf7a485 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -179,9 +179,8 @@ ProcCompositeUnredirectWindow (ClientPtr client) REQUEST(xCompositeUnredirectWindowReq); REQUEST_SIZE_MATCH(xCompositeUnredirectWindowReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) - { + dixLookupResource((pointer) &pWin, stuff->window, RT_WINDOW, NullClient, DixUnknownAccess); + if (!pWin) { client->errorValue = stuff->window; return BadWindow; } @@ -195,9 +194,8 @@ ProcCompositeUnredirectSubwindows (ClientPtr client) REQUEST(xCompositeUnredirectSubwindowsReq); REQUEST_SIZE_MATCH(xCompositeUnredirectSubwindowsReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) - { + dixLookupResource((pointer) &pWin, stuff->window, RT_WINDOW, NullClient, DixUnknownAccess); + if (!pWin) { client->errorValue = stuff->window; return BadWindow; } @@ -360,9 +358,8 @@ ProcCompositeReleaseOverlayWindow (ClientPtr client) CompOverlayClientPtr pOc; REQUEST_SIZE_MATCH(xCompositeReleaseOverlayWindowReq); - pWin = (WindowPtr) LookupIDByType (stuff->window, RT_WINDOW); - if (!pWin) - { + dixLookupResource((pointer) &pWin, stuff->window, RT_WINDOW, NullClient, DixUnknownAccess); + if (!pWin) { client->errorValue = stuff->window; return BadWindow; } diff --git a/composite/compinit.c b/composite/compinit.c index 5b2fba1..3a71183 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -298,7 +298,8 @@ compAddAlternateVisual(ScreenPtr pScreen, CompScreenPtr cs, for (i = 0; i < numInstalledCmaps; i++) { int j; - installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP); + dixLookupResource((pointer) &installedCmap, installedCmaps[i], RT_COLORMAP, + NullClient, DixUnknownAccess); if (!installedCmap) continue; j = installedCmap->pVisual - pScreen->visuals; diff --git a/damageext/damageextint.h b/damageext/damageextint.h index 543f1a7..204f02f 100644 --- a/damageext/damageextint.h +++ b/damageext/damageextint.h @@ -58,7 +58,7 @@ typedef struct _DamageExt { } DamageExtRec, *DamageExtPtr; #define VERIFY_DAMAGEEXT(pDamageExt, rid, client, mode) { \ - pDamageExt = SecurityLookupIDByType (client, rid, DamageExtType, mode); \ + dixLookupResource((pointer) &pDamageExt, rid, DamageExtType, client, mode); \ if (!pDamageExt) { \ client->errorValue = rid; \ return DamageErrorBase + BadDamage; \ diff --git a/dbe/dbe.c b/dbe/dbe.c index 3fd99df..bd06074 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -412,16 +412,15 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) REQUEST(xDbeDeallocateBackBufferNameReq); DbeWindowPrivPtr pDbeWindowPriv; int i; + pointer p; REQUEST_SIZE_MATCH(xDbeDeallocateBackBufferNameReq); /* Buffer name must be valid */ - if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, - stuff->buffer, dbeWindowPrivResType, DixDestroyAccess)) || - !(SecurityLookupIDByType(client, stuff->buffer, dbeDrawableResType, - DixDestroyAccess))) - { + dixLookupResource((pointer) &pDbeWindowPriv, stuff->buffer, dbeWindowPrivResType, client, DixDestroyAccess); + dixLookupResource(&p, stuff->buffer, dbeDrawableResType, client, DixDestroyAccess); + if (!pDbeWindowPriv || !p) { client->errorValue = stuff->buffer; return(dbeErrorBase + DbeBadBuffer); } @@ -431,17 +430,14 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) * above. */ - for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) - { + for (i = 0; i < pDbeWindowPriv->nBufferIDs; i++) { /* Loop through the ID list to find the ID. */ - if (pDbeWindowPriv->IDs[i] == stuff->buffer) - { + if (pDbeWindowPriv->IDs[i] == stuff->buffer) { break; } } - if (i == pDbeWindowPriv->nBufferIDs) - { + if (i == pDbeWindowPriv->nBufferIDs) { /* We did not find the ID in the ID list. */ client->errorValue = stuff->buffer; return(dbeErrorBase + DbeBadBuffer); @@ -838,13 +834,11 @@ ProcDbeGetBackBufferAttributes(ClientPtr client) REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq); - if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client, - stuff->buffer, dbeWindowPrivResType, DixGetAttrAccess))) - { + dixLookupResource((pointer) &pDbeWindowPriv, stuff->buffer, dbeWindowPrivResType, + client,DixGetAttrAccess); + if (!pDbeWindowPriv) { rep.attributes = None; - } - else - { + } else { rep.attributes = pDbeWindowPriv->pWindow->drawable.id; } @@ -852,15 +846,13 @@ ProcDbeGetBackBufferAttributes(ClientPtr client) rep.sequenceNumber = client->sequence; rep.length = 0; - if (client->swapped) - { + if (client->swapped) { swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); swapl(&rep.attributes, n); } - WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), - (char *)&rep); + WriteToClient(client, sizeof(xDbeGetBackBufferAttributesReply), (char *)&rep); return(client->noClientException); } /* ProcDbeGetbackBufferAttributes() */ diff --git a/dix/colormap.c b/dix/colormap.c index 23b755f..8e3e89a 100644 --- a/dix/colormap.c +++ b/dix/colormap.c @@ -893,10 +893,10 @@ AllocColor (ColormapPtr pmap, if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { - ColormapPtr prootmap = (ColormapPtr) - SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, DixReadAccess); - + ColormapPtr prootmap; + dixLookupResource((pointer) &prootmap, pmap->pScreen->defColormap, + RT_COLORMAP, clients[client], DixReadAccess); + /* XXX: need check NULL */ if (pmap->class == prootmap->class) FindColorInRootCmap (prootmap, prootmap->red, entries, &rgb, pPix, PSEUDOMAP, AllComp); @@ -910,10 +910,10 @@ AllocColor (ColormapPtr pmap, if (pmap->mid != pmap->pScreen->defColormap && pmap->pVisual->vid == pmap->pScreen->rootVisual) { - ColormapPtr prootmap = (ColormapPtr) - SecurityLookupIDByType (clients[client], pmap->pScreen->defColormap, - RT_COLORMAP, DixReadAccess); - + ColormapPtr prootmap; + dixLookupResource((pointer) &prootmap, pmap->pScreen->defColormap, + RT_COLORMAP, clients[client], DixReadAccess); + /* XXX: need check NULL */ if (pmap->class == prootmap->class) { pixR = (*pPix & pVisual->redMask) >> pVisual->offsetRed; @@ -1553,7 +1553,7 @@ FreeClientPixels (pointer value, XID fakeid) ColormapPtr pmap; colorResource *pcr = (colorResource *)value; - pmap = (ColormapPtr) LookupIDByType(pcr->mid, RT_COLORMAP); + dixLookupResource((pointer) &pmap, pcr->mid, RT_COLORMAP, NullClient, DixUnknownAccess); if (pmap) FreePixels(pmap, pcr->client); xfree(pcr); diff --git a/dix/cursor.c b/dix/cursor.c index b91c194..bd4f3f1 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -545,7 +545,8 @@ CreateRootCursor(char *unused1, unsigned int unused2) if (err != Success) return NullCursor; - cursorfont = (FontPtr)LookupIDByType(fontID, RT_FONT); + dixLookupResource((pointer) &cursorfont, fontID, RT_FONT, + NullClient, DixUnknownAccess); if (!cursorfont) return NullCursor; if (AllocGlyphCursor(fontID, 0, fontID, 1, 0, 0, 0, ~0, ~0, ~0, diff --git a/dix/dispatch.c b/dix/dispatch.c index ee105f8..10d3c99 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1094,9 +1094,8 @@ ProcCloseFont(ClientPtr client) REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); - pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT, - DixDestroyAccess); - if ( pFont != (FontPtr)NULL) /* id was valid */ + dixLookupResource((pointer) &pFont, stuff->id, RT_FONT, client, DixDestroyAccess); + if (pFont != NULL) /* id was valid */ { FreeResource(stuff->id, RT_NONE); return(client->noClientException); diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 15d011c..adadb80 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -141,8 +141,8 @@ SetDefaultFont(char *defaultfontname) (unsigned) strlen(defaultfontname), defaultfontname); if (err != Success) return FALSE; - pf = (FontPtr) LookupIDByType(fid, RT_FONT); - if (pf == (FontPtr) NULL) + dixLookupResource((pointer) &pf, fid, RT_FONT, NullClient, DixUnknownAccess); + if (pf == NULL) return FALSE; defaultFont = pf; return TRUE; @@ -1183,6 +1183,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT; FontPathElementPtr fpe; GC *origGC = NULL; + DrawablePtr p; if (client->clientGone) { @@ -1205,12 +1206,9 @@ doPolyText(ClientPtr client, PTclosurePtr c) } } + dixLookupResource((pointer) &p, c->did, RC_DRAWABLE, client, DixWriteAccess); /* Make sure our drawable hasn't disappeared while we slept. */ - if (c->slept && - c->pDraw && - c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, - RC_DRAWABLE, DixWriteAccess)) - { + if (c->slept && c->pDraw && c->pDraw != p) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client and avoid further rendering while we clean up after ourself. */ @@ -1238,8 +1236,7 @@ doPolyText(ClientPtr client, PTclosurePtr c) | ((Font)*(c->pElt+3)) << 8 | ((Font)*(c->pElt+2)) << 16 | ((Font)*(c->pElt+1)) << 24; - pFont = (FontPtr)SecurityLookupIDByType(client, fid, RT_FONT, - DixReadAccess); + dixLookupResource((pointer) &pFont, fid, RT_FONT, client, DixReadAccess); if (!pFont) { client->errorValue = fid; @@ -1481,6 +1478,7 @@ doImageText(ClientPtr client, ITclosurePtr c) { int err = Success, lgerr; /* err is in X error, not font error, space */ FontPathElementPtr fpe; + DrawablePtr p; if (client->clientGone) { @@ -1490,12 +1488,9 @@ doImageText(ClientPtr client, ITclosurePtr c) goto bail; } + dixLookupResource((pointer) &p, c->did, RC_DRAWABLE, client, DixWriteAccess); /* Make sure our drawable hasn't disappeared while we slept. */ - if (c->slept && - c->pDraw && - c->pDraw != (DrawablePtr)SecurityLookupIDByClass(client, c->did, - RC_DRAWABLE, DixWriteAccess)) - { + if (c->slept && c->pDraw && c->pDraw != p) { /* Our drawable has disappeared. Treat like client died... ask the FPE code to clean up after client. */ fpe = c->pGC->font->fpe; @@ -2022,8 +2017,10 @@ FreeFonts(void) FontPtr find_old_font(XID id) { - return (FontPtr) SecurityLookupIDByType(NullClient, id, RT_NONE, - DixUnknownAccess); + FontPtr p; + + dixLookupResource((pointer) &p, id, RT_NONE, NullClient, DixUnknownAccess); + return p; } Font diff --git a/dix/dixutils.c b/dix/dixutils.c index 19ed5bf..00cad9e 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -240,7 +240,8 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) int dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) { - GCPtr pTmp = (GCPtr)SecurityLookupIDByType(client, id, RT_GC, access); + GCPtr pTmp; + dixLookupResource((pointer) &pTmp, id, RT_GC, client, access); if (pTmp) { *pGC = pTmp; return Success; diff --git a/dix/events.c b/dix/events.c index 7b698a0..9e501b1 100644 --- a/dix/events.c +++ b/dix/events.c @@ -528,13 +528,16 @@ XineramaSetWindowPntrs(DeviceIntPtr pDev, WindowPtr pWin) PanoramiXRes *win; int i; - win = (PanoramiXRes*)LookupIDByType(pWin->drawable.id, XRT_WINDOW); + dixLookupResource((pointer) &win, pWin->drawable.id, XRT_WINDOW, + NullClient, DixUnknownAccess); if(!win) return FALSE; for(i = 0; i < PanoramiXNumScreens; i++) { - pSprite->windows[i] = LookupIDByType(win->info[i].id, RT_WINDOW); + dixLookupResource((pointer) &pSprite->windows[i], win->info[i].id, + RT_WINDOW, NullClient, DixUnknownAccess); + if(!pSprite->windows[i]) /* window is being unmapped */ return FALSE; } diff --git a/dix/resource.c b/dix/resource.c index 31ad46e..9f1777b 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -395,12 +395,13 @@ GetXIDList(ClientPtr pClient, unsigned count, XID *pids) unsigned int found = 0; XID id = pClient->clientAsMask; XID maxid; + pointer p; maxid = id | RESOURCE_ID_MASK; while ( (found < count) && (id <= maxid) ) { - if (!LookupIDByClass(id, RC_ANY)) - { + dixLookupResource(&p, id, RC_ANY, NullClient, DixUnknownAccess); + if (p != NULL) { pids[found++] = id; } id++; @@ -827,7 +828,7 @@ FreeAllResources(void) Bool LegalNewID(XID id, ClientPtr client) { - + pointer p; #ifdef PANORAMIX XID minid, maxid; @@ -839,9 +840,9 @@ LegalNewID(XID id, ClientPtr client) return TRUE; } #endif /* PANORAMIX */ + dixLookupResource(&p, id, RC_ANY, NullClient, DixUnknownAccess); return ((client->clientAsMask == (id & ~RESOURCE_ID_MASK)) && - ((clientTable[client->index].expectID <= id) || - !LookupIDByClass(id, RC_ANY))); + ((clientTable[client->index].expectID <= id) || !p)); } int diff --git a/dix/window.c b/dix/window.c index 88ab5e9..b452798 100644 --- a/dix/window.c +++ b/dix/window.c @@ -2829,8 +2829,8 @@ UnrealizeTree( #ifdef PANORAMIX if(!noPanoramiXExtension && !pChild->drawable.pScreen->myNum) { PanoramiXRes *win; - win = (PanoramiXRes*)LookupIDByType(pChild->drawable.id, - XRT_WINDOW); + dixLookupResource((pointer) &win, pChild->drawable.id, XRT_WINDOW, + NullClient, DixUnknownAccess); if(win) win->u.win.visibility = VisibilityNotViewable; } @@ -3106,7 +3106,8 @@ SendVisibilityNotify(WindowPtr pWin) for(i = 0; i < PanoramiXNumScreens; i++) { if(i == Scrnum) continue; - pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW); + dixLookupResource((pointer) &pWin2, win->info[i].id, RT_WINDOW, + NullClient, DixUnknownAccess); if (pWin2) { if(pWin2->visibility == VisibilityPartiallyObscured) @@ -3118,7 +3119,8 @@ SendVisibilityNotify(WindowPtr pWin) break; case VisibilityPartiallyObscured: if(Scrnum) { - pWin2 = (WindowPtr)LookupIDByType(win->info[0].id, RT_WINDOW); + dixLookupResource((pointer) &pWin2, win->info[i].id, RT_WINDOW, + NullClient, DixUnknownAccess); if (pWin2) pWin = pWin2; } break; @@ -3126,7 +3128,8 @@ SendVisibilityNotify(WindowPtr pWin) for(i = 0; i < PanoramiXNumScreens; i++) { if(i == Scrnum) continue; - pWin2 = (WindowPtr)LookupIDByType(win->info[i].id, RT_WINDOW); + dixLookupResource((pointer) &pWin2, win->info[i].id, RT_WINDOW, + NullClient, DixUnknownAccess); if (pWin2) { if(pWin2->visibility != VisibilityFullyObscured) @@ -3780,8 +3783,10 @@ DrawLogo(WindowPtr pWin) fore[0].val = pScreen->whitePixel; else fore[0].val = pScreen->blackPixel; - if ((pWin->backgroundState == BackgroundPixel) && - (cmap = (ColormapPtr)LookupIDByType(wColormap (pWin), RT_COLORMAP))) { + if (pWin->backgroundState == BackgroundPixel) { + dixLookupResource((pointer) &cmap, wColormap(pWin), RT_COLORMAP, + NullClient, DixUnknownAccess); + if (cmap) { Pixel querypixels[2]; querypixels[0] = fore[0].val; @@ -3796,6 +3801,7 @@ DrawLogo(WindowPtr pWin) fore[0].val = pScreen->blackPixel; } } + } fore[1].val = FillSolid; fmask = GCForeground|GCFillStyle; if (pWin->backgroundState == BackgroundPixel) { diff --git a/fb/fbcmap.c b/fb/fbcmap.c index c29a513..a688e3a 100644 --- a/fb/fbcmap.c +++ b/fb/fbcmap.c @@ -85,8 +85,8 @@ fbUninstallColormap(ColormapPtr pmap) { if (pmap->mid != pmap->pScreen->defColormap) { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); + dixLookupResource((pointer) &curpmap, pmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap)(curpmap); } } diff --git a/glx/glxcmds.c b/glx/glxcmds.c index af52672..38a2f17 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -202,7 +202,8 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, if (shareList == None) { shareglxc = 0; } else { - shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); + dixLookupResource((pointer) &shareglxc, shareList, __glXContextRes, + NullClient, DixUnknownAccess); if (!shareglxc) { client->errorValue = shareList; return __glXError(GLXBadContext); @@ -324,7 +325,7 @@ int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc) GLXContextID gcId = req->context; __GLXcontext *glxc; - glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); + dixLookupResource((pointer) &glxc, gcId,__glXContextRes, NullClient, DixUnknownAccess); if (glxc) { /* ** Just free the resource; don't actually destroy the context, @@ -457,7 +458,7 @@ __glXGetDrawable(__GLXcontext *glxc, GLXDrawable drawId, ClientPtr client, /* This is the GLX 1.3 case - the client passes in a GLXWindow or * GLXPixmap and we just return the __GLXdrawable. */ - pGlxDraw = (__GLXdrawable *) LookupIDByType(drawId, __glXDrawableRes); + dixLookupResource((pointer) &pGlxDraw, drawId, __glXDrawableRes, NullClient, DixUnknownAccess); if (pGlxDraw != NULL) { if (glxc != NULL && pGlxDraw->config != glxc->config) { client->errorValue = drawId; @@ -567,7 +568,7 @@ DoMakeCurrent(__GLXclientState *cl, if (contextId != None) { int status; - glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes); + dixLookupResource((pointer) &glxc, contextId, __glXContextRes, NullClient, DixUnknownAccess); if (!glxc) { client->errorValue = contextId; return __glXError(GLXBadContext); @@ -702,7 +703,7 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc) /* ** Find the GL context. */ - glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); + dixLookupResource((pointer) &glxc, req->context, __glXContextRes, NullClient, DixUnknownAccess); if (!glxc) { client->errorValue = req->context; return __glXError(GLXBadContext); @@ -796,12 +797,12 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) /* ** Check that each context exists. */ - src = (__GLXcontext *) LookupIDByType(source, __glXContextRes); + dixLookupResource((pointer) &src, source, __glXContextRes, NullClient, DixUnknownAccess); if (!src) { client->errorValue = source; return __glXError(GLXBadContext); } - dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes); + dixLookupResource((pointer) &dst, dest, __glXContextRes, NullClient, DixUnknownAccess); if (!dst) { client->errorValue = dest; return __glXError(GLXBadContext); @@ -1116,7 +1117,8 @@ determineTextureTarget(XID glxDrawableID, CARD32 *attribs, CARD32 numAttribs) int i; __GLXdrawable *pGlxDraw; - pGlxDraw = LookupIDByType(glxDrawableID, __glXDrawableRes); + dixLookupResource((pointer) &pGlxDraw, glxDrawableID, __glXDrawableRes, + NullClient, DixUnknownAccess); for (i = 0; i < numAttribs; i++) { if (attribs[2 * i] == GLX_TEXTURE_TARGET_EXT) { @@ -1208,7 +1210,7 @@ static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type) /* ** Check it's the right type of drawable. */ - pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes); + dixLookupResource((pointer) &pGlxDraw, glxdrawable, __glXDrawableRes, NullClient, DixUnknownAccess); if (pGlxDraw == NULL || pGlxDraw->type != type) { client->errorValue = glxdrawable; switch (type) { @@ -1321,7 +1323,7 @@ DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable, __GLXdrawable *pGlxDraw; int i; - pGlxDraw = LookupIDByType(glxdrawable, __glXDrawableRes); + dixLookupResource((pointer) &pGlxDraw, glxdrawable, __glXDrawableRes, NullClient, DixUnknownAccess); for (i = 0; i < numAttribs; i++) { switch(attribs[i * 2]) { case GLX_EVENT_MASK: @@ -1450,7 +1452,7 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId) int *sendBuf, *pSendBuf; int nReplyBytes; - ctx = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); + dixLookupResource((pointer) &ctx, gcId, __glXContextRes, NullClient, DixUnknownAccess); if (!ctx) { client->errorValue = gcId; return __glXError(GLXBadContext); diff --git a/glx/glxscreens.c b/glx/glxscreens.c index 988a59d..16a6cc8 100644 --- a/glx/glxscreens.c +++ b/glx/glxscreens.c @@ -331,7 +331,8 @@ AddScreenVisuals(ScreenPtr pScreen, int count, int d) * for all colormaps. */ for (i = 0; i < numInstalledCmaps; i++) { - installedCmap = LookupIDByType (installedCmaps[i], RT_COLORMAP); + dixLookupResource((pointer) &installedCmap, installedCmaps[i], RT_COLORMAP, + NullClient, DixUnknownAccess); if (!installedCmap) continue; j = installedCmap->pVisual - pScreen->visuals; diff --git a/glx/xfont.c b/glx/xfont.c index 1f4ecbd..966b22a 100644 --- a/glx/xfont.c +++ b/glx/xfont.c @@ -180,9 +180,9 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc) ** Font can actually be either the ID of a font or the ID of a GC ** containing a font. */ - pFont = (FontPtr)LookupIDByType(req->font, RT_FONT); + dixLookupResource((pointer) &pFont, req->font, RT_FONT, NullClient, DixUnknownAccess); if (!pFont) { - pGC = (GC *)LookupIDByType(req->font, RT_GC); + dixLookupResource((pointer) &pGC, req->font, RT_GC, NullClient, DixUnknownAccess); if (!pGC) { client->errorValue = req->font; return BadFont; diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c index 10d9e22..3ee1c34 100644 --- a/hw/dmx/dmx.c +++ b/hw/dmx/dmx.c @@ -276,8 +276,9 @@ static int ProcDMXForceWindowCreation(ClientPtr client) PanoramiXRes *win; int i; - if (!(win = SecurityLookupIDByType(client, stuff->window, XRT_WINDOW, - DixReadAccess))) + dixLookupResource((pointer) &win, stuff->window, XRT_WINDOW, + client, DixReadAccess); + if (!win) return -1; /* BadWindow */ FOR_NSCREENS(i) { @@ -550,8 +551,8 @@ static int dmxPopulatePanoramiX(ClientPtr client, Window window, int count = 0; DMXWindowAttributesRec attr; - if (!(win = SecurityLookupIDByType(client, window, XRT_WINDOW, - DixReadAccess))) + dixLookupResource((pointer) &win, window, XRT_WINDOW, client, DixReadAccess); + if (!win) return -1; /* BadWindow */ FOR_NSCREENS(i) { diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index d367f26..ba2bfad 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -701,7 +701,8 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, PixmapPtr pPix; int i; - pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP); + dixLookupResource((pointer) &pPix, pXinPix->info[idx].id, RT_PIXMAP, + NullClient, DixUnknownAccess); if (pPix != pDst) return; /* Not a match.... Next! */ for (i = 0; i < PanoramiXNumScreens; i++) { @@ -710,8 +711,8 @@ static void dmxBERestorePixmapImage(pointer value, XID id, RESTYPE type, if (i == idx) continue; /* Self replication is bad */ - pSrc = - (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP); + dixLookupResource((pointer) &pSrc, pXinPix->info[i].id, RT_PIXMAP, + NullClient, DixUnknownAccess); pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); if (pSrcPriv->pixmap) { DMXScreenInfo *dmxSrcScreen = &dmxScreens[i]; @@ -1373,7 +1374,8 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, PixmapPtr pPix; int i; - pPix = (PixmapPtr)LookupIDByType(pXinPix->info[idx].id, RT_PIXMAP); + dixLookupResource((pointer) &pPix, pXinPix->info[idx].id, RT_PIXMAP, + NullClient, DixUnknownAccess); if (pPix != pDst) return; /* Not a match.... Next! */ for (i = 0; i < PanoramiXNumScreens; i++) { @@ -1382,8 +1384,8 @@ static void dmxBEFindPixmapImage(pointer value, XID id, RESTYPE type, if (i == idx) continue; /* Self replication is bad */ - pSrc = - (PixmapPtr)LookupIDByType(pXinPix->info[i].id, RT_PIXMAP); + dixLookupResource((pointer) &pSrc, pXinPix->info[i].id, RT_PIXMAP, + NullClient, DixUnknownAccess); pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); if (pSrcPriv->pixmap) { FoundPixImage = True; diff --git a/hw/dmx/dmxgcops.c b/hw/dmx/dmxgcops.c index eaabf16..c8c2b91 100644 --- a/hw/dmx/dmxgcops.c +++ b/hw/dmx/dmxgcops.c @@ -522,7 +522,9 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw) if (noPanoramiXExtension) return NULL; if (pDrawable->type != DRAWABLE_PIXMAP) return NULL; - if (!(pXinPix = (PanoramiXRes *)LookupIDByType(pDrawable->id, XRT_PIXMAP))) + dixLookupResource((pointer) &pXinPix, pDrawable->id, XRT_PIXMAP, + NullClient, DixUnknownAccess); + if (!pXinPix) return NULL; for (i = 1; i < PanoramiXNumScreens; i++) { @@ -531,8 +533,8 @@ static DMXScreenInfo *dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw) PixmapPtr pSrc; dmxPixPrivPtr pSrcPriv; - pSrc = (PixmapPtr)LookupIDByType(pXinPix->info[i].id, - RT_PIXMAP); + dixLookupResource((pointer) &pSrc, pXinPix->info[i].id, + RT_PIXMAP, NullClient, DixUnknownAccess); pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); if (pSrcPriv->pixmap) { *draw = pSrcPriv->pixmap; diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c index 37dfa10..10729bd 100644 --- a/hw/dmx/dmxpict.c +++ b/hw/dmx/dmxpict.c @@ -271,8 +271,8 @@ static int dmxProcRenderCreateGlyphSet(ClientPtr client) /* Store glyphsets from backends in glyphSet->devPrivate ????? */ /* Make sure we handle all errors here!! */ - glyphSet = SecurityLookupIDByType(client, stuff->gsid, GlyphSetType, - DixDestroyAccess); + dixLookupResource((pointer) &glyphSet, stuff->gsid, GlyphSetType, + client, DixDestroyAccess); glyphPriv = xalloc(sizeof(dmxGlyphPrivRec)); if (!glyphPriv) return BadAlloc; glyphPriv->glyphSets = NULL; @@ -313,8 +313,8 @@ static int dmxProcRenderFreeGlyphSet(ClientPtr client) REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); - glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, - DixDestroyAccess); + dixLookupResource((pointer) &glyphSet, stuff->glyphset, GlyphSetType, + client, DixDestroyAccess); if (glyphSet && glyphSet->refcnt == 1) { dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -356,8 +356,8 @@ static int dmxProcRenderAddGlyphs(ClientPtr client) CARD8 *bits; int nbytes; - glyphSet = SecurityLookupIDByType(client, stuff->glyphset, - GlyphSetType, DixReadAccess); + dixLookupResource((pointer) &glyphSet, stuff->glyphset, GlyphSetType, + client, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); nglyphs = stuff->nglyphs; @@ -399,8 +399,8 @@ static int dmxProcRenderFreeGlyphs(ClientPtr client) REQUEST(xRenderFreeGlyphsReq); REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); - glyphSet = SecurityLookupIDByType(client, stuff->glyphset, GlyphSetType, - DixWriteAccess); + dixLookupResource((pointer) &glyphSet, stuff->glyphset, GlyphSetType, + client, DixWriteAccess); if (glyphSet) { dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); @@ -471,14 +471,14 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) GlyphSetPtr glyphSet; dmxGlyphPrivPtr glyphPriv; - pSrc = SecurityLookupIDByType(client, stuff->src, PictureType, - DixReadAccess); + dixLookupResource((pointer) &pSrc, stuff->src, PictureType, + client, DixReadAccess); pSrcPriv = DMX_GET_PICT_PRIV(pSrc); if (!pSrcPriv->pict) return ret; - pDst = SecurityLookupIDByType(client, stuff->dst, PictureType, - DixWriteAccess); + dixLookupResource((pointer) &pDst, stuff->dst, PictureType, + client, DixWriteAccess); pDstPriv = DMX_GET_PICT_PRIV(pDst); if (!pDstPriv->pict) return ret; @@ -494,8 +494,8 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) return ret; if (stuff->maskFormat) - pFmt = SecurityLookupIDByType(client, stuff->maskFormat, - PictFormatType, DixReadAccess); + dixLookupResource((pointer) &pFmt, stuff->maskFormat, PictFormatType, + client, DixReadAccess); else pFmt = NULL; @@ -545,8 +545,8 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) curGlyph = glyphs; curElt = elts; - glyphSet = SecurityLookupIDByType(client, stuff->glyphset, - GlyphSetType, DixReadAccess); + dixLookupResource((pointer) &glyphSet, stuff->glyphset, GlyphSetType, + client, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); while (buffer + sizeof(xGlyphElt) < end) { @@ -554,10 +554,8 @@ static int dmxProcRenderCompositeGlyphs(ClientPtr client) buffer += sizeof(xGlyphElt); if (elt->len == 0xff) { - glyphSet = SecurityLookupIDByType(client, - *((CARD32 *)buffer), - GlyphSetType, - DixReadAccess); + dixLookupResource((pointer) &glyphSet, *((CARD32 *)buffer), + GlyphSetType, client, DixReadAccess); glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); buffer += 4; } else { diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c index 24acc08..18542c9 100644 --- a/hw/dmx/dmxwindow.c +++ b/hw/dmx/dmxwindow.c @@ -86,7 +86,8 @@ Window dmxCreateRootWindow(WindowPtr pWindow) parent = dmxScreen->scrnWin; /* This is our "Screen" window */ visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual; - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWindow), RT_COLORMAP, + NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel; @@ -193,8 +194,8 @@ void dmxGetDefaultWindowAttributes(WindowPtr pWindow, ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), - RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWindow), RT_COLORMAP, + NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); *cmap = pCmapPriv->cmap; } else { @@ -554,7 +555,8 @@ static void dmxDoChangeWindowAttributes(WindowPtr pWindow, ColormapPtr pCmap; dmxColormapPrivPtr pCmapPriv; - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWindow), RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWindow), RT_COLORMAP, + NullClient, DixUnknownAccess); pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); attribs->colormap = pCmapPriv->cmap; } diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c index f19239f..11c0719 100644 --- a/hw/dmx/glxProxy/glxcmds.c +++ b/hw/dmx/glxProxy/glxcmds.c @@ -135,7 +135,8 @@ static int CreateContext(__GLXclientState *cl, if (shareList == None) { shareglxc = NULL; } else { - shareglxc = (__GLXcontext *) LookupIDByType(shareList, __glXContextRes); + dixLookupResource((pointer) &shareglxc, shareList, __glXContextRes, + NullClient, DixUnknownAccess); if (!shareglxc) { client->errorValue = shareList; return __glXBadContext; @@ -426,14 +427,14 @@ int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess); if (rc != Success) { - pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, - __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, req->drawable, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable, - __glXWindowRes); + dixLookupResource((pointer) &pGlxWindow, req->drawable, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) pDraw = pGlxWindow->pDraw; } @@ -456,14 +457,14 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess); if (rc != Success) { - pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->drawable, - __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, req->drawable, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) pDraw = pGlxPixmap->pDraw; } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxWindow = (__glXWindow *) LookupIDByType(req->drawable, - __glXWindowRes); + dixLookupResource((pointer) &pGlxWindow, req->drawable, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) pDraw = pGlxWindow->pDraw; } @@ -476,14 +477,14 @@ int __glXJoinSwapGroupSGIX(__GLXclientState *cl, GLbyte *pc) rc = dixLookupDrawable(&pMember, req->member, client, 0, DixGetAttrAccess); if (rc != Success) { - pGlxPixmap = (__GLXpixmap *) LookupIDByType(req->member, - __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, req->member, + __glXPixmapRes, NullClient, DixUnknownAccess); if (pGlxPixmap) pMember = pGlxPixmap->pDraw; } if (!pMember && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxWindow = (__glXWindow *) LookupIDByType(req->member, - __glXWindowRes); + dixLookupResource((pointer) &pGlxWindow, req->member, + __glXWindowRes, NullClient, DixUnknownAccess); if (pGlxWindow) pMember = pGlxWindow->pDraw; } @@ -511,7 +512,8 @@ int __glXDestroyContext(__GLXclientState *cl, GLbyte *pc) int to_screen = 0; int s; - glxc = (__GLXcontext *) LookupIDByType(gcId, __glXContextRes); + dixLookupResource((pointer) &glxc, gcId, __glXContextRes, + NullClient, DixUnknownAccess); if (glxc) { /* ** Just free the resource; don't actually destroy the context, @@ -758,7 +760,8 @@ static int MakeCurrent(__GLXclientState *cl, ** Lookup new context. It must not be current for someone else. */ if (contextId != None) { - glxc = (__GLXcontext *) LookupIDByType(contextId, __glXContextRes); + dixLookupResource((pointer) &glxc, contextId, __glXContextRes, + NullClient, DixUnknownAccess); if (!glxc) { client->errorValue = contextId; return __glXBadContext; @@ -808,8 +811,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (!pDraw) { - pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, - __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, drawId, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) { /* ** Check if pixmap and context are similar. @@ -832,7 +835,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + dixLookupResource((pointer) &pGlxWindow, drawId, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) { /* ** Drawable is a GLXWindow. @@ -853,7 +857,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes); + dixLookupResource((pointer) &pGlxPbuffer, drawId, __glXPbufferRes, + NullClient, DixUnknownAccess); if (pGlxPbuffer) { if (pGlxPbuffer->pScreen != glxc->pScreen || pGlxPbuffer->pFBConfig != glxc->pFBConfig) { @@ -914,8 +919,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (!pReadDraw) { - pReadGlxPixmap = (__GLXpixmap *) LookupIDByType(readId, - __glXPixmapRes); + dixLookupResource((pointer) &pReadGlxPixmap, readId, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pReadGlxPixmap) { /* ** Check if pixmap and context are similar. @@ -935,8 +940,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxReadWindow = (__glXWindow *) - LookupIDByType(readId, __glXWindowRes); + dixLookupResource((pointer) &pGlxReadWindow, readId, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxReadWindow) { /* ** Drawable is a GLXWindow. @@ -956,7 +961,8 @@ static int MakeCurrent(__GLXclientState *cl, } if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxReadPbuffer = (__glXPbuffer *)LookupIDByType(readId, __glXPbufferRes); + dixLookupResource((pointer) &pGlxReadPbuffer, readId, + __glXPbufferRes, NullClient, DixUnknownAccess); if (pGlxReadPbuffer) { if (pGlxReadPbuffer->pScreen != glxc->pScreen || pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) { @@ -1096,16 +1102,15 @@ static int MakeCurrent(__GLXclientState *cl, to_screen = screenInfo.numScreens - 1; if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) { - pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + dixLookupResource((pointer) &pXinDraw, pDraw->id, XRC_DRAWABLE, + client, DixReadAccess); } if (pReadDraw && pReadDraw != pDraw && new_reply.readType != GLX_PBUFFER_TYPE) { - pXinReadDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pReadDraw->id, XRC_DRAWABLE, DixReadAccess); - } - else { + dixLookupResource((pointer) &pXinReadDraw, pReadDraw->id, XRC_DRAWABLE, + client, DixReadAccess); + } else { pXinReadDraw = pXinDraw; } } @@ -1309,7 +1314,8 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) /* ** Find the GL context. */ - glxc = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); + dixLookupResource((pointer) &glxc, req->context, __glXContextRes, + NullClient, DixUnknownAccess); if (!glxc) { client->errorValue = req->context; return __glXBadContext; @@ -1455,12 +1461,14 @@ int __glXCopyContext(__GLXclientState *cl, GLbyte *pc) /* ** Check that each context exists. */ - src = (__GLXcontext *) LookupIDByType(source, __glXContextRes); + dixLookupResource((pointer) &src, source, __glXContextRes, + NullClient, DixUnknownAccess); if (!src) { client->errorValue = source; return __glXBadContext; } - dst = (__GLXcontext *) LookupIDByType(dest, __glXContextRes); + dixLookupResource((pointer) &dst, dest, __glXContextRes, + NullClient, DixUnknownAccess); if (!dst) { client->errorValue = dest; return __glXBadContext; @@ -1754,8 +1762,8 @@ static int CreateGLXPixmap(__GLXclientState *cl, from_screen = 0; to_screen = screenInfo.numScreens - 1; - pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + dixLookupResource((pointer) &pXinDraw, pDraw->id, XRC_DRAWABLE, + client, DixReadAccess); } #endif @@ -1876,7 +1884,8 @@ int __glXDestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) /* ** Check if it's a valid GLX pixmap. */ - pGlxPixmap = (__GLXpixmap *)LookupIDByType(glxpixmap, __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, glxpixmap, __glXPixmapRes, + NullClient, DixUnknownAccess); if (!pGlxPixmap) { client->errorValue = glxpixmap; return __glXBadPixmap; @@ -1959,8 +1968,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) } if (!pDraw) { - pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, - __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, drawId, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) { /* ** Drawable is a GLX pixmap. @@ -1971,7 +1980,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + dixLookupResource((pointer) &pGlxWindow, drawId, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) { /* ** Drawable is a GLXWindow. @@ -2000,8 +2010,8 @@ int __glXDoSwapBuffers(__GLXclientState *cl, XID drawId, GLXContextTag tag) if (!noPanoramiXExtension) { from_screen = 0; to_screen = screenInfo.numScreens - 1; - pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + dixLookupResource((pointer) &pXinDraw, pDraw->id, XRC_DRAWABLE, + client, DixReadAccess); } #endif @@ -2106,8 +2116,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, - __glXPixmapRes); + dixLookupResource((pointer) &pGlxPixmap, drawId, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) { /* ** Drawable is a GLX pixmap. @@ -2117,7 +2127,8 @@ int __glXSwapBuffers(__GLXclientState *cl, GLbyte *pc) } if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1,3) ) { - pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + dixLookupResource((pointer) &pGlxWindow, drawId, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) { /* ** Drawable is a GLXWindow. @@ -2626,9 +2637,12 @@ int __glXUseXFont(__GLXclientState *cl, GLbyte *pc) ** Font can actually be either the ID of a font or the ID of a GC ** containing a font. */ - pFont = (FontPtr)LookupIDByType(req->font, RT_FONT); + dixLookupResource((pointer) &pFont, req->font, RT_FONT, + NullClient, DixUnknownAccess); if (!pFont) { - GC *pGC = (GC *)LookupIDByType(req->font, RT_GC); + GC *pGC; + dixLookupResource((pointer) &pGC, req->font, RT_GC, + NullClient, DixUnknownAccess); if (!pGC) { client->errorValue = req->font; return BadFont; @@ -2878,6 +2892,7 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc) VisualPtr pVisual; VisualID visId; int i, rc; + pointer p; /* ** Check if windowId is valid @@ -2943,7 +2958,9 @@ int __glXCreateWindow(__GLXclientState *cl, GLbyte *pc) /* ** Check if there is already a fbconfig associated with this window */ - if ( LookupIDByType(glxwindowId, __glXWindowRes) ) { + dixLookupResource(&p, glxwindowId, __glXWindowRes, + NullClient, DixUnknownAccess); + if (p) { client->errorValue = glxwindowId; return BadAlloc; } @@ -2975,11 +2992,13 @@ int __glXDestroyWindow(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; XID glxwindow = req->glxwindow; + pointer p; /* ** Check if it's a valid GLX window. */ - if (!LookupIDByType(glxwindow, __glXWindowRes)) { + dixLookupResource(&p, glxwindow, __glXWindowRes, NullClient, DixUnknownAccess); + if (!p) { client->errorValue = glxwindow; return __glXBadDrawable; } @@ -3003,7 +3022,8 @@ int __glXQueryContext(__GLXclientState *cl, GLbyte *pc) int nReplyBytes; req = (xGLXQueryContextReq *)pc; - ctx = (__GLXcontext *) LookupIDByType(req->context, __glXContextRes); + dixLookupResource((pointer) &ctx, req->context, __glXContextRes, + NullClient, DixUnknownAccess); if (!ctx) { client->errorValue = req->context; return __glXBadContext; @@ -3048,7 +3068,8 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) int nReplyBytes; req = (xGLXQueryContextInfoEXTReq *)pc; - ctx = (__GLXcontext *) SecurityLookupIDByType(client, req->context, __glXContextRes, DixReadAccess); + dixLookupResource((pointer) &ctx, req->context, __glXContextRes, + client, DixReadAccess); if (!ctx) { client->errorValue = req->context; return __glXBadContext; @@ -3213,7 +3234,8 @@ int __glXDestroyPbuffer(__GLXclientState *cl, GLbyte *pc) /* ** Check if it's a valid Pbuffer */ - pGlxPbuffer = (__glXPbuffer *)LookupIDByType(pbuffer, __glXPbufferRes); + dixLookupResource((pointer) &pGlxPbuffer, pbuffer, __glXPbufferRes, + NullClient, DixUnknownAccess); if (!pGlxPbuffer) { client->errorValue = pbuffer; return __glXBadPbuffer; @@ -3285,8 +3307,9 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, - __glXPixmapRes); + __GLXpixmap *pGlxPixmap; + dixLookupResource((pointer) &pGlxPixmap, drawId, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) { pDraw = pGlxPixmap->pDraw; screen = pGlxPixmap->pScreen->myNum; @@ -3295,7 +3318,9 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + __glXWindow *pGlxWindow; + dixLookupResource((pointer) &pGlxWindow, drawId, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) { pDraw = pGlxWindow->pDraw; screen = pGlxWindow->pScreen->myNum; @@ -3304,7 +3329,9 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes); + __glXPbuffer *pGlxPbuffer; + dixLookupResource((pointer) &pGlxPbuffer, drawId, __glXPbufferRes, + NullClient, DixUnknownAccess); if (pGlxPbuffer) { pDraw = (DrawablePtr)pGlxPbuffer; screen = pGlxPbuffer->pScreen->myNum; @@ -3331,8 +3358,8 @@ int __glXGetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #ifdef PANORAMIX if (!noPanoramiXExtension) { - pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + dixLookupResource((pointer) &pXinDraw, pDraw->id, XRC_DRAWABLE, + client, DixReadAccess); if (!pXinDraw) { client->errorValue = drawId; return __glXBadDrawable; @@ -3446,8 +3473,9 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - __GLXpixmap *pGlxPixmap = (__GLXpixmap *) LookupIDByType(drawId, - __glXPixmapRes); + __GLXpixmap *pGlxPixmap; + dixLookupResource((pointer) &pGlxPixmap, drawId, __glXPixmapRes, + NullClient, DixUnknownAccess); if (pGlxPixmap) { pDraw = pGlxPixmap->pDraw; screen = pGlxPixmap->pScreen->myNum; @@ -3456,7 +3484,9 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - __glXWindow *pGlxWindow = (__glXWindow *) LookupIDByType(drawId, __glXWindowRes); + __glXWindow *pGlxWindow; + dixLookupResource((pointer) &pGlxWindow, drawId, __glXWindowRes, + NullClient, DixUnknownAccess); if (pGlxWindow) { pDraw = pGlxWindow->pDraw; screen = pGlxWindow->pScreen->myNum; @@ -3465,7 +3495,9 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) } if (!pDraw) { - __glXPbuffer *pGlxPbuffer = (__glXPbuffer *)LookupIDByType(drawId, __glXPbufferRes); + __glXPbuffer *pGlxPbuffer; + dixLookupResource((pointer) &pGlxPbuffer, drawId, __glXPbufferRes, + NullClient, DixUnknownAccess); if (pGlxPbuffer) { pDraw = (DrawablePtr)pGlxPbuffer; screen = pGlxPbuffer->pScreen->myNum; @@ -3492,8 +3524,8 @@ int __glXChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) #ifdef PANORAMIX if (!noPanoramiXExtension) { - pXinDraw = (PanoramiXRes *) - SecurityLookupIDByClass(client, pDraw->id, XRC_DRAWABLE, DixReadAccess); + dixLookupResource((pointer) &pXinDraw, pDraw->id, XRC_DRAWABLE, + client, DixReadAccess); if (!pXinDraw) { client->errorValue = drawId; return __glXBadDrawable; diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c index b30d144..575ac34 100644 --- a/hw/dmx/glxProxy/glxext.c +++ b/hw/dmx/glxProxy/glxext.c @@ -185,9 +185,11 @@ static int PixmapGone(__GLXpixmap *pGlxPixmap, XID id) void __glXFreeGLXWindow(__glXWindow *pGlxWindow) { if (!pGlxWindow->idExists && !pGlxWindow->refcnt) { - WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw; + WindowPtr p, pWindow = (WindowPtr) pGlxWindow->pDraw; - if (LookupIDByType(pWindow->drawable.id, RT_WINDOW) == pWindow) { + dixLookupResource((pointer) &p, pWindow->drawable.id, RT_WINDOW, + NullClient, DixUnknownAccess); + if (p == pWindow) { (*pGlxWindow->pScreen->DestroyWindow)(pWindow); } diff --git a/hw/kdrive/src/kcmap.c b/hw/kdrive/src/kcmap.c index 4941ad1..3c13efb 100644 --- a/hw/kdrive/src/kcmap.c +++ b/hw/kdrive/src/kcmap.c @@ -1,5 +1,5 @@ /* - * Copyright © 1999 Keith Packard + * Copyright � 1999 Keith Packard * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -217,7 +217,8 @@ KdUninstallColormap (ColormapPtr pCmap) return; /* install default if on same fb */ - defMap = (ColormapPtr) LookupIDByType(defMapID, RT_COLORMAP); + dixLookupResource((pointer) &defMap, defMapID, RT_COLORMAP, + NullClient, DixUnknownAccess); if (defMap && KdColormapFb (defMap) == fb) (*pCmap->pScreen->InstallColormap)(defMap); else diff --git a/hw/vfb/InitOutput.c b/hw/vfb/InitOutput.c index bcfb2ef..318d167 100644 --- a/hw/vfb/InitOutput.c +++ b/hw/vfb/InitOutput.c @@ -508,8 +508,8 @@ vfbUninstallColormap(ColormapPtr pmap) { if (pmap->mid != pmap->pScreen->defColormap) { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); + dixLookupResource((pointer) &curpmap, pmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap)(curpmap); } } diff --git a/hw/xfree86/common/xf86cmap.c b/hw/xfree86/common/xf86cmap.c index be50a5c..4afaf98 100644 --- a/hw/xfree86/common/xf86cmap.c +++ b/hw/xfree86/common/xf86cmap.c @@ -210,8 +210,8 @@ Bool xf86HandleColormaps( /* get the default map */ - pDefMap = (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); - + dixLookupResource((pointer) &pDefMap, pScreen->defColormap, RT_COLORMAP, + NullClient, DixUnknownAccess); if(!CMapAllocateColormapPrivate(pDefMap)) { CMapUnwrapScreen(pScreen); return FALSE; diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c index 868fb06..1138c2a 100644 --- a/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -430,7 +430,7 @@ ProcXDGAInstallColormap(ClientPtr client) REQUEST_SIZE_MATCH(xXDGAInstallColormapReq); - cmap = (ColormapPtr)LookupIDByType(stuff->cmap, RT_COLORMAP); + dixLookupResource((pointer) &cmap, stuff->cmap, RT_COLORMAP, NullClient, DixUnknownAccess); if (cmap) { DGAInstallCmap(cmap); return (client->noClientException); @@ -871,7 +871,7 @@ ProcXF86DGAInstallColormap(ClientPtr client) if (!DGAActive(stuff->screen)) return (DGAErrorBase + XF86DGADirectNotActivated); - pcmp = (ColormapPtr )LookupIDByType(stuff->id, RT_COLORMAP); + dixLookupResource((pointer) &pcmp, stuff->id, RT_COLORMAP, NullClient, DixUnknownAccess); if (pcmp) { DGAInstallCmap(pcmp); return (client->noClientException); diff --git a/hw/xfree86/dri/dri.c b/hw/xfree86/dri/dri.c index 871b6a9..cb7c635 100644 --- a/hw/xfree86/dri/dri.c +++ b/hw/xfree86/dri/dri.c @@ -1365,7 +1365,7 @@ DRIDrawablePrivDelete(pointer pResource, XID id) WindowPtr pWin; id = (XID)pResource; - pWin = LookupIDByType(id, RT_WINDOW); + dixLookupResource((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); if (pWin) { DRIDrawablePrivPtr pDRIDrwPriv = DRI_DRAWABLE_PRIV_FROM_WINDOW(pWin); diff --git a/hw/xfree86/vgahw/vgaCmap.c b/hw/xfree86/vgahw/vgaCmap.c index 44043c6..b36ad57 100644 --- a/hw/xfree86/vgahw/vgaCmap.c +++ b/hw/xfree86/vgahw/vgaCmap.c @@ -277,8 +277,8 @@ vgaUninstallColormap(pmap) if ( pmap != miInstalledMaps[pmap->pScreen->myNum] ) return; - defColormap = (ColormapPtr) LookupIDByType( pmap->pScreen->defColormap, - RT_COLORMAP); + dixLookupResource((pointer) &defColormap, pmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); if (defColormap == miInstalledMaps[pmap->pScreen->myNum]) return; diff --git a/hw/xnest/Color.c b/hw/xnest/Color.c index 5ba0bdb..3aead6c 100644 --- a/hw/xnest/Color.c +++ b/hw/xnest/Color.c @@ -247,11 +247,11 @@ xnestSetInstalledColormapWindows(ScreenPtr pScreen) visual = xnestVisualFromID(pScreen, wVisual(pWin)); if (visual == xnestDefaultVisual(pScreen)) - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), - RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWin), RT_COLORMAP, + NullClient, DixUnknownAccess); else - pCmap = (ColormapPtr)LookupIDByType(pScreen->defColormap, - RT_COLORMAP); + dixLookupResource((pointer) &pCmap, pScreen->defColormap, RT_COLORMAP, + NullClient, DixUnknownAccess); XSetWindowColormap(xnestDisplay, xnestDefaultWindows[pScreen->myNum], @@ -302,7 +302,8 @@ xnestDirectInstallColormaps(ScreenPtr pScreen) for (i = 0; i < n; i++) { ColormapPtr pCmap; - pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); + dixLookupResource((pointer) &pCmap, pCmapIDs[i], RT_COLORMAP, + NullClient, DixUnknownAccess); if (pCmap) XInstallColormap(xnestDisplay, xnestColormap(pCmap)); } @@ -321,7 +322,8 @@ xnestDirectUninstallColormaps(ScreenPtr pScreen) for (i = 0; i < n; i++) { ColormapPtr pCmap; - pCmap = (ColormapPtr)LookupIDByType(pCmapIDs[i], RT_COLORMAP); + dixLookupResource((pointer) &pCmap, pCmapIDs[i], RT_COLORMAP, + NullClient, DixUnknownAccess); if (pCmap) XUninstallColormap(xnestDisplay, xnestColormap(pCmap)); } @@ -365,8 +367,8 @@ xnestUninstallColormap(ColormapPtr pCmap) { if (pCmap->mid != pCmap->pScreen->defColormap) { - pCurCmap = (ColormapPtr)LookupIDByType(pCmap->pScreen->defColormap, - RT_COLORMAP); + dixLookupResource((pointer) &pCurCmap, pCmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); (*pCmap->pScreen->InstallColormap)(pCurCmap); } } diff --git a/hw/xnest/Window.c b/hw/xnest/Window.c index ae3487f..5d4b268 100644 --- a/hw/xnest/Window.c +++ b/hw/xnest/Window.c @@ -93,7 +93,8 @@ xnestCreateWindow(WindowPtr pWin) visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); mask |= CWColormap; if (pWin->optional->colormap) { - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWin), RT_COLORMAP, + NullClient, DixUnknownAccess); attributes.colormap = xnestColormap(pCmap); } else @@ -104,7 +105,8 @@ xnestCreateWindow(WindowPtr pWin) } else { /* root windows have their own colormaps at creation time */ visual = xnestVisualFromID(pWin->drawable.pScreen, wVisual(pWin)); - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWin), RT_COLORMAP, + NullClient, DixUnknownAccess); mask |= CWColormap; attributes.colormap = xnestColormap(pCmap); } @@ -338,7 +340,8 @@ xnestChangeWindowAttributes(WindowPtr pWin, unsigned long mask) if (mask & CWColormap) { ColormapPtr pCmap; - pCmap = (ColormapPtr)LookupIDByType(wColormap(pWin), RT_COLORMAP); + dixLookupResource((pointer) &pCmap, wColormap(pWin), RT_COLORMAP, + NullClient, DixUnknownAccess); attributes.colormap = xnestColormap(pCmap); diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 238b90d..2ad46fa 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -217,7 +217,8 @@ WMFreeClient (data, id) WMEventPtr *pHead, pCur, pPrev; pEvent = (WMEventPtr) data; - pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); + dixLookupResource((pointer) &pHead, eventResource, EventType, + NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pEvent; pCur=pCur->next) @@ -261,8 +262,7 @@ ProcAppleWMSelectInput (register ClientPtr client) XID clientResource; REQUEST_SIZE_MATCH (xAppleWMSelectInputReq); - pHead = (WMEventPtr *)SecurityLookupIDByType(client, - eventResource, EventType, DixWriteAccess); + dixLookupResource((pointer) &pHead, eventResource, EventType, client, DixWriteAccess); if (stuff->mask != 0) { if (pHead) { /* check for existing entry. */ @@ -351,7 +351,8 @@ AppleWMSendEvent (type, mask, which, arg) ClientPtr client; xAppleWMNotifyEvent se; - pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); + dixLookupResource((pointer) &pHead, eventResource, EventType, + NullClient, DixUnknownAccess); if (!pHead) return; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { diff --git a/hw/xwin/wincmap.c b/hw/xwin/wincmap.c index 7ebe002..e6bf4a4 100644 --- a/hw/xwin/wincmap.c +++ b/hw/xwin/wincmap.c @@ -185,8 +185,8 @@ winUninstallColormap (ColormapPtr pmap) /* Install the default cmap in place of the cmap to be uninstalled */ if (pmap->mid != pmap->pScreen->defColormap) { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); + dixLookupResource((pointer) &curpmap, pmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap) (curpmap); } } diff --git a/hw/xwin/winmultiwindowicons.c b/hw/xwin/winmultiwindowicons.c index 9645718..a79abba 100644 --- a/hw/xwin/winmultiwindowicons.c +++ b/hw/xwin/winmultiwindowicons.c @@ -281,7 +281,8 @@ winXIconToHICON (WindowPtr pWin, int iconSize) winMultiWindowGetWMHints (pWin, &hints); if (!hints.icon_pixmap) return NULL; - iconPtr = (PixmapPtr) LookupIDByType (hints.icon_pixmap, RT_PIXMAP); + dixLookupResource((pointer) &iconPtr, hints.icon_pixmap, RT_PIXMAP, + NullClient, DixUnknownAccess); if (!iconPtr) return NULL; @@ -308,7 +309,8 @@ winXIconToHICON (WindowPtr pWin, int iconSize) mask = calloc (maskStride, iconSize); winScaleXBitmapToWindows (iconSize, effBPP, iconPtr, image); - maskPtr = (PixmapPtr) LookupIDByType (hints.icon_mask, RT_PIXMAP); + dixLookupResource((pointer) &maskPtr, hints.icon_mask, RT_PIXMAP, + NullClient, DixUnknownAccess); if (maskPtr) { @@ -366,7 +368,7 @@ winUpdateIcon (Window id) WindowPtr pWin; HICON hIcon, hiconOld; - pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); + dixLookupResource((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); if (!pWin) return; hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); diff --git a/hw/xwin/winmultiwindowwindow.c b/hw/xwin/winmultiwindowwindow.c index 6cad631..f10aee6 100644 --- a/hw/xwin/winmultiwindowwindow.c +++ b/hw/xwin/winmultiwindowwindow.c @@ -853,7 +853,7 @@ winMinimizeWindow (Window id) ErrorF ("winMinimizeWindow\n"); #endif - pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); + dixLookupResource((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); if (!pWin) { ErrorF("%s: NULL pWin. Leaving\n", __FUNCTION__); diff --git a/hw/xwin/winwin32rootlesswindow.c b/hw/xwin/winwin32rootlesswindow.c index dedcd7a..f66a8b5 100755 --- a/hw/xwin/winwin32rootlesswindow.c +++ b/hw/xwin/winwin32rootlesswindow.c @@ -164,7 +164,7 @@ winMWExtWMUpdateIcon (Window id) WindowPtr pWin; HICON hIcon, hiconOld; - pWin = (WindowPtr) LookupIDByType (id, RT_WINDOW); + dixLookupResource((pointer) &pWin, id, RT_WINDOW, NullClient, DixUnknownAccess); hIcon = (HICON)winOverrideIcon ((unsigned long)pWin); if (!hIcon) diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index 2eecd6b..7106991 100755 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -147,7 +147,8 @@ WMFreeClient (pointer data, XID id) WMEventPtr *pHead, pCur, pPrev; pEvent = (WMEventPtr) data; - pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); + dixLookupResource((pointer) &pHead, eventResource, EventType, + NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; @@ -192,8 +193,7 @@ ProcWindowsWMSelectInput (register ClientPtr client) XID clientResource; REQUEST_SIZE_MATCH (xWindowsWMSelectInputReq); - pHead = (WMEventPtr *)SecurityLookupIDByType(client, eventResource, - EventType, DixWriteAccess); + dixLookupResource((pointer) &pHead, eventResource, EventType, client, DixWriteAccess); if (stuff->mask != 0) { if (pHead) @@ -293,7 +293,8 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, ErrorF ("winWindowsWMSendEvent %d %d %d %d, %d %d - %d %d\n", type, mask, which, arg, x, y, w, h); #endif - pHead = (WMEventPtr *) LookupIDByType(eventResource, EventType); + dixLookupResource((pointer) &pHead, eventResource, EventType, + NullClient, DixUnknownAccess); if (!pHead) return; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) diff --git a/mi/micmap.c b/mi/micmap.c index 342756b..03b3427 100644 --- a/mi/micmap.c +++ b/mi/micmap.c @@ -83,12 +83,10 @@ miUninstallColormap(ColormapPtr pmap) int index = pmap->pScreen->myNum; ColormapPtr curpmap = miInstalledMaps[index]; - if(pmap == curpmap) - { - if (pmap->mid != pmap->pScreen->defColormap) - { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); + if(pmap == curpmap) { + if (pmap->mid != pmap->pScreen->defColormap) { + dixLookupResource((pointer) &curpmap, pmap->pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); (*pmap->pScreen->InstallColormap)(curpmap); } } diff --git a/mi/miexpose.c b/mi/miexpose.c index 04bf555..146040f 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -431,7 +431,7 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy) return; } realWin = win->info[0].id; - pWin = LookupIDByType(realWin, RT_WINDOW); + dixLookupResource((pointer) &pWin, realWin, RT_WINDOW, NullClient, DixUnknownAccess); } if(x || y || scrnum) for (i = 0; i < numRects; i++) { diff --git a/randr/randr.c b/randr/randr.c index b7c44f7..1e8515a 100644 --- a/randr/randr.c +++ b/randr/randr.c @@ -279,7 +279,8 @@ RRFreeClient (pointer data, XID id) pRREvent = (RREventPtr) data; pWin = pRREvent->window; - pHead = (RREventPtr *) LookupIDByType(pWin->drawable.id, RREventType); + dixLookupResource((pointer) &pHead, pWin->drawable.id, RREventType, + NullClient, DixUnknownAccess); if (pHead) { pPrev = 0; for (pCur = *pHead; pCur && pCur != pRREvent; pCur=pCur->next) @@ -357,7 +358,8 @@ TellChanged (WindowPtr pWin, pointer value) rrScrPriv(pScreen); int i; - pHead = (RREventPtr *) LookupIDByType (pWin->drawable.id, RREventType); + dixLookupResource((pointer) &pHead, pWin->drawable.id, RREventType, + NullClient, DixUnknownAccess); if (!pHead) return WT_WALKCHILDREN; diff --git a/randr/randrstr.h b/randr/randrstr.h index 93960e5..9baf801 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -340,16 +340,6 @@ extern _X_EXPORT RESTYPE RRClientType, RREventType; /* resource types for event extern _X_EXPORT DevPrivateKey RRClientPrivateKey; extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType; -#define LookupOutput(client,id,a) ((RROutputPtr) \ - (SecurityLookupIDByType (client, id, \ - RROutputType, a))) -#define LookupCrtc(client,id,a) ((RRCrtcPtr) \ - (SecurityLookupIDByType (client, id, \ - RRCrtcType, a))) -#define LookupMode(client,id,a) ((RRModePtr) \ - (SecurityLookupIDByType (client, id, \ - RRModeType, a))) - #define GetRRClient(pClient) ((RRClientPtr)dixLookupPrivate(&(pClient)->devPrivates, RRClientPrivateKey)) #define rrClientPriv(pClient) RRClientPtr pRRClient = GetRRClient(pClient) diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index d8aa37b..39a1a9b 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -657,7 +657,8 @@ ProcRRGetCrtcInfo (ClientPtr client) int width, height; REQUEST_SIZE_MATCH(xRRGetCrtcInfoReq); - crtc = LookupCrtc(client, stuff->crtc, DixReadAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -767,44 +768,38 @@ ProcRRSetCrtcConfig (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRRSetCrtcConfigReq); numOutputs = (stuff->length - (SIZEOF (xRRSetCrtcConfigReq) >> 2)); - crtc = LookupIDByType (stuff->crtc, RRCrtcType); - if (!crtc) - { + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + NullClient, DixUnknownAccess); + if (!crtc) { client->errorValue = stuff->crtc; return RRErrorBase + BadRRCrtc; } - if (stuff->mode == None) - { + if (stuff->mode == None) { mode = NULL; if (numOutputs > 0) return BadMatch; - } - else - { - mode = LookupIDByType (stuff->mode, RRModeType); - if (!mode) - { + } else { + dixLookupResource((pointer) &mode, stuff->mode, RRModeType, + NullClient, DixUnknownAccess); + if (!mode) { client->errorValue = stuff->mode; return RRErrorBase + BadRRMode; } if (numOutputs == 0) return BadMatch; } - if (numOutputs) - { + if (numOutputs) { outputs = xalloc (numOutputs * sizeof (RROutputPtr)); if (!outputs) return BadAlloc; - } - else + } else outputs = NULL; outputIds = (RROutput *) (stuff + 1); - for (i = 0; i < numOutputs; i++) - { - outputs[i] = (RROutputPtr) LookupIDByType (outputIds[i], RROutputType); - if (!outputs[i]) - { + for (i = 0; i < numOutputs; i++) { + dixLookupResource((pointer) &outputs[i], outputIds[i], RROutputType, + NullClient, DixUnknownAccess); + if (!outputs[i]) { client->errorValue = outputIds[i]; if (outputs) xfree (outputs); @@ -814,43 +809,36 @@ ProcRRSetCrtcConfig (ClientPtr client) for (j = 0; j < outputs[i]->numCrtcs; j++) if (outputs[i]->crtcs[j] == crtc) break; - if (j == outputs[i]->numCrtcs) - { + if (j == outputs[i]->numCrtcs) { if (outputs) xfree (outputs); return BadMatch; } /* validate mode for this output */ - for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) - { + for (j = 0; j < outputs[i]->numModes + outputs[i]->numUserModes; j++) { RRModePtr m = (j < outputs[i]->numModes ? outputs[i]->modes[j] : outputs[i]->userModes[j - outputs[i]->numModes]); if (m == mode) break; } - if (j == outputs[i]->numModes + outputs[i]->numUserModes) - { + if (j == outputs[i]->numModes + outputs[i]->numUserModes) { if (outputs) xfree (outputs); return BadMatch; } } /* validate clones */ - for (i = 0; i < numOutputs; i++) - { - for (j = 0; j < numOutputs; j++) - { + for (i = 0; i < numOutputs; i++) { + for (j = 0; j < numOutputs; j++) { int k; if (i == j) continue; - for (k = 0; k < outputs[i]->numClones; k++) - { + for (k = 0; k < outputs[i]->numClones; k++) { if (outputs[i]->clones[k] == outputs[j]) break; } - if (k == outputs[i]->numClones) - { + if (k == outputs[i]->numClones) { if (outputs) xfree (outputs); return BadMatch; @@ -864,8 +852,7 @@ ProcRRSetCrtcConfig (ClientPtr client) time = ClientTimeToServerTime(stuff->timestamp); configTime = ClientTimeToServerTime(stuff->configTimestamp); - if (!pScrPriv) - { + if (!pScrPriv) { time = currentTime; rep.status = RRSetConfigFailed; goto sendReply; @@ -908,8 +895,7 @@ ProcRRSetCrtcConfig (ClientPtr client) if (mode) { - if ((~crtc->rotations) & rotation) - { + if ((~crtc->rotations) & rotation) { /* * requested rotation or reflection not supported by screen */ @@ -927,8 +913,7 @@ ProcRRSetCrtcConfig (ClientPtr client) * then it must allow crtcs to display a subset of the screen, so * only do this check for drivers without transform support. */ - if (pScrPriv->rrScreenSetSize && !crtc->transforms) - { + if (pScrPriv->rrScreenSetSize && !crtc->transforms) { int source_width; int source_height; PictTransform transform; @@ -941,16 +926,14 @@ ProcRRSetCrtcConfig (ClientPtr client) &transform, &f_transform, &f_inverse); RRModeGetScanoutSize (mode, &transform, &source_width, &source_height); - if (stuff->x + source_width > pScreen->width) - { + if (stuff->x + source_width > pScreen->width) { client->errorValue = stuff->x; if (outputs) xfree (outputs); return BadValue; } - if (stuff->y + source_height > pScreen->height) - { + if (stuff->y + source_height > pScreen->height) { client->errorValue = stuff->y; if (outputs) xfree (outputs); @@ -964,15 +947,13 @@ ProcRRSetCrtcConfig (ClientPtr client) * Make sure the requested set-time is not older than * the last set-time */ - if (CompareTimeStamps (time, pScrPriv->lastSetTime) < 0) - { + if (CompareTimeStamps (time, pScrPriv->lastSetTime) < 0) { rep.status = RRSetConfigInvalidTime; goto sendReply; } if (!RRCrtcSet (crtc, mode, stuff->x, stuff->y, - rotation, numOutputs, outputs)) - { + rotation, numOutputs, outputs)) { rep.status = RRSetConfigFailed; goto sendReply; } @@ -988,8 +969,7 @@ sendReply: rep.sequenceNumber = client->sequence; rep.newTimestamp = pScrPriv->lastConfigTime.milliseconds; - if (client->swapped) - { + if (client->swapped) { int n; swaps(&rep.sequenceNumber, n); swapl(&rep.length, n); @@ -1014,7 +994,8 @@ ProcRRGetPanning (ClientPtr client) int n; REQUEST_SIZE_MATCH(xRRGetPanningReq); - crtc = LookupCrtc(client, stuff->crtc, DixReadAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -1086,7 +1067,8 @@ ProcRRSetPanning (ClientPtr client) int n; REQUEST_SIZE_MATCH(xRRSetPanningReq); - crtc = LookupCrtc(client, stuff->crtc, DixReadAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -1161,7 +1143,8 @@ ProcRRGetCrtcGammaSize (ClientPtr client) int n; REQUEST_SIZE_MATCH(xRRGetCrtcGammaSizeReq); - crtc = LookupCrtc (client, stuff->crtc, DixReadAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -1193,7 +1176,8 @@ ProcRRGetCrtcGamma (ClientPtr client) char *extra = NULL; REQUEST_SIZE_MATCH(xRRGetCrtcGammaReq); - crtc = LookupCrtc (client, stuff->crtc, DixReadAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixReadAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -1238,7 +1222,8 @@ ProcRRSetCrtcGamma (ClientPtr client) CARD16 *red, *green, *blue; REQUEST_AT_LEAST_SIZE(xRRSetCrtcGammaReq); - crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixWriteAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -1273,7 +1258,8 @@ ProcRRSetCrtcTransform (ClientPtr client) int nparams; REQUEST_AT_LEAST_SIZE(xRRSetCrtcTransformReq); - crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixWriteAccess); if (!crtc) return RRErrorBase + BadRRCrtc; @@ -1358,7 +1344,8 @@ ProcRRGetCrtcTransform (ClientPtr client) char *extra; REQUEST_SIZE_MATCH (xRRGetCrtcTransformReq); - crtc = LookupCrtc (client, stuff->crtc, DixWriteAccess); + dixLookupResource((pointer) &crtc, stuff->crtc, RRCrtcType, + client, DixWriteAccess); if (!crtc) return RRErrorBase + BadRRCrtc; diff --git a/randr/rrdispatch.c b/randr/rrdispatch.c index 5a2ea71..9792040 100644 --- a/randr/rrdispatch.c +++ b/randr/rrdispatch.c @@ -79,9 +79,8 @@ ProcRRSelectInput (ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); if (rc != Success) return rc; - pHead = (RREventPtr *)SecurityLookupIDByType(client, - pWin->drawable.id, RREventType, - DixWriteAccess); + dixLookupResource((pointer) &pHead, pWin->drawable.id, RREventType, + client, DixWriteAccess); if (stuff->enable & (RRScreenChangeNotifyMask| RRCrtcChangeNotifyMask| diff --git a/randr/rrmode.c b/randr/rrmode.c index 2fa4403..01418c0 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -332,9 +332,8 @@ ProcRRDestroyMode (ClientPtr client) RRModePtr mode; REQUEST_SIZE_MATCH(xRRDestroyModeReq); - mode = LookupIDByType (stuff->mode, RRModeType); - if (!mode) - { + dixLookupResource((pointer) &mode, stuff->mode, RRModeType, NullClient, DixUnknownAccess); + if (!mode) { client->errorValue = stuff->mode; return RRErrorBase + BadRRMode; } @@ -354,17 +353,15 @@ ProcRRAddOutputMode (ClientPtr client) RROutputPtr output; REQUEST_SIZE_MATCH(xRRAddOutputModeReq); - output = LookupOutput(client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, client, DixReadAccess); - if (!output) - { + if (!output) { client->errorValue = stuff->output; return RRErrorBase + BadRROutput; } - mode = LookupIDByType (stuff->mode, RRModeType); - if (!mode) - { + dixLookupResource((pointer) &mode, stuff->mode, RRModeType, NullClient, DixUnknownAccess); + if (!mode) { client->errorValue = stuff->mode; return RRErrorBase + BadRRMode; } @@ -380,17 +377,15 @@ ProcRRDeleteOutputMode (ClientPtr client) RROutputPtr output; REQUEST_SIZE_MATCH(xRRDeleteOutputModeReq); - output = LookupOutput(client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, client, DixReadAccess); - if (!output) - { + if (!output) { client->errorValue = stuff->output; return RRErrorBase + BadRROutput; } - mode = LookupIDByType (stuff->mode, RRModeType); - if (!mode) - { + dixLookupResource((pointer) &mode, stuff->mode, RRModeType, NullClient, DixUnknownAccess); + if (!mode) { client->errorValue = stuff->mode; return RRErrorBase + BadRRMode; } diff --git a/randr/rroutput.c b/randr/rroutput.c index 82c2530..c367eb0 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -448,7 +448,8 @@ ProcRRGetOutputInfo (ClientPtr client) int i, n; REQUEST_SIZE_MATCH(xRRGetOutputInfoReq); - output = LookupOutput(client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixReadAccess); if (!output) { @@ -572,8 +573,7 @@ ProcRRSetOutputPrimary(ClientPtr client) REQUEST_SIZE_MATCH(xRRSetOutputPrimaryReq); - pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW, - DixReadAccess); + dixLookupResource((pointer) &pWin, stuff->window, RT_WINDOW, client, DixReadAccess); if (!pWin) { client->errorValue = stuff->window; @@ -581,7 +581,8 @@ ProcRRSetOutputPrimary(ClientPtr client) } if (stuff->output) { - output = LookupOutput(client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixReadAccess); if (!output) { client->errorValue = stuff->output; @@ -616,8 +617,7 @@ ProcRRGetOutputPrimary(ClientPtr client) REQUEST_SIZE_MATCH(xRRGetOutputPrimaryReq); - pWin = SecurityLookupIDByType(client, stuff->window, RT_WINDOW, - DixReadAccess); + dixLookupResource((pointer) &pWin, stuff->window, RT_WINDOW, client, DixReadAccess); if (!pWin) { client->errorValue = stuff->window; diff --git a/randr/rrproperty.c b/randr/rrproperty.c index 12923a2..451152d 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -31,7 +31,8 @@ DeliverPropertyEvent(WindowPtr pWin, void *value) RREventPtr *pHead, pRREvent; ClientPtr client; - pHead = LookupIDByType(pWin->drawable.id, RREventType); + dixLookupResource((pointer) &pHead, pWin->drawable.id, RREventType, + NullClient, DixUnknownAccess); if (!pHead) return WT_WALKCHILDREN; @@ -419,7 +420,8 @@ ProcRRListOutputProperties (ClientPtr client) REQUEST_SIZE_MATCH(xRRListOutputPropertiesReq); - output = LookupOutput (client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; @@ -466,7 +468,8 @@ ProcRRQueryOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRQueryOutputPropertyReq); - output = LookupOutput (client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; @@ -513,7 +516,8 @@ ProcRRConfigureOutputProperty (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRRConfigureOutputPropertyReq); - output = LookupOutput (client, stuff->output, DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixReadAccess); if (!output) return RRErrorBase + BadRROutput; @@ -558,7 +562,8 @@ ProcRRChangeOutputProperty (ClientPtr client) totalSize = len * sizeInBytes; REQUEST_FIXED_SIZE(xRRChangeOutputPropertyReq, totalSize); - output = LookupOutput (client, stuff->output, DixWriteAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixWriteAccess); if (!output) return RRErrorBase + BadRROutput; @@ -590,7 +595,8 @@ ProcRRDeleteOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRDeleteOutputPropertyReq); UpdateCurrentTime(); - output = LookupOutput (client, stuff->output, DixWriteAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, DixWriteAccess); if (!output) return RRErrorBase + BadRROutput; @@ -619,9 +625,9 @@ ProcRRGetOutputProperty (ClientPtr client) REQUEST_SIZE_MATCH(xRRGetOutputPropertyReq); if (stuff->delete) UpdateCurrentTime(); - output = LookupOutput (client, stuff->output, - stuff->delete ? DixWriteAccess : - DixReadAccess); + dixLookupResource((pointer) &output, stuff->output, RROutputType, + client, stuff->delete ? DixWriteAccess : DixReadAccess); + if (!output) return RRErrorBase + BadRROutput; diff --git a/record/record.c b/record/record.c index f97626f..4a30460 100644 --- a/record/record.c +++ b/record/record.c @@ -127,7 +127,7 @@ static int numEnabledRCAPs; * returns an error. */ #define VERIFY_CONTEXT(_pContext, _contextid, _client) { \ - (_pContext) = (RecordContextPtr)LookupIDByType((_contextid), RTContext); \ + dixLookupResource((pointer) &_pContext, _contextid, RTContext, NullClient, DixUnknownAccess); \ if (!(_pContext)) { \ (_client)->errorValue = (_contextid); \ return RecordErrorBase + XRecordBadContext; \ @@ -1171,6 +1171,7 @@ RecordSanityCheckClientSpecifiers(XID *clientspecs, int nspecs, XID errorspec) { int i; int clientIndex; + pointer p; for (i = 0; i < nspecs; i++) { @@ -1186,7 +1187,8 @@ RecordSanityCheckClientSpecifiers(XID *clientspecs, int nspecs, XID errorspec) { if (clientspecs[i] == clients[clientIndex]->clientAsMask) continue; - if (!LookupIDByClass(clientspecs[i], RC_ANY)) + dixLookupResource(&p, clientspecs[i], RC_ANY, NullClient, DixUnknownAccess); + if (!p) return BadMatch; } else diff --git a/render/picture.c b/render/picture.c index f99c53f..96ef458 100644 --- a/render/picture.c +++ b/render/picture.c @@ -410,8 +410,8 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format) return TRUE; if (format->index.vid == pScreen->rootVisual) { - format->index.pColormap = - (ColormapPtr) LookupIDByType(pScreen->defColormap, RT_COLORMAP); + dixLookupResource((pointer) &format->index.pColormap, pScreen->defColormap, + RT_COLORMAP, NullClient, DixUnknownAccess); } else { VisualPtr pVisual = PictureFindVisual(pScreen, format->index.vid); if (CreateColormap(FakeClientID (0), pScreen, pVisual, diff --git a/render/picturestr.h b/render/picturestr.h index 194db11..8bb45e8 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -409,7 +409,7 @@ extern _X_EXPORT RESTYPE GlyphSetType; #define SetPictureWindow(w,p) dixSetPrivate(&(w)->devPrivates, PictureWindowPrivateKey, p) #define VERIFY_PICTURE(pPicture, pid, client, mode, err) {\ - pPicture = SecurityLookupIDByType(client, pid, PictureType, mode);\ + dixLookupResource((pointer) &pPicture, pid, PictureType, client, mode); \ if (!pPicture) { \ client->errorValue = pid; \ return err; \ diff --git a/render/render.c b/render/render.c index b6e9567..8b1e897 100644 --- a/render/render.c +++ b/render/render.c @@ -517,18 +517,13 @@ ProcRenderQueryPictIndexValues (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderQueryPictIndexValuesReq); - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->format, - PictFormatType, - DixReadAccess); + dixLookupResource((pointer) &pFormat, stuff->format, PictFormatType, client, DixReadAccess); - if (!pFormat) - { + if (!pFormat) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } - if (pFormat->type != PictTypeIndexed) - { + if (pFormat->type != PictTypeIndexed) { client->errorValue = stuff->format; return BadMatch; } @@ -548,10 +543,8 @@ ProcRenderQueryPictIndexValues (ClientPtr client) memcpy (reply + 1, pFormat->index.pValues, num * sizeof (xIndexValue)); - if (client->swapped) - { - for (i = 0; i < num; i++) - { + if (client->swapped) { + for (i = 0; i < num; i++) { swapl (&values[i].pixel, n); swaps (&values[i].red, n); swaps (&values[i].green, n); @@ -591,12 +584,8 @@ ProcRenderCreatePicture (ClientPtr client) if (rc != Success) return rc; - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->format, - PictFormatType, - DixReadAccess); - if (!pFormat) - { + dixLookupResource((pointer) &pFormat, stuff->format, PictFormatType, client, DixReadAccess); + if (!pFormat) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } @@ -745,8 +734,7 @@ ProcRenderTrapezoids (ClientPtr client) REQUEST(xRenderTrapezoidsReq); REQUEST_AT_LEAST_SIZE(xRenderTrapezoidsReq); - if (!PictOpValid (stuff->op)) - { + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } @@ -758,14 +746,10 @@ ProcRenderTrapezoids (ClientPtr client) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; - if (stuff->maskFormat) - { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { + if (stuff->maskFormat) { + dixLookupResource((pointer) &pFormat, stuff->maskFormat, PictFormatType, + client, DixReadAccess); + if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } @@ -792,8 +776,7 @@ ProcRenderTriangles (ClientPtr client) REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); - if (!PictOpValid (stuff->op)) - { + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } @@ -805,14 +788,10 @@ ProcRenderTriangles (ClientPtr client) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; - if (stuff->maskFormat) - { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { + if (stuff->maskFormat) { + dixLookupResource((pointer) &pFormat, stuff->maskFormat, PictFormatType, + client, DixReadAccess); + if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } @@ -839,8 +818,7 @@ ProcRenderTriStrip (ClientPtr client) REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); - if (!PictOpValid (stuff->op)) - { + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } @@ -852,14 +830,10 @@ ProcRenderTriStrip (ClientPtr client) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; - if (stuff->maskFormat) - { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { + if (stuff->maskFormat) { + dixLookupResource((pointer) &pFormat, stuff->maskFormat, PictFormatType, + client, DixReadAccess); + if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } @@ -886,8 +860,7 @@ ProcRenderTriFan (ClientPtr client) REQUEST(xRenderTrianglesReq); REQUEST_AT_LEAST_SIZE(xRenderTrianglesReq); - if (!PictOpValid (stuff->op)) - { + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } @@ -899,14 +872,10 @@ ProcRenderTriFan (ClientPtr client) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; - if (stuff->maskFormat) - { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { + if (stuff->maskFormat) { + dixLookupResource((pointer) &pFormat, stuff->maskFormat, PictFormatType, + client, DixReadAccess); + if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } @@ -953,12 +922,9 @@ ProcRenderCreateGlyphSet (ClientPtr client) REQUEST_SIZE_MATCH(xRenderCreateGlyphSetReq); LEGAL_NEW_RESOURCE(stuff->gsid, client); - format = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->format, - PictFormatType, - DixReadAccess); - if (!format) - { + dixLookupResource((pointer) &format, stuff->format, PictFormatType, + client, DixReadAccess); + if (!format) { client->errorValue = stuff->format; return RenderErrBase + BadPictFormat; } @@ -1311,8 +1277,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) case X_RenderCompositeGlyphs32: size = 4; break; } - if (!PictOpValid (stuff->op)) - { + if (!PictOpValid (stuff->op)) { client->errorValue = stuff->op; return BadValue; } @@ -1324,27 +1289,18 @@ ProcRenderCompositeGlyphs (ClientPtr client) return BadDrawable; if (pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) return BadMatch; - if (stuff->maskFormat) - { - pFormat = (PictFormatPtr) SecurityLookupIDByType (client, - stuff->maskFormat, - PictFormatType, - DixReadAccess); - if (!pFormat) - { + if (stuff->maskFormat) { + dixLookupResource((pointer) &pFormat, stuff->maskFormat, PictFormatType, + client, DixReadAccess); + if (!pFormat) { client->errorValue = stuff->maskFormat; return RenderErrBase + BadPictFormat; } - } - else + } else pFormat = 0; - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - stuff->glyphset, - GlyphSetType, - DixUseAccess); - if (!glyphSet) - { + dixLookupResource((pointer) &glyphSet, stuff->glyphset, GlyphSetType, client, DixUseAccess); + if (!glyphSet) { client->errorValue = stuff->glyphset; return RenderErrBase + BadGlyphSet; } @@ -1353,17 +1309,13 @@ ProcRenderCompositeGlyphs (ClientPtr client) end = (CARD8 *) stuff + (client->req_len << 2); nglyph = 0; nlist = 0; - while (buffer + sizeof (xGlyphElt) < end) - { + while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); - if (elt->len == 0xff) - { + if (elt->len == 0xff) { buffer += 4; - } - else - { + } else { nlist++; nglyph += elt->len; space = size * elt->len; @@ -1374,16 +1326,14 @@ ProcRenderCompositeGlyphs (ClientPtr client) } if (nglyph <= NLOCALGLYPH) glyphsBase = glyphsLocal; - else - { + else { glyphsBase = (GlyphPtr *) xalloc (nglyph * sizeof (GlyphPtr)); if (!glyphsBase) return BadAlloc; } if (nlist <= NLOCALDELTA) listsBase = listsLocal; - else - { + else { listsBase = (GlyphListPtr) xalloc (nlist * sizeof (GlyphListRec)); if (!listsBase) return BadAlloc; @@ -1391,22 +1341,15 @@ ProcRenderCompositeGlyphs (ClientPtr client) buffer = (CARD8 *) (stuff + 1); glyphs = glyphsBase; lists = listsBase; - while (buffer + sizeof (xGlyphElt) < end) - { + while (buffer + sizeof (xGlyphElt) < end) { elt = (xGlyphElt *) buffer; buffer += sizeof (xGlyphElt); - if (elt->len == 0xff) - { - if (buffer + sizeof (GlyphSet) < end) - { + if (elt->len == 0xff) { + if (buffer + sizeof (GlyphSet) < end) { memcpy(&gs, buffer, sizeof(GlyphSet)); - glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, - gs, - GlyphSetType, - DixUseAccess); - if (!glyphSet) - { + dixLookupResource((pointer) &glyphSet, gs, GlyphSetType, client, DixUseAccess); + if (!glyphSet) { client->errorValue = gs; if (glyphsBase != glyphsLocal) xfree (glyphsBase); @@ -1416,18 +1359,14 @@ ProcRenderCompositeGlyphs (ClientPtr client) } } buffer += 4; - } - else - { + } else { lists->xOff = elt->deltax; lists->yOff = elt->deltay; lists->format = glyphSet->format; lists->len = 0; n = elt->len; - while (n--) - { - if (buffer + size <= end) - { + while (n--) { + if (buffer + size <= end) { switch (size) { case 1: glyph = *((CARD8 *)buffer); break; @@ -1437,8 +1376,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) default: glyph = *((CARD32 *)buffer); break; } - if ((*glyphs = FindGlyph (glyphSet, glyph))) - { + if ((*glyphs = FindGlyph (glyphSet, glyph))) { lists->len++; glyphs++; } @@ -1899,12 +1837,9 @@ ProcRenderCreateAnimCursor (ClientPtr client) return BadAlloc; deltas = (CARD32 *) (cursors + ncursor); elt = (xAnimCursorElt *) (stuff + 1); - for (i = 0; i < ncursor; i++) - { - cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, - RT_CURSOR, DixReadAccess); - if (!cursors[i]) - { + for (i = 0; i < ncursor; i++) { + dixLookupResource((pointer) &cursors[i], elt->cursor, RT_CURSOR, client, DixReadAccess); + if (!cursors[i]) { xfree (cursors); client->errorValue = elt->cursor; return BadCursor; @@ -2688,7 +2623,7 @@ SProcRenderDispatch (ClientPtr client) #include "panoramiXsrv.h" #define VERIFY_XIN_PICTURE(pPicture, pid, client, mode, err) {\ - pPicture = SecurityLookupIDByType(client, pid, XRT_PICTURE, mode);\ + dixLookupResource((pointer) &pPicture, pid, XRT_PICTURE, client, mode); \ if (!pPicture) { \ client->errorValue = pid; \ return err; \ @@ -2715,8 +2650,8 @@ PanoramiXRenderCreatePicture (ClientPtr client) int result = Success, j; REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); - if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) + dixLookupResource((pointer) &refDraw, stuff->drawable, XRC_DRAWABLE, client, DixWriteAccess); + if(!refDraw) return BadDrawable; if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2724,11 +2659,9 @@ PanoramiXRenderCreatePicture (ClientPtr client) newPict->info[0].id = stuff->pid; if (refDraw->type == XRT_WINDOW && - stuff->drawable == WindowTable[0]->drawable.id) - { + stuff->drawable == WindowTable[0]->drawable.id) { newPict->u.pict.root = TRUE; - } - else + } else newPict->u.pict.root = FALSE; for(j = 1; j < PanoramiXNumScreens; j++) diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 2c584f9..7fe5bd8 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -65,8 +65,7 @@ static DevPrivateKey CursorScreenPrivateKey = &CursorScreenPrivateKeyIndex; static void deleteCursorHideCountsForScreen (ScreenPtr pScreen); #define VERIFY_CURSOR(pCursor, cursor, client, access) { \ - pCursor = (CursorPtr)SecurityLookupIDByType((client), (cursor), \ - RT_CURSOR, (access)); \ + dixLookupResource((pointer) &pCursor, (cursor), RT_CURSOR, (client), (access)); \ if (!pCursor) { \ (client)->errorValue = (cursor); \ return BadCursor; \ @@ -196,6 +195,7 @@ XFixesSelectCursorInput (ClientPtr pClient, CARD32 eventMask) { CursorEventPtr *prev, e; + pointer p; for (prev = &cursorEvents; (e = *prev); prev = &e->next) { @@ -228,7 +228,9 @@ XFixesSelectCursorInput (ClientPtr pClient, * Add a resource hanging from the window to * catch window destroy */ - if (!LookupIDByType(pWindow->drawable.id, CursorWindowType)) + dixLookupResource(&p, pWindow->drawable.id, CursorWindowType, + NullClient, DixUnknownAccess); + if (!p) if (!AddResource (pWindow->drawable.id, CursorWindowType, (pointer) pWindow)) { diff --git a/xfixes/select.c b/xfixes/select.c index 12a165f..d14e4e2 100644 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -134,6 +134,7 @@ XFixesSelectSelectionInput (ClientPtr pClient, { int rc; SelectionEventPtr *prev, e; + pointer p; rc = XaceHook(XACE_SELECTION_ACCESS, pClient, selection, DixGetAttrAccess); if (rc != Success) @@ -172,7 +173,9 @@ XFixesSelectSelectionInput (ClientPtr pClient, * Add a resource hanging from the window to * catch window destroy */ - if (!LookupIDByType(pWindow->drawable.id, SelectionWindowType)) + dixLookupResource(&p, pWindow->drawable.id, SelectionWindowType, + NullClient, DixUnknownAccess); + if (!p) if (!AddResource (pWindow->drawable.id, SelectionWindowType, (pointer) pWindow)) { diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h index ade2f82..4d7b9e4 100644 --- a/xfixes/xfixes.h +++ b/xfixes/xfixes.h @@ -33,7 +33,7 @@ extern _X_EXPORT RESTYPE RegionResType; extern _X_EXPORT int XFixesErrorBase; #define VERIFY_REGION(pRegion, rid, client, mode) { \ - pRegion = SecurityLookupIDByType (client, rid, RegionResType, mode); \ + dixLookupResource((pointer) &pRegion, rid, RegionResType, client, mode); \ if (!pRegion) { \ client->errorValue = rid; \ return XFixesErrorBase + BadRegion; \