diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-11-24 19:04:08 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2007-11-24 19:04:08 +0000 |
commit | a2e50908b04b199c1f13f67586b8ce579419d984 (patch) | |
tree | 447c4483cb17bb47c29401aefb1a77e6c90b7497 /xserver/render/render.c | |
parent | 7f7539c63f6c1d8cc96a016edff945871c68638d (diff) |
merge xserver 1.4, 1st pass
Diffstat (limited to 'xserver/render/render.c')
-rw-r--r-- | xserver/render/render.c | 137 |
1 files changed, 70 insertions, 67 deletions
diff --git a/xserver/render/render.c b/xserver/render/render.c index 6eb008c5f..b6fa10230 100644 --- a/xserver/render/render.c +++ b/xserver/render/render.c @@ -560,7 +560,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { @@ -620,19 +620,21 @@ ProcRenderCreatePicture (ClientPtr client) PicturePtr pPicture; DrawablePtr pDrawable; PictFormatPtr pFormat; - int len; - int error; + int len, error, rc; REQUEST(xRenderCreatePictureReq); REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); LEGAL_NEW_RESOURCE(stuff->pid, client); - SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, - SecurityWriteAccess); + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixWriteAccess); + if (rc != Success) + return rc; + pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->format; @@ -666,7 +668,7 @@ ProcRenderChangePicture (ClientPtr client) int len; REQUEST_AT_LEAST_SIZE(xRenderChangePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); len = client->req_len - (sizeof(xRenderChangePictureReq) >> 2); @@ -686,7 +688,7 @@ ProcRenderSetPictureClipRectangles (ClientPtr client) int result; REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -712,7 +714,7 @@ ProcRenderFreePicture (ClientPtr client) REQUEST_SIZE_MATCH(xRenderFreePictureReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityDestroyAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); FreeResource (stuff->picture, RT_NONE); return(client->noClientException); @@ -742,13 +744,13 @@ ProcRenderComposite (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_ALPHA (pMask, stuff->mask, client, SecurityReadAccess, + VERIFY_ALPHA (pMask, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); if ((pSrc->pDrawable && pSrc->pDrawable->pScreen != pDst->pDrawable->pScreen) || (pMask && pMask->pDrawable && pDst->pDrawable->pScreen != pMask->pDrawable->pScreen)) @@ -788,9 +790,9 @@ ProcRenderTrapezoids (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -801,7 +803,7 @@ ProcRenderTrapezoids (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -835,9 +837,9 @@ ProcRenderTriangles (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -848,7 +850,7 @@ ProcRenderTriangles (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -882,9 +884,9 @@ ProcRenderTriStrip (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -895,7 +897,7 @@ ProcRenderTriStrip (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -929,9 +931,9 @@ ProcRenderTriFan (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -942,7 +944,7 @@ ProcRenderTriFan (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -994,7 +996,7 @@ ProcRenderCreateGlyphSet (ClientPtr client) format = (PictFormatPtr) SecurityLookupIDByType (client, stuff->format, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!format) { client->errorValue = stuff->format; @@ -1042,7 +1044,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->existing, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->existing; @@ -1067,7 +1069,7 @@ ProcRenderFreeGlyphSet (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityDestroyAccess); + DixDestroyAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1101,7 +1103,7 @@ ProcRenderAddGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1205,7 +1207,7 @@ ProcRenderFreeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityWriteAccess); + DixWriteAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1260,9 +1262,9 @@ ProcRenderCompositeGlyphs (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -1273,7 +1275,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) pFormat = (PictFormatPtr) SecurityLookupIDByType (client, stuff->maskFormat, PictFormatType, - SecurityReadAccess); + DixReadAccess); if (!pFormat) { client->errorValue = stuff->maskFormat; @@ -1286,7 +1288,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, stuff->glyphset, GlyphSetType, - SecurityReadAccess); + DixReadAccess); if (!glyphSet) { client->errorValue = stuff->glyphset; @@ -1348,7 +1350,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client, gs, GlyphSetType, - SecurityReadAccess); + DixReadAccess); if (!glyphSet) { client->errorValue = gs; @@ -1429,7 +1431,7 @@ ProcRenderFillRectangles (ClientPtr client) client->errorValue = stuff->op; return BadValue; } - VERIFY_PICTURE (pDst, stuff->dst, client, SecurityWriteAccess, + VERIFY_PICTURE (pDst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pDst->pDrawable) return BadDrawable; @@ -1495,7 +1497,7 @@ ProcRenderCreateCursor (ClientPtr client) REQUEST_SIZE_MATCH (xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); - VERIFY_PICTURE (pSrc, stuff->src, client, SecurityReadAccess, + VERIFY_PICTURE (pSrc, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); if (!pSrc->pDrawable) return BadDrawable; @@ -1677,7 +1679,7 @@ ProcRenderSetPictureTransform (ClientPtr client) int result; REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); result = SetPictureTransform (pPicture, (PictTransform *) &stuff->transform); if (client->noClientException != Success) @@ -1696,14 +1698,15 @@ ProcRenderQueryFilters (ClientPtr client) int nnames; ScreenPtr pScreen; PictureScreenPtr ps; - int i, j; - int len; - int total_bytes; + int i, j, len, total_bytes, rc; INT16 *aliases; char *names; REQUEST_SIZE_MATCH(xRenderQueryFiltersReq); - SECURITY_VERIFY_DRAWABLE(pDrawable, stuff->drawable, client, SecurityReadAccess); + rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; pScreen = pDrawable->pScreen; nbytesName = 0; @@ -1806,7 +1809,7 @@ ProcRenderSetPictureFilter (ClientPtr client) char *name; REQUEST_AT_LEAST_SIZE (xRenderSetPictureFilterReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); name = (char *) (stuff + 1); params = (xFixed *) (name + ((stuff->nbytes + 3) & ~3)); @@ -1840,7 +1843,7 @@ ProcRenderCreateAnimCursor (ClientPtr client) for (i = 0; i < ncursor; i++) { cursors[i] = (CursorPtr)SecurityLookupIDByType(client, elt->cursor, - RT_CURSOR, SecurityReadAccess); + RT_CURSOR, DixReadAccess); if (!cursors[i]) { xfree (cursors); @@ -1868,7 +1871,7 @@ ProcRenderAddTraps (ClientPtr client) REQUEST(xRenderAddTrapsReq); REQUEST_AT_LEAST_SIZE(xRenderAddTrapsReq); - VERIFY_PICTURE (pPicture, stuff->picture, client, SecurityWriteAccess, + VERIFY_PICTURE (pPicture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); if (!pPicture->pDrawable) return BadDrawable; @@ -2625,7 +2628,7 @@ PanoramiXRenderCreatePicture (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderCreatePictureReq); if(!(refDraw = (PanoramiXRes *)SecurityLookupIDByClass( - client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess))) + client, stuff->drawable, XRC_DRAWABLE, DixWriteAccess))) return BadDrawable; if(!(newPict = (PanoramiXRes *) xalloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2667,7 +2670,7 @@ PanoramiXRenderChangePicture (ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2688,7 +2691,7 @@ PanoramiXRenderSetPictureClipRectangles (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureClipRectanglesReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2709,7 +2712,7 @@ PanoramiXRenderSetPictureTransform (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureTransformReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2730,7 +2733,7 @@ PanoramiXRenderSetPictureFilter (ClientPtr client) REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); FOR_NSCREENS_BACKWARD(j) { @@ -2753,7 +2756,7 @@ PanoramiXRenderFreePicture (ClientPtr client) client->errorValue = stuff->picture; - VERIFY_XIN_PICTURE(pict, stuff->picture, client, SecurityDestroyAccess, + VERIFY_XIN_PICTURE(pict, stuff->picture, client, DixDestroyAccess, RenderErrBase + BadPicture); @@ -2779,11 +2782,11 @@ PanoramiXRenderComposite (ClientPtr client) REQUEST_SIZE_MATCH(xRenderCompositeReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_ALPHA (msk, stuff->mask, client, SecurityReadAccess, + VERIFY_XIN_ALPHA (msk, stuff->mask, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); orig = *stuff; @@ -2827,9 +2830,9 @@ PanoramiXRenderCompositeGlyphs (ClientPtr client) INT16 xSrc, ySrc; REQUEST_AT_LEAST_SIZE(xRenderCompositeGlyphsReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); if (client->req_len << 2 >= (sizeof (xRenderCompositeGlyphsReq) + @@ -2870,7 +2873,7 @@ PanoramiXRenderFillRectangles (ClientPtr client) int extra_len; REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderFillRectanglesReq); if (extra_len && @@ -2917,9 +2920,9 @@ PanoramiXRenderTrapezoids(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTrapezoidsReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrapezoidsReq); @@ -2979,9 +2982,9 @@ PanoramiXRenderTriangles(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTrianglesReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTrianglesReq); @@ -3037,9 +3040,9 @@ PanoramiXRenderTriStrip(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTriStripReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriStripReq); @@ -3091,9 +3094,9 @@ PanoramiXRenderTriFan(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderTriFanReq); - VERIFY_XIN_PICTURE (src, stuff->src, client, SecurityReadAccess, + VERIFY_XIN_PICTURE (src, stuff->src, client, DixReadAccess, RenderErrBase + BadPicture); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderTriFanReq); @@ -3147,7 +3150,7 @@ PanoramiXRenderColorTrapezoids(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderColorTrapezoidsReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrapezoidsReq); @@ -3191,7 +3194,7 @@ PanoramiXRenderColorTriangles(ClientPtr client) REQUEST_AT_LEAST_SIZE (xRenderColorTrianglesReq); - VERIFY_XIN_PICTURE (dst, stuff->dst, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (dst, stuff->dst, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderColorTrianglesReq); @@ -3237,7 +3240,7 @@ PanoramiXRenderAddTraps (ClientPtr client) INT16 x_off, y_off; REQUEST_AT_LEAST_SIZE (xRenderAddTrapsReq); - VERIFY_XIN_PICTURE (picture, stuff->picture, client, SecurityWriteAccess, + VERIFY_XIN_PICTURE (picture, stuff->picture, client, DixWriteAccess, RenderErrBase + BadPicture); extra_len = (client->req_len << 2) - sizeof (xRenderAddTrapsReq); if (extra_len && |