xserver: Branch 'master' - 5 commits

Eamon Walsh ewalsh at kemper.freedesktop.org
Fri Dec 15 02:33:55 EET 2006


 Xext/panoramiXprocs.c |   48 ++++++++++----
 Xext/shm.c            |   46 +++++++++----
 Xext/xf86bigfont.c    |    1 
 Xext/xvdisp.c         |   39 +++++------
 damageext/damageext.c |    8 +-
 dix/dispatch.c        |  169 ++++++++++++++++++++++++++++++--------------------
 include/dix.h         |  114 ++-------------------------------
 randr/rrscreen.c      |    7 +-
 render/render.c       |   19 +++--
 xfixes/region.c       |   13 ++-
 10 files changed, 228 insertions(+), 236 deletions(-)

New commits:
diff-tree 9e32bf98bc9ab17a137664d01f59a8f426f7ff3b (from 00f0705b3bb444ac934fc902cd23130f1777eab2)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 14 19:31:58 2006 -0500

    Remove now-unused macro definitions from dix.h.

diff --git a/include/dix.h b/include/dix.h
index 7dd321f..baff43f 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -81,107 +81,6 @@ SOFTWARE.
         return(BadIDChoice);\
     }
 
-/* XXX if you are using this macro, you are probably not generating Match
- * errors where appropriate */
-#define LOOKUP_DRAWABLE(did, client)\
-    ((client->lastDrawableID == did) ? \
-     client->lastDrawable : (DrawablePtr)LookupDrawable(did, client))
-
-#ifdef XACE
-
-#define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\
-    {\
-	pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \
-						      RC_DRAWABLE, mode);\
-	if (!pDraw) \
-	{\
-	    client->errorValue = did; \
-	    return BadDrawable;\
-	}\
-	if (pDraw->type == UNDRAWABLE_WINDOW)\
-	    return BadMatch;\
-    }
-
-#define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\
-    {\
-	pDraw = (DrawablePtr) SecurityLookupIDByClass(client, did, \
-						      RC_DRAWABLE, mode);\
-	if (!pDraw) \
-	{\
-	    client->errorValue = did; \
-	    return BadDrawable;\
-	}\
-    }
-
-#define SECURITY_VERIFY_GC(pGC, rid, client, mode)\
-	pGC = (GC *) SecurityLookupIDByType(client, rid, RT_GC, mode);\
-    if (!pGC)\
-    {\
-	client->errorValue = rid;\
-	return (BadGC);\
-    }
-
-#define VERIFY_DRAWABLE(pDraw, did, client)\
-	SECURITY_VERIFY_DRAWABLE(pDraw, did, client, DixUnknownAccess)
-
-#define VERIFY_GEOMETRABLE(pDraw, did, client)\
-	SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, DixUnknownAccess)
-
-#define VERIFY_GC(pGC, rid, client)\
-	SECURITY_VERIFY_GC(pGC, rid, client, DixUnknownAccess)
-
-#else /* not XACE */
-
-#define VERIFY_DRAWABLE(pDraw, did, client)\
-    if (client->lastDrawableID == did)\
-	pDraw = client->lastDrawable;\
-    else \
-    {\
-	pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\
-	if (!pDraw) \
-	{\
-	    client->errorValue = did; \
-	    return BadDrawable;\
-	}\
-	if (pDraw->type == UNDRAWABLE_WINDOW)\
-	    return BadMatch;\
-    }
-
-#define VERIFY_GEOMETRABLE(pDraw, did, client)\
-    if (client->lastDrawableID == did)\
-	pDraw = client->lastDrawable;\
-    else \
-    {\
-	pDraw = (DrawablePtr) LookupIDByClass(did, RC_DRAWABLE);\
-	if (!pDraw) \
-	{\
-	    client->errorValue = did; \
-	    return BadDrawable;\
-	}\
-    }
-
-#define VERIFY_GC(pGC, rid, client)\
-    if (client->lastGCID == rid)\
-        pGC = client->lastGC;\
-    else\
-	pGC = (GC *)LookupIDByType(rid, RT_GC);\
-    if (!pGC)\
-    {\
-	client->errorValue = rid;\
-	return (BadGC);\
-    }
-
-#define SECURITY_VERIFY_DRAWABLE(pDraw, did, client, mode)\
-	VERIFY_DRAWABLE(pDraw, did, client)
-
-#define SECURITY_VERIFY_GEOMETRABLE(pDraw, did, client, mode)\
-	VERIFY_GEOMETRABLE(pDraw, did, client)
-
-#define SECURITY_VERIFY_GC(pGC, rid, client, mode)\
-	VERIFY_GC(pGC, rid, client)
-
-#endif /* XACE */
-
 /*
  * We think that most hardware implementations of DBE will want
  * LookupID*(dbe_back_buffer_id) to return the window structure that the
diff-tree 00f0705b3bb444ac934fc902cd23130f1777eab2 (from 5e334f06a1ef89891f9df2a371e4662340bec26b)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 14 19:15:21 2006 -0500

    Remove instances of macros SECURITY_VERIFY_GEOMETRABLE and SECURITY_VERIFY_GC.

diff --git a/Xext/shm.c b/Xext/shm.c
index 4e73319..7cfaa68 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -816,8 +816,8 @@ static int
 ProcShmPutImage(client)
     register ClientPtr client;
 {
-    register GCPtr pGC;
-    register DrawablePtr pDraw;
+    GCPtr pGC;
+    DrawablePtr pDraw;
     long length;
     ShmDescPtr shmdesc;
     REQUEST(xShmPutImageReq);
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index d666044..2afb7c6 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -531,9 +531,9 @@ ProcXvQueryEncodings(ClientPtr client)
 static int
 ProcXvPutVideo(ClientPtr client)
 {
-  register DrawablePtr pDraw;
+  DrawablePtr pDraw;
   XvPortPtr pPort;
-  register GCPtr pGC;
+  GCPtr pGC;
   int status;
 
   REQUEST(xvPutVideoReq);
@@ -577,9 +577,9 @@ ProcXvPutVideo(ClientPtr client)
 static int
 ProcXvPutStill(ClientPtr client)
 {
-  register DrawablePtr pDraw;
+  DrawablePtr pDraw;
   XvPortPtr pPort;
-  register GCPtr pGC;
+  GCPtr pGC;
   int status;
 
   REQUEST(xvPutStillReq);
@@ -624,9 +624,9 @@ ProcXvPutStill(ClientPtr client)
 static int
 ProcXvGetVideo(ClientPtr client)
 {
-  register DrawablePtr pDraw;
+  DrawablePtr pDraw;
   XvPortPtr pPort;
-  register GCPtr pGC;
+  GCPtr pGC;
   int status;
 
   REQUEST(xvGetVideoReq);
@@ -671,9 +671,9 @@ ProcXvGetVideo(ClientPtr client)
 static int
 ProcXvGetStill(ClientPtr client)
 {
-  register DrawablePtr pDraw;
+  DrawablePtr pDraw;
   XvPortPtr pPort;
-  register GCPtr pGC;
+  GCPtr pGC;
   int status;
 
   REQUEST(xvGetStillReq);
diff --git a/dix/dispatch.c b/dix/dispatch.c
index a5a1d03..0421886 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -843,11 +843,15 @@ ProcCirculateWindow(register ClientPtr c
 int
 GetGeometry(register ClientPtr client, xGetGeometryReply *rep)
 {
-    register DrawablePtr pDraw;
+    DrawablePtr pDraw;
+    int rc;
     REQUEST(xResourceReq);
-
     REQUEST_SIZE_MATCH(xResourceReq);
-    SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->id, client, DixReadAccess);
+
+    rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixReadAccess);
+    if (rc != Success)
+	return rc;
+
     rep->type = X_Reply;
     rep->length = 0;
     rep->sequenceNumber = client->sequence;
@@ -1516,16 +1520,20 @@ int
 ProcCreatePixmap(register ClientPtr client)
 {
     PixmapPtr pMap;
-    register DrawablePtr pDraw;
+    DrawablePtr pDraw;
     REQUEST(xCreatePixmapReq);
     DepthPtr pDepth;
-    register int i;
+    register int i, rc;
 
     REQUEST_SIZE_MATCH(xCreatePixmapReq);
     client->errorValue = stuff->pid;
     LEGAL_NEW_RESOURCE(stuff->pid, client);
-    SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client,
-				 DixReadAccess);
+    
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
+			   DixReadAccess);
+    if (rc != Success)
+	return rc;
+
     if (!stuff->width || !stuff->height)
     {
 	client->errorValue = 0;
@@ -1625,12 +1633,15 @@ int
 ProcChangeGC(register ClientPtr client)
 {
     GC *pGC;
-    REQUEST(xChangeGCReq);
     int result;
     unsigned len;
-		
+    REQUEST(xChangeGCReq);
     REQUEST_AT_LEAST_SIZE(xChangeGCReq);
-    SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess);
+
+    result = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess);
+    if (result != Success)
+	return result;
+
     len = client->req_len -  (sizeof(xChangeGCReq) >> 2);
     if (len != Ones(stuff->mask))
         return BadLength;
@@ -1648,14 +1659,18 @@ ProcChangeGC(register ClientPtr client)
 int
 ProcCopyGC(register ClientPtr client)
 {
-    register GC *dstGC;
-    register GC *pGC;
+    GC *dstGC;
+    GC *pGC;
     int result;
     REQUEST(xCopyGCReq);
-
     REQUEST_SIZE_MATCH(xCopyGCReq);
-    SECURITY_VERIFY_GC( pGC, stuff->srcGC, client, DixReadAccess);
-    SECURITY_VERIFY_GC( dstGC, stuff->dstGC, client, DixWriteAccess);
+
+    result = dixLookupGC(&pGC, stuff->srcGC, client, DixReadAccess);
+    if (result != Success)
+	return result;
+    result = dixLookupGC(&dstGC, stuff->dstGC, client, DixWriteAccess);
+    if (result != Success)
+	return result;
     if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
         return (BadMatch);    
     result = CopyGC(pGC, dstGC, stuff->mask);
@@ -1671,7 +1686,7 @@ ProcCopyGC(register ClientPtr client)
 int
 ProcSetDashes(register ClientPtr client)
 {
-    register GC *pGC;
+    GC *pGC;
     int result;
     REQUEST(xSetDashesReq);
 
@@ -1682,7 +1697,9 @@ ProcSetDashes(register ClientPtr client)
          return BadValue;
     }
 
-    SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess);
+    result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess);
+    if (result != Success)
+	return result;
 
     result = SetDashes(pGC, stuff->dashOffset, stuff->nDashes,
 		       (unsigned char *)&stuff[1]);
@@ -1698,9 +1715,8 @@ ProcSetDashes(register ClientPtr client)
 int
 ProcSetClipRectangles(register ClientPtr client)
 {
-    int	nr;
-    int result;
-    register GC *pGC;
+    int	nr, result;
+    GC *pGC;
     REQUEST(xSetClipRectanglesReq);
 
     REQUEST_AT_LEAST_SIZE(xSetClipRectanglesReq);
@@ -1710,7 +1726,9 @@ ProcSetClipRectangles(register ClientPtr
 	client->errorValue = stuff->ordering;
         return BadValue;
     }
-    SECURITY_VERIFY_GC(pGC,stuff->gc, client, DixWriteAccess);
+    result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess);
+    if (result != Success)
+	return result;
 		 
     nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
     if (nr & 4)
@@ -1727,11 +1745,15 @@ ProcSetClipRectangles(register ClientPtr
 int
 ProcFreeGC(register ClientPtr client)
 {
-    register GC *pGC;
+    GC *pGC;
+    int rc;
     REQUEST(xResourceReq);
-
     REQUEST_SIZE_MATCH(xResourceReq);
-    SECURITY_VERIFY_GC(pGC, stuff->id, client, DixDestroyAccess);
+
+    rc = dixLookupGC(&pGC, stuff->id, client, DixDestroyAccess);
+    if (rc != Success)
+	return rc;
+
     FreeResource(stuff->id, RT_NONE);
     return(client->noClientException);
 }
@@ -1766,9 +1788,9 @@ ProcClearToBackground(register ClientPtr
 int
 ProcCopyArea(register ClientPtr client)
 {
-    register DrawablePtr pDst;
+    DrawablePtr pDst;
     DrawablePtr pSrc;
-    register GC *pGC;
+    GC *pGC;
     REQUEST(xCopyAreaReq);
     RegionPtr pRgn;
     int rc;
@@ -1811,7 +1833,7 @@ int
 ProcCopyPlane(register ClientPtr client)
 {
     DrawablePtr psrcDraw, pdstDraw;
-    register GC *pGC;
+    GC *pGC;
     REQUEST(xCopyPlaneReq);
     RegionPtr pRgn;
     int rc;
@@ -1862,8 +1884,8 @@ int
 ProcPolyPoint(register ClientPtr client)
 {
     int npoint;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolyPointReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyPointReq);
@@ -1885,8 +1907,8 @@ int
 ProcPolyLine(register ClientPtr client)
 {
     int npoint;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolyLineReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyLineReq);
@@ -1908,8 +1930,8 @@ int
 ProcPolySegment(register ClientPtr client)
 {
     int nsegs;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolySegmentReq);
 
     REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
@@ -1927,8 +1949,8 @@ int
 ProcPolyRectangle (register ClientPtr client)
 {
     int nrects;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolyRectangleReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
@@ -1947,8 +1969,8 @@ int
 ProcPolyArc(register ClientPtr client)
 {
     int		narcs;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolyArcReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyArcReq);
@@ -1966,8 +1988,8 @@ int
 ProcFillPoly(register ClientPtr client)
 {
     int          things;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xFillPolyReq);
 
     REQUEST_AT_LEAST_SIZE(xFillPolyReq);
@@ -1997,8 +2019,8 @@ int
 ProcPolyFillRectangle(register ClientPtr client)
 {
     int             things;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolyFillRectangleReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
@@ -2018,8 +2040,8 @@ int
 ProcPolyFillArc(register ClientPtr client)
 {
     int		narcs;
-    register GC *pGC;
-    register DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     REQUEST(xPolyFillArcReq);
 
     REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
@@ -2090,8 +2112,8 @@ ReformatImage (char *base, int nbytes, i
 int
 ProcPutImage(register ClientPtr client)
 {
-    register	GC *pGC;
-    register	DrawablePtr pDraw;
+    GC *pGC;
+    DrawablePtr pDraw;
     long	length; 	/* length of scanline server padded */
     long 	lengthProto; 	/* length of scanline protocol padded */
     char	*tmpImage;
@@ -2411,8 +2433,8 @@ int
 ProcImageText8(register ClientPtr client)
 {
     int	err;
-    register DrawablePtr pDraw;
-    register GC *pGC;
+    DrawablePtr pDraw;
+    GC *pGC;
 
     REQUEST(xImageTextReq);
 
@@ -2441,8 +2463,8 @@ int
 ProcImageText16(register ClientPtr client)
 {
     int	err;
-    register DrawablePtr pDraw;
-    register GC *pGC;
+    DrawablePtr pDraw;
+    GC *pGC;
 
     REQUEST(xImageTextReq);
 
@@ -3195,11 +3217,12 @@ int
 ProcQueryBestSize (register ClientPtr client)
 {
     xQueryBestSizeReply	reply;
-    register DrawablePtr pDraw;
+    DrawablePtr pDraw;
     ScreenPtr pScreen;
+    int rc;
     REQUEST(xQueryBestSizeReq);
-
     REQUEST_SIZE_MATCH(xQueryBestSizeReq);
+
     if ((stuff->class != CursorShape) && 
 	(stuff->class != TileShape) && 
 	(stuff->class != StippleShape))
@@ -3207,8 +3230,11 @@ ProcQueryBestSize (register ClientPtr cl
 	client->errorValue = stuff->class;
         return(BadValue);
     }
-    SECURITY_VERIFY_GEOMETRABLE (pDraw, stuff->drawable, client,
-				 DixReadAccess);
+
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
+			   DixReadAccess);
+    if (rc != Success)
+	return rc;
     if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
 	return (BadMatch);
     pScreen = pDraw->pScreen;
diff --git a/include/dix.h b/include/dix.h
index 09d5fef..7dd321f 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -239,10 +239,15 @@ SOFTWARE.
     if ((stuff->gc == INVALID) || (client->lastGCID != stuff->gc) ||\
 	(client->lastDrawableID != drawID))\
     {\
-	SECURITY_VERIFY_GEOMETRABLE(pDraw, drawID, client, DixWriteAccess);\
-	SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess);\
-	if ((pGC->depth != pDraw->depth) ||\
-	    (pGC->pScreen != pDraw->pScreen))\
+	int rc;\
+	rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY,\
+			       DixWriteAccess);\
+	if (rc != Success)\
+	    return rc;\
+	rc = dixLookupGC(&(pGC), stuff->gc, client, DixReadAccess);\
+	if (rc != Success)\
+	    return rc;\
+	if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
 	    return (BadMatch);\
 	client->lastDrawable = pDraw;\
 	client->lastDrawableID = drawID;\
diff --git a/xfixes/region.c b/xfixes/region.c
index a004fc0..91e9fc9 100755
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -220,12 +220,15 @@ ProcXFixesCreateRegionFromGC (ClientPtr 
 {
     RegionPtr	pRegion, pClip;
     GCPtr	pGC;
+    int 	rc;
     REQUEST (xXFixesCreateRegionFromGCReq);
 
     REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);
     LEGAL_NEW_RESOURCE (stuff->region, client);
 
-    SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixReadAccess);
+    rc = dixLookupGC(&pGC, stuff->gc, client, DixReadAccess);
+    if (rc != Success)
+	return rc;
     
     switch (pGC->clientClipType) {
     case CT_PIXMAP:
@@ -630,10 +633,14 @@ ProcXFixesSetGCClipRegion (ClientPtr cli
     GCPtr	pGC;
     RegionPtr	pRegion;
     XID		vals[2];
+    int		rc;
     REQUEST(xXFixesSetGCClipRegionReq);
-
     REQUEST_SIZE_MATCH(xXFixesSetGCClipRegionReq);
-    SECURITY_VERIFY_GC(pGC, stuff->gc, client, DixWriteAccess);
+
+    rc = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess);
+    if (rc != Success)
+	return rc;
+
     VERIFY_REGION_OR_NONE (pRegion, stuff->region, client, DixReadAccess);
 
     if (pRegion)
diff-tree 5e334f06a1ef89891f9df2a371e4662340bec26b (from 51b69ff499c05f59cb1e577c4e8abf6f7f283b3e)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 14 18:27:09 2006 -0500

    Remove instances of macros VERIFY_GEOMETRABLE and VERIFY_GC.

diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 2bf94a9..a193c41 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -531,10 +531,14 @@ int PanoramiXGetGeometry(ClientPtr clien
 {
     xGetGeometryReply 	 rep;
     DrawablePtr pDraw;
+    int rc;
     REQUEST(xResourceReq);
 
     REQUEST_SIZE_MATCH(xResourceReq);
-    VERIFY_GEOMETRABLE (pDraw, stuff->id, client);
+    rc = dixLookupDrawable(&pDraw, stuff->id, client, M_ANY, DixUnknownAccess);
+    if (rc != Success)
+	return rc;
+
     rep.type = X_Reply;
     rep.length = 0;
     rep.sequenceNumber = client->sequence;
diff --git a/Xext/shm.c b/Xext/shm.c
index 049c746..4e73319 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -727,7 +727,7 @@ ProcPanoramiXShmCreatePixmap(
     PixmapPtr pMap = NULL;
     DrawablePtr pDraw;
     DepthPtr pDepth;
-    int i, j, result;
+    int i, j, result, rc;
     ShmDescPtr shmdesc;
     REQUEST(xShmCreatePixmapReq);
     PanoramiXRes *newPix;
@@ -737,7 +737,11 @@ ProcPanoramiXShmCreatePixmap(
     if (!sharedPixmaps)
 	return BadImplementation;
     LEGAL_NEW_RESOURCE(stuff->pid, client);
-    VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
+			   DixUnknownAccess);
+    if (rc != Success)
+	return rc;
+
     VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
     if (!stuff->width || !stuff->height)
     {
@@ -1052,9 +1056,9 @@ ProcShmCreatePixmap(client)
     register ClientPtr client;
 {
     PixmapPtr pMap;
-    register DrawablePtr pDraw;
+    DrawablePtr pDraw;
     DepthPtr pDepth;
-    register int i;
+    register int i, rc;
     ShmDescPtr shmdesc;
     REQUEST(xShmCreatePixmapReq);
 
@@ -1063,7 +1067,11 @@ ProcShmCreatePixmap(client)
     if (!sharedPixmaps)
 	return BadImplementation;
     LEGAL_NEW_RESOURCE(stuff->pid, client);
-    VERIFY_GEOMETRABLE(pDraw, stuff->drawable, client);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
+			   DixUnknownAccess);
+    if (rc != Success)
+	return rc;
+
     VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
     if (!stuff->width || !stuff->height)
     {
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index 4464706..f50481f 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -447,7 +447,6 @@ ProcXF86BigfontQueryFont(
     pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
 					    DixReadAccess);
     if (!pFont) {
-	/* can't use VERIFY_GC because it might return BadGC */
 	GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
 						DixReadAccess);
         if (!pGC) {
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 8134cd5..a5a1d03 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1385,7 +1385,6 @@ ProcQueryFont(register ClientPtr client)
 					    DixReadAccess);
     if (!pFont)
     {
-	  /* can't use VERIFY_GC because it might return BadGC */
 	pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
 					    DixReadAccess);
         if (!pGC)
diff-tree 51b69ff499c05f59cb1e577c4e8abf6f7f283b3e (from 0cf75e74322e2b6a6efc7acf892e04365fde503b)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 14 17:53:43 2006 -0500

    Remove instances of macro SECURITY_VERIFY_DRAWABLE.

diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 77a2384..2bf94a9 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1069,6 +1069,7 @@ int PanoramiXCopyArea(ClientPtr client)
 	DrawablePtr pDst = NULL, pSrc = NULL;
 	GCPtr pGC = NULL;
 	RegionPtr pRgn[MAXSCREENS];
+	int rc;
 
 	FOR_NSCREENS_BACKWARD(j) {
 	    stuff->dstDrawable = dst->info[j].id;
@@ -1085,8 +1086,11 @@ int PanoramiXCopyArea(ClientPtr client)
 
 	    VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); 
 	    if (stuff->dstDrawable != stuff->srcDrawable) {
-		SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
-                                 DixReadAccess);
+		rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
+				       DixReadAccess);
+		if (rc != Success)
+		    return rc;
+
 		if ((pDst->pScreen != pSrc->pScreen) || 
 		    (pDst->depth != pSrc->depth)) {
 			client->errorValue = stuff->dstDrawable;
@@ -1137,7 +1141,7 @@ int PanoramiXCopyArea(ClientPtr client)
 
 int PanoramiXCopyPlane(ClientPtr client)
 {
-    int			j, srcx, srcy, dstx, dsty;
+    int			j, srcx, srcy, dstx, dsty, rc;
     PanoramiXRes	*gc, *src, *dst;
     Bool		srcIsRoot = FALSE;
     Bool		dstIsRoot = FALSE;
@@ -1191,8 +1195,11 @@ int PanoramiXCopyPlane(ClientPtr client)
 
 	VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
 	if (stuff->dstDrawable != stuff->srcDrawable) {
-	    SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
-                                 DixReadAccess);
+	    rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+				   DixReadAccess);
+	    if (rc != Success)
+		return rc;
+
             if (pdstDraw->pScreen != psrcDraw->pScreen) {
 		client->errorValue = stuff->dstDrawable;
 		return (BadMatch);
diff --git a/damageext/damageext.c b/damageext/damageext.c
index c8f28e9..6083693 100755
--- a/damageext/damageext.c
+++ b/damageext/damageext.c
@@ -173,13 +173,17 @@ ProcDamageCreate (ClientPtr client)
     DamageExtPtr	pDamageExt;
     DamageReportLevel	level;
     RegionPtr		pRegion;
+    int			rc;
     
     REQUEST(xDamageCreateReq);
 
     REQUEST_SIZE_MATCH(xDamageCreateReq);
     LEGAL_NEW_RESOURCE(stuff->damage, client);
-    SECURITY_VERIFY_DRAWABLE (pDrawable, stuff->drawable, client,
-			      DixReadAccess);
+    rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+			   DixReadAccess);
+    if (rc != Success)
+	return rc;
+
     switch (stuff->level) {
     case XDamageReportRawRectangles:
 	level = DamageReportRawRegion;
diff --git a/dix/dispatch.c b/dix/dispatch.c
index a3de07f..8134cd5 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1597,17 +1597,19 @@ ProcFreePixmap(register ClientPtr client
 int
 ProcCreateGC(register ClientPtr client)
 {
-    int error;
+    int error, rc;
     GC *pGC;
-    register DrawablePtr pDraw;
+    DrawablePtr pDraw;
     unsigned len;
     REQUEST(xCreateGCReq);
 
     REQUEST_AT_LEAST_SIZE(xCreateGCReq);
     client->errorValue = stuff->gc;
     LEGAL_NEW_RESOURCE(stuff->gc, client);
-    SECURITY_VERIFY_DRAWABLE (pDraw, stuff->drawable, client,
-			      DixReadAccess);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
+    if (rc != Success)
+	return rc;
+
     len = client->req_len -  (sizeof(xCreateGCReq) >> 2);
     if (len != Ones(stuff->mask))
         return BadLength;
@@ -1766,18 +1768,21 @@ int
 ProcCopyArea(register ClientPtr client)
 {
     register DrawablePtr pDst;
-    register DrawablePtr pSrc;
+    DrawablePtr pSrc;
     register GC *pGC;
     REQUEST(xCopyAreaReq);
     RegionPtr pRgn;
+    int rc;
 
     REQUEST_SIZE_MATCH(xCopyAreaReq);
 
     VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client); 
     if (stuff->dstDrawable != stuff->srcDrawable)
     {
-	SECURITY_VERIFY_DRAWABLE(pSrc, stuff->srcDrawable, client,
+	rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
 				 DixReadAccess);
+	if (rc != Success)
+	    return rc;
 	if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))
 	{
 	    client->errorValue = stuff->dstDrawable;
@@ -1806,18 +1811,22 @@ ProcCopyArea(register ClientPtr client)
 int
 ProcCopyPlane(register ClientPtr client)
 {
-    register DrawablePtr psrcDraw, pdstDraw;
+    DrawablePtr psrcDraw, pdstDraw;
     register GC *pGC;
     REQUEST(xCopyPlaneReq);
     RegionPtr pRgn;
+    int rc;
 
     REQUEST_SIZE_MATCH(xCopyPlaneReq);
 
     VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
     if (stuff->dstDrawable != stuff->srcDrawable)
     {
-	SECURITY_VERIFY_DRAWABLE(psrcDraw, stuff->srcDrawable, client,
-				 DixReadAccess);
+	rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
+			       DixReadAccess);
+	if (rc != Success)
+	    return rc;
+
 	if (pdstDraw->pScreen != psrcDraw->pScreen)
 	{
 	    client->errorValue = stuff->dstDrawable;
@@ -2142,8 +2151,8 @@ DoGetImage(register ClientPtr client, in
            int x, int y, int width, int height, 
            Mask planemask, xGetImageReply **im_return)
 {
-    register DrawablePtr pDraw;
-    int			nlines, linesPerBuf;
+    DrawablePtr		pDraw;
+    int			nlines, linesPerBuf, rc;
     register int	linesDone;
     long		widthBytesLine, length;
     Mask		plane = 0;
@@ -2156,7 +2165,10 @@ DoGetImage(register ClientPtr client, in
 	client->errorValue = format;
         return(BadValue);
     }
-    SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, DixReadAccess);
+    rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
+    if (rc != Success)
+	return rc;
+
     if(pDraw->type == DRAWABLE_WINDOW)
     {
       if( /* check for being viewable */
diff --git a/randr/rrscreen.c b/randr/rrscreen.c
index b4004a3..3b9263b 100644
--- a/randr/rrscreen.c
+++ b/randr/rrscreen.c
@@ -703,7 +703,7 @@ ProcRRSetScreenConfig (ClientPtr client)
     REQUEST(xRRSetScreenConfigReq);
     xRRSetScreenConfigReply rep;
     DrawablePtr		    pDraw;
-    int			    n;
+    int			    n, rc;
     ScreenPtr		    pScreen;
     rrScrPrivPtr	    pScrPriv;
     TimeStamp		    configTime;
@@ -730,8 +730,9 @@ ProcRRSetScreenConfig (ClientPtr client)
 	has_rate = FALSE;
     }
     
-    SECURITY_VERIFY_DRAWABLE(pDraw, stuff->drawable, client,
-			     DixWriteAccess);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixWriteAccess);
+    if (rc != Success)
+	return rc;
 
     pScreen = pDraw->pScreen;
 
diff --git a/render/render.c b/render/render.c
index 51a3fa6..126d08d 100644
--- a/render/render.c
+++ b/render/render.c
@@ -614,15 +614,17 @@ ProcRenderCreatePicture (ClientPtr clien
     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,
-			     DixWriteAccess);
+    rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+			   DixWriteAccess);
+    if (rc != Success)
+	return rc;
+
     pFormat = (PictFormatPtr) SecurityLookupIDByType (client, 
 						      stuff->format,
 						      PictFormatType,
@@ -1687,14 +1689,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, DixReadAccess);
+    rc = dixLookupDrawable(&pDrawable, stuff->drawable, client, 0,
+			   DixReadAccess);
+    if (rc != Success)
+	return rc;
     
     pScreen = pDrawable->pScreen;
     nbytesName = 0;
diff-tree 0cf75e74322e2b6a6efc7acf892e04365fde503b (from ab1886df73b73360fa3bd7ce8e01affc074cbc8d)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date:   Thu Dec 14 17:27:12 2006 -0500

    Remove instances of macros LOOKUP_DRAWABLE and VERIFY_DRAWABLE.

diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 6833084..77a2384 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1028,10 +1028,14 @@ int PanoramiXCopyArea(ClientPtr client)
 	DrawablePtr pDst;
 	GCPtr pGC;
         char *data;
-	int pitch;
+	int pitch, rc;
 
-	FOR_NSCREENS(j)
-	    VERIFY_DRAWABLE(drawables[j], src->info[j].id, client);
+	FOR_NSCREENS(j) {
+	    rc = dixLookupDrawable(drawables+j, src->info[j].id, client, 0,
+				   DixUnknownAccess);
+	    if (rc != Success)
+		return rc;
+	}
 
 	pitch = PixmapBytePad(stuff->width, drawables[0]->depth); 
 	if(!(data = xcalloc(1, stuff->height * pitch)))
@@ -1754,7 +1758,7 @@ int PanoramiXGetImage(ClientPtr client)
     xGetImageReply	xgi;
     Bool		isRoot;
     char		*pBuf;
-    int         	i, x, y, w, h, format;
+    int         	i, x, y, w, h, format, rc;
     Mask		plane = 0, planemask;
     int			linesDone, nlines, linesPerBuf;
     long		widthBytesLine, length;
@@ -1775,7 +1779,10 @@ int PanoramiXGetImage(ClientPtr client)
     if(draw->type == XRT_PIXMAP)
 	return (*SavedProcVector[X_GetImage])(client);
 
-    VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
+			   DixUnknownAccess);
+    if (rc != Success)
+	return rc;
 
     if(!((WindowPtr)pDraw)->realized)
 	return(BadMatch);
@@ -1809,8 +1816,12 @@ int PanoramiXGetImage(ClientPtr client)
     }
 
     drawables[0] = pDraw;
-    for(i = 1; i < PanoramiXNumScreens; i++)
-	VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+    for(i = 1; i < PanoramiXNumScreens; i++) {
+	rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0,
+			       DixUnknownAccess);
+	if (rc != Success)
+	    return rc;
+    }
 
     xgi.visual = wVisual (((WindowPtr) pDraw));
     xgi.type = X_Reply;
diff --git a/Xext/shm.c b/Xext/shm.c
index 0c2299a..049c746 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -606,7 +606,7 @@ ProcPanoramiXShmGetImage(ClientPtr clien
     DrawablePtr 	pDraw;
     xShmGetImageReply	xgi;
     ShmDescPtr		shmdesc;
-    int         	i, x, y, w, h, format;
+    int         	i, x, y, w, h, format, rc;
     Mask		plane = 0, planemask;
     long		lenPer = 0, length, widthBytesLine;
     Bool		isRoot;
@@ -627,7 +627,10 @@ ProcPanoramiXShmGetImage(ClientPtr clien
     if (draw->type == XRT_PIXMAP)
 	return ProcShmGetImage(client);
 
-    VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
+			   DixUnknownAccess);
+    if (rc != Success)
+	return rc;
 
     VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
 
@@ -660,8 +663,12 @@ ProcPanoramiXShmGetImage(ClientPtr clien
     }
 
     drawables[0] = pDraw;
-    for(i = 1; i < PanoramiXNumScreens; i++)
-	VERIFY_DRAWABLE(drawables[i], draw->info[i].id, client);
+    for(i = 1; i < PanoramiXNumScreens; i++) {
+	rc = dixLookupDrawable(drawables+i, draw->info[i].id, client, 0, 
+			       DixUnknownAccess);
+	if (rc != Success)
+	    return rc;
+    }
 
     xgi.visual = wVisual(((WindowPtr)pDraw));
     xgi.type = X_Reply;
@@ -909,12 +916,12 @@ static int
 ProcShmGetImage(client)
     register ClientPtr client;
 {
-    register DrawablePtr pDraw;
+    DrawablePtr		pDraw;
     long		lenPer = 0, length;
     Mask		plane = 0;
     xShmGetImageReply	xgi;
     ShmDescPtr		shmdesc;
-    int			n;
+    int			n, rc;
 
     REQUEST(xShmGetImageReq);
 
@@ -924,7 +931,10 @@ ProcShmGetImage(client)
 	client->errorValue = stuff->format;
         return(BadValue);
     }
-    VERIFY_DRAWABLE(pDraw, stuff->drawable, client);
+    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
+			   DixUnknownAccess);
+    if (rc != Success)
+	return rc;
     VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
     if (pDraw->type == DRAWABLE_WINDOW)
     {
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index ec2b4f8..d666044 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -717,15 +717,14 @@ ProcXvGetStill(ClientPtr client)
 static int
 ProcXvSelectVideoNotify(ClientPtr client)
 {
-  register DrawablePtr pDraw;
+  DrawablePtr pDraw;
+  int rc;
   REQUEST(xvSelectVideoNotifyReq);
   REQUEST_SIZE_MATCH(xvSelectVideoNotifyReq);
 
-  if(!(pDraw = (DrawablePtr)LOOKUP_DRAWABLE(stuff->drawable, client) ))
-    {
-      client->errorValue = stuff->drawable;
-      return (BadWindow);
-    }
+  rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess);
+  if (rc != Success)
+    return rc;
 
   return XVCALL(diSelectVideoNotify)(client, pDraw, stuff->onoff);
 
@@ -822,8 +821,8 @@ ProcXvUngrabPort(ClientPtr client)
 static int
 ProcXvStopVideo(ClientPtr client)
 {
-  int status;
-  register DrawablePtr pDraw;
+  int status, rc;
+  DrawablePtr pDraw;
   XvPortPtr pPort;
   REQUEST(xvStopVideoReq);
   REQUEST_SIZE_MATCH(xvStopVideoReq);
@@ -840,11 +839,9 @@ ProcXvStopVideo(ClientPtr client)
       return (status);
     }
 
-  if(!(pDraw = LOOKUP_DRAWABLE(stuff->drawable, client) ))
-    {
-      client->errorValue = stuff->drawable;
-      return (BadDrawable);
-    }
+  rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixUnknownAccess);
+  if (rc != Success)
+    return rc;
 
   return XVCALL(diStopVideo)(client, pPort, pDraw);
 



More information about the xorg-commit mailing list