diff --git a/dbe/dbe.c b/dbe/dbe.c index 69ddf4f1c..38375f92a 100644 --- a/dbe/dbe.c +++ b/dbe/dbe.c @@ -865,7 +865,7 @@ ProcDbeGetVisualInfo(ClientPtr client) xDbeGetVisualInfoReply rep; Drawable *drawables; DrawablePtr *pDrawables = NULL; - register int i, j, n; + register int i, j, n, rc; register int count; /* number of visual infos in reply */ register int length; /* length of reply */ ScreenPtr pScreen; @@ -887,11 +887,11 @@ ProcDbeGetVisualInfo(ClientPtr client) for (i = 0; i < stuff->n; i++) { - if (!(pDrawables[i] = (DrawablePtr)SecurityLookupDrawable( - drawables[i], client, DixReadAccess))) - { + rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0, + DixReadAccess); + if (rc != Success) { DEALLOCATE_LOCAL(pDrawables); - return(BadDrawable); + return rc; } } } diff --git a/hw/darwin/quartz/xpr/appledri.c b/hw/darwin/quartz/xpr/appledri.c index 585d7e1be..dd688cae3 100644 --- a/hw/darwin/quartz/xpr/appledri.c +++ b/hw/darwin/quartz/xpr/appledri.c @@ -213,6 +213,7 @@ ProcAppleDRICreateSurface( DrawablePtr pDrawable; xp_surface_id sid; unsigned int key[2]; + int rc; REQUEST(xAppleDRICreateSurfaceReq); REQUEST_SIZE_MATCH(xAppleDRICreateSurfaceReq); @@ -220,12 +221,10 @@ ProcAppleDRICreateSurface( rep.length = 0; rep.sequenceNumber = client->sequence; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; rep.key_0 = rep.key_1 = rep.uid = 0; @@ -252,13 +251,12 @@ ProcAppleDRIDestroySurface( REQUEST(xAppleDRIDestroySurfaceReq); DrawablePtr pDrawable; REQUEST_SIZE_MATCH(xAppleDRIDestroySurfaceReq); + int rc; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRIDestroySurface( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index 03e6725ff..933cd3e18 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -386,6 +386,7 @@ ProcXF86DRICreateDrawable( { xXF86DRICreateDrawableReply rep; DrawablePtr pDrawable; + int rc; REQUEST(xXF86DRICreateDrawableReq); REQUEST_SIZE_MATCH(xXF86DRICreateDrawableReq); @@ -398,12 +399,10 @@ ProcXF86DRICreateDrawable( rep.length = 0; rep.sequenceNumber = client->sequence; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRICreateDrawable( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, @@ -424,17 +423,17 @@ ProcXF86DRIDestroyDrawable( REQUEST(xXF86DRIDestroyDrawableReq); DrawablePtr pDrawable; REQUEST_SIZE_MATCH(xXF86DRIDestroyDrawableReq); + int rc; + if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRIDestroyDrawable( screenInfo.screens[stuff->screen], (Drawable)stuff->drawable, @@ -455,7 +454,7 @@ ProcXF86DRIGetDrawableInfo( int X, Y, W, H; drm_clip_rect_t * pClipRects; drm_clip_rect_t * pBackClipRects; - int backX, backY; + int backX, backY, rc; REQUEST(xXF86DRIGetDrawableInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDrawableInfoReq); @@ -468,12 +467,10 @@ ProcXF86DRIGetDrawableInfo( rep.length = 0; rep.sequenceNumber = client->sequence; - if (!(pDrawable = (DrawablePtr)SecurityLookupDrawable( - (Drawable)stuff->drawable, - client, - DixReadAccess))) { - return BadValue; - } + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; if (!DRIGetDrawableInfo( screenInfo.screens[stuff->screen], pDrawable,