xserver: Branch 'XACE-SELINUX' - 8 commits
Eamon Walsh
ewalsh at kemper.freedesktop.org
Tue Sep 25 11:47:20 PDT 2007
Xext/appgroup.c | 10 ++++++----
Xext/panoramiXprocs.c | 8 ++++----
Xext/shm.c | 14 +++++++++++---
Xext/sync.c | 16 ++++++++--------
Xext/xf86bigfont.c | 4 ++--
Xext/xvdisp.c | 12 ++++++------
dbe/dbe.c | 16 +++++++++++-----
dbe/midbe.c | 12 +++++++++---
dix/dispatch.c | 34 +++++++++++++++++-----------------
include/dix.h | 6 ++----
include/pixmapstr.h | 2 +-
include/windowstr.h | 2 +-
render/picture.c | 2 +-
13 files changed, 79 insertions(+), 59 deletions(-)
New commits:
diff-tree 9bd04055a2175ec16756d3bf73ae03b5e163a28a (from a247886b082cea93fa8f8980616a9c388ba70111)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Tue Sep 25 09:33:51 2007 -0400
xace: change prototype of VALIDATE_DRAWABLE_AND_GC macro to allow access
mode to be passed to dixLookupDrawable.
diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c
index 1c53a1e..5933c02 100644
--- a/Xext/panoramiXprocs.c
+++ b/Xext/panoramiXprocs.c
@@ -1049,8 +1049,7 @@ int PanoramiXCopyArea(ClientPtr client)
FOR_NSCREENS_BACKWARD(j) {
stuff->gc = gc->info[j].id;
- VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, pGC, client);
-
+ VALIDATE_DRAWABLE_AND_GC(dst->info[j].id, pDst, DixWriteAccess);
if(drawables[0]->depth != pDst->depth) {
client->errorValue = stuff->dstDrawable;
xfree(data);
@@ -1086,7 +1085,8 @@ int PanoramiXCopyArea(ClientPtr client)
stuff->dstY = dsty - panoramiXdataPtr[j].y;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
+
if (stuff->dstDrawable != stuff->srcDrawable) {
rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
DixReadAccess);
@@ -1195,7 +1195,7 @@ int PanoramiXCopyPlane(ClientPtr client)
stuff->dstY = dsty - panoramiXdataPtr[j].y;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable) {
rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
DixReadAccess);
diff --git a/Xext/shm.c b/Xext/shm.c
index 2afe055..ee4c340 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -795,7 +795,7 @@ ProcShmPutImage(client)
REQUEST(xShmPutImageReq);
REQUEST_SIZE_MATCH(xShmPutImageReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client);
if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse))
return BadValue;
diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c
index af2e09b..a2dac75 100644
--- a/Xext/xvdisp.c
+++ b/Xext/xvdisp.c
@@ -535,7 +535,7 @@ ProcXvPutVideo(ClientPtr client)
REQUEST(xvPutVideoReq);
REQUEST_SIZE_MATCH(xvPutVideoReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
{
@@ -581,7 +581,7 @@ ProcXvPutStill(ClientPtr client)
REQUEST(xvPutStillReq);
REQUEST_SIZE_MATCH(xvPutStillReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
{
@@ -628,7 +628,7 @@ ProcXvGetVideo(ClientPtr client)
REQUEST(xvGetVideoReq);
REQUEST_SIZE_MATCH(xvGetVideoReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
{
@@ -675,7 +675,7 @@ ProcXvGetStill(ClientPtr client)
REQUEST(xvGetStillReq);
REQUEST_SIZE_MATCH(xvGetStillReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess);
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
{
@@ -1036,7 +1036,7 @@ ProcXvPutImage(ClientPtr client)
REQUEST(xvPutImageReq);
REQUEST_AT_LEAST_SIZE(xvPutImageReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
{
@@ -1124,7 +1124,7 @@ ProcXvShmPutImage(ClientPtr client)
REQUEST(xvShmPutImageReq);
REQUEST_SIZE_MATCH(xvShmPutImageReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
if(!(pPort = LOOKUP_PORT(stuff->port, client) ))
{
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 952ef60..65eb8cc 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1791,7 +1791,7 @@ ProcCopyArea(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyAreaReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pDst, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable)
{
rc = dixLookupDrawable(&pSrc, stuff->srcDrawable, client, 0,
@@ -1832,7 +1832,7 @@ ProcCopyPlane(ClientPtr client)
REQUEST_SIZE_MATCH(xCopyPlaneReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->dstDrawable, pdstDraw, DixWriteAccess);
if (stuff->dstDrawable != stuff->srcDrawable)
{
rc = dixLookupDrawable(&psrcDraw, stuff->srcDrawable, client, 0,
@@ -1885,7 +1885,7 @@ ProcPolyPoint(ClientPtr client)
client->errorValue = stuff->coordMode;
return BadValue;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
npoint = ((client->req_len << 2) - sizeof(xPolyPointReq)) >> 2;
if (npoint)
(*pGC->ops->PolyPoint)(pDraw, pGC, stuff->coordMode, npoint,
@@ -1908,7 +1908,7 @@ ProcPolyLine(ClientPtr client)
client->errorValue = stuff->coordMode;
return BadValue;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
npoint = ((client->req_len << 2) - sizeof(xPolyLineReq)) >> 2;
if (npoint > 1)
(*pGC->ops->Polylines)(pDraw, pGC, stuff->coordMode, npoint,
@@ -1925,7 +1925,7 @@ ProcPolySegment(ClientPtr client)
REQUEST(xPolySegmentReq);
REQUEST_AT_LEAST_SIZE(xPolySegmentReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
if (nsegs & 4)
return(BadLength);
@@ -1944,7 +1944,7 @@ ProcPolyRectangle (ClientPtr client)
REQUEST(xPolyRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyRectangleReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
if (nrects & 4)
return(BadLength);
@@ -1964,7 +1964,7 @@ ProcPolyArc(ClientPtr client)
REQUEST(xPolyArcReq);
REQUEST_AT_LEAST_SIZE(xPolyArcReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
if (narcs % sizeof(xArc))
return(BadLength);
@@ -1996,7 +1996,7 @@ ProcFillPoly(ClientPtr client)
return BadValue;
}
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
things = ((client->req_len << 2) - sizeof(xFillPolyReq)) >> 2;
if (things)
(*pGC->ops->FillPolygon) (pDraw, pGC, stuff->shape,
@@ -2014,7 +2014,7 @@ ProcPolyFillRectangle(ClientPtr client)
REQUEST(xPolyFillRectangleReq);
REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
if (things & 4)
return(BadLength);
@@ -2035,7 +2035,7 @@ ProcPolyFillArc(ClientPtr client)
REQUEST(xPolyFillArcReq);
REQUEST_AT_LEAST_SIZE(xPolyFillArcReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
if (narcs % sizeof(xArc))
return(BadLength);
@@ -2110,7 +2110,7 @@ ProcPutImage(ClientPtr client)
REQUEST(xPutImageReq);
REQUEST_AT_LEAST_SIZE(xPutImageReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
if (stuff->format == XYBitmap)
{
if ((stuff->depth != 1) ||
@@ -2396,7 +2396,7 @@ ProcPolyText(ClientPtr client)
GC *pGC;
REQUEST_AT_LEAST_SIZE(xPolyTextReq);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = PolyText(client,
pDraw,
@@ -2426,7 +2426,7 @@ ProcImageText8(ClientPtr client)
REQUEST(xImageTextReq);
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = ImageText(client,
pDraw,
@@ -2456,7 +2456,7 @@ ProcImageText16(ClientPtr client)
REQUEST(xImageTextReq);
REQUEST_FIXED_SIZE(xImageTextReq, stuff->nChars << 1);
- VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, pGC, client);
+ VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
err = ImageText(client,
pDraw,
diff --git a/include/dix.h b/include/dix.h
index 54629cd..59533ba 100644
--- a/include/dix.h
+++ b/include/dix.h
@@ -81,11 +81,9 @@ SOFTWARE.
return(BadIDChoice);\
}
-#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, pGC, client)\
+#define VALIDATE_DRAWABLE_AND_GC(drawID, pDraw, mode)\
{\
- int rc;\
- rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY,\
- DixWriteAccess);\
+ int rc = dixLookupDrawable(&(pDraw), drawID, client, M_ANY, mode);\
if (rc != Success)\
return rc;\
rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
diff-tree a247886b082cea93fa8f8980616a9c388ba70111 (from f6532a81eec5f096e27285687964b77c17987f72)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Sep 20 13:06:38 2007 -0400
xace: add hooks + new access codes: XF86-Bigfont extension
diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c
index c2f891a..29f07a6 100644
--- a/Xext/xf86bigfont.c
+++ b/Xext/xf86bigfont.c
@@ -445,10 +445,10 @@ ProcXF86BigfontQueryFont(
#endif
client->errorValue = stuff->id; /* EITHER font or gc */
pFont = (FontPtr)SecurityLookupIDByType(client, stuff->id, RT_FONT,
- DixReadAccess);
+ DixGetAttrAccess);
if (!pFont) {
GC *pGC = (GC *) SecurityLookupIDByType(client, stuff->id, RT_GC,
- DixReadAccess);
+ DixGetAttrAccess);
if (!pGC) {
client->errorValue = stuff->id;
return BadFont; /* procotol spec says only error is BadFont */
diff-tree f6532a81eec5f096e27285687964b77c17987f72 (from 82f7195a628cc7ec94abc0cfe5bae2be8af443bc)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Sep 20 12:17:17 2007 -0400
xace: add hooks + new access codes: APPGROUP extension
diff --git a/Xext/appgroup.c b/Xext/appgroup.c
index 7bd2055..c40782d 100644
--- a/Xext/appgroup.c
+++ b/Xext/appgroup.c
@@ -345,7 +345,7 @@ int AttrValidate(
ColormapPtr pColormap;
rc = dixLookupWindow(&pWin, pAppGrp->default_root, client,
- DixUnknownAccess);
+ DixGetAttrAccess);
if (rc != Success)
return rc;
pScreen = pWin->drawable.pScreen;
@@ -367,8 +367,10 @@ int AttrValidate(
}
if (pAppGrp->default_colormap) {
- pColormap = (ColormapPtr)LookupIDByType (pAppGrp->default_colormap, RT_COLORMAP);
- /* XXX check that pColormap is not NULL */
+ rc = dixLookupResource((pointer *)&pColormap, pAppGrp->default_colormap,
+ RT_COLORMAP, client, DixUseAccess);
+ if (rc != Success)
+ return rc;
if (pColormap->pScreen != pScreen)
return BadColor;
if (pColormap->pVisual->vid != (pAppGrp->root_visual ? pAppGrp->root_visual : pScreen->rootVisual))
@@ -470,7 +472,7 @@ int ProcXagQuery(
int n, rc;
REQUEST_SIZE_MATCH (xXagQueryReq);
- rc = dixLookupClient(&pClient, stuff->resource, client, DixUnknownAccess);
+ rc = dixLookupClient(&pClient, stuff->resource, client, DixGetAttrAccess);
if (rc != Success)
return rc;
diff-tree 82f7195a628cc7ec94abc0cfe5bae2be8af443bc (from 661b1328cf992d8855552677a94d60de1d8ce942)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Sep 20 09:17:09 2007 -0400
xace: modifications to ChangeWindowAttributes special case: separate
Receive and SetAttr. Refer to 963e69b8efc39369915e7f0c6f370ac0d5d2b60f
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 8c68e55..952ef60 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -571,11 +571,11 @@ ProcChangeWindowAttributes(ClientPtr cli
WindowPtr pWin;
REQUEST(xChangeWindowAttributesReq);
int result, len, rc;
- Mask access_mode = DixSetAttrAccess;
+ Mask access_mode = 0;
REQUEST_AT_LEAST_SIZE(xChangeWindowAttributesReq);
- if (stuff->valueMask == CWEventMask)
- access_mode = DixReceiveAccess;
+ access_mode |= (stuff->valueMask & CWEventMask) ? DixReceiveAccess : 0;
+ access_mode |= (stuff->valueMask & ~CWEventMask) ? DixSetAttrAccess : 0;
rc = dixLookupWindow(&pWin, stuff->window, client, access_mode);
if (rc != Success)
return rc;
diff-tree 661b1328cf992d8855552677a94d60de1d8ce942 (from 90bacdef723e1e49c72775144916750758d3568c)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Sep 20 08:41:26 2007 -0400
xace: add hooks + new access codes: SYNC extension
May need to revisit this extension in the future, depending on observed use.
diff --git a/Xext/sync.c b/Xext/sync.c
index d9b6a9f..81b0cc4 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -433,18 +433,18 @@ SyncInitTrigger(client, pTrigger, counte
Mask changes;
{
SyncCounter *pCounter = pTrigger->pCounter;
- int status;
+ int rc;
Bool newcounter = FALSE;
if (changes & XSyncCACounter)
{
if (counter == None)
pCounter = NULL;
- else if (!(pCounter = (SyncCounter *)SecurityLookupIDByType(
- client, counter, RTCounter, DixReadAccess)))
+ else if (Success != (rc = dixLookupResource((pointer *)&pCounter,
+ counter, RTCounter, client, DixReadAccess)))
{
client->errorValue = counter;
- return SyncErrorBase + XSyncBadCounter;
+ return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc;
}
if (pCounter != pTrigger->pCounter)
{ /* new counter for trigger */
@@ -526,8 +526,8 @@ SyncInitTrigger(client, pTrigger, counte
*/
if (newcounter)
{
- if ((status = SyncAddTriggerToCounter(pTrigger)) != Success)
- return status;
+ if ((rc = SyncAddTriggerToCounter(pTrigger)) != Success)
+ return rc;
}
else if (IsSystemCounter(pCounter))
{
@@ -1465,7 +1465,7 @@ ProcSyncSetPriority(client)
priorityclient = client;
else {
rc = dixLookupClient(&priorityclient, stuff->id, client,
- DixUnknownAccess);
+ DixSetAttrAccess);
if (rc != Success)
return rc;
}
@@ -1502,7 +1502,7 @@ ProcSyncGetPriority(client)
priorityclient = client;
else {
rc = dixLookupClient(&priorityclient, stuff->id, client,
- DixUnknownAccess);
+ DixGetAttrAccess);
if (rc != Success)
return rc;
}
diff-tree 90bacdef723e1e49c72775144916750758d3568c (from e93cff52fed9074aa007c2e6ec6b578f69aef3cb)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Sep 20 06:53:51 2007 -0400
xace: add hooks + new access codes: MIT-SHM extension
diff --git a/Xext/shm.c b/Xext/shm.c
index 8fa5842..2afe055 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -58,6 +58,7 @@ in this Software without prior written a
#include "extnsionst.h"
#include "servermd.h"
#include "shmint.h"
+#include "xace.h"
#define _XSHM_SERVER_
#include <X11/extensions/shmstr.h>
#include <X11/Xfuncproto.h>
@@ -907,7 +908,7 @@ ProcShmGetImage(client)
return(BadValue);
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixUnknownAccess);
+ DixReadAccess);
if (rc != Success)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
@@ -1039,7 +1040,7 @@ ProcShmCreatePixmap(client)
return BadImplementation;
LEGAL_NEW_RESOURCE(stuff->pid, client);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
- DixUnknownAccess);
+ DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -1068,6 +1069,12 @@ CreatePmap:
shmdesc->addr + stuff->offset);
if (pMap)
{
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,
+ pMap, RT_NONE, NULL, DixCreateAccess);
+ if (rc != Success) {
+ pDraw->pScreen->DestroyPixmap(pMap);
+ return rc;
+ }
dixSetPrivate(&pMap->devPrivates, shmPixmapPrivate, shmdesc);
shmdesc->refcnt++;
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@@ -1076,6 +1083,7 @@ CreatePmap:
{
return(client->noClientException);
}
+ pDraw->pScreen->DestroyPixmap(pMap);
}
return (BadAlloc);
}
diff-tree e93cff52fed9074aa007c2e6ec6b578f69aef3cb (from 082c0f7fb34458ebb303cf875d1d75686eca25e6)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Wed Sep 19 14:48:20 2007 -0400
xace: add hooks + new access codes: DOUBLE-BUFFER extension
diff --git a/dbe/dbe.c b/dbe/dbe.c
index 223b0c9..8175a35 100644
--- a/dbe/dbe.c
+++ b/dbe/dbe.c
@@ -54,6 +54,7 @@
#define NEED_DBE_PROTOCOL
#include "dbestruct.h"
#include "midbe.h"
+#include "xace.h"
/* GLOBALS */
@@ -233,7 +234,7 @@ ProcDbeAllocateBackBufferName(ClientPtr
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
/* The window must be valid. */
- status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ status = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
if (status != Success)
return status;
@@ -720,7 +721,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
for (i = 0; i < stuff->n; i++)
{
rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
- DixReadAccess);
+ DixGetAttrAccess);
if (rc != Success) {
Xfree(pDrawables);
return rc;
@@ -748,7 +749,9 @@ ProcDbeGetVisualInfo(ClientPtr client)
pDrawables[i]->pScreen;
pDbeScreenPriv = DBE_SCREEN_PRIV(pScreen);
- if (!(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
+ rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
+ if ((rc != Success) ||
+ !(*pDbeScreenPriv->GetVisualInfo)(pScreen, &pScrVisInfo[i]))
{
/* We failed to alloc pScrVisInfo[i].visinfo. */
@@ -764,7 +767,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
Xfree(pDrawables);
}
- return(BadAlloc);
+ return (rc == Success) ? BadAlloc : rc;
}
/* Account for n, number of xDbeVisInfo items in list. */
@@ -877,7 +880,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
- stuff->buffer, dbeWindowPrivResType, DixReadAccess)))
+ stuff->buffer, dbeWindowPrivResType, DixGetAttrAccess)))
{
rep.attributes = None;
}
@@ -1615,6 +1618,9 @@ DbeExtensionInit(void)
CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
dbeWindowPrivResType =
CreateNewResourceType(DbeWindowPrivDelete);
+ if (!dixRegisterPrivateOffset(dbeDrawableResType,
+ offsetof(PixmapRec, devPrivates)))
+ return;
for (i = 0; i < screenInfo.numScreens; i++)
{
diff --git a/dbe/midbe.c b/dbe/midbe.c
index f26a09c..e1c7f8d 100644
--- a/dbe/midbe.c
+++ b/dbe/midbe.c
@@ -56,6 +56,7 @@
#include "gcstruct.h"
#include "inputstr.h"
#include "midbe.h"
+#include "xace.h"
#include <stdio.h>
@@ -153,6 +154,7 @@ miDbeAllocBackBufferName(WindowPtr pWin,
DbeScreenPrivPtr pDbeScreenPriv;
GCPtr pGC;
xRectangle clearRect;
+ int rc;
pScreen = pWin->drawable.pScreen;
@@ -191,14 +193,18 @@ miDbeAllocBackBufferName(WindowPtr pWin,
return(BadAlloc);
}
+ /* Security creation/labeling check. */
+ rc = XaceHook(XACE_RESOURCE_ACCESS, serverClient, bufId,
+ dbeDrawableResType, pDbeWindowPrivPriv->pBackBuffer,
+ RT_WINDOW, pWin, DixCreateAccess);
/* Make the back pixmap a DBE drawable resource. */
- if (!AddResource(bufId, dbeDrawableResType,
- (pointer)pDbeWindowPrivPriv->pBackBuffer))
+ if (rc != Success || !AddResource(bufId, dbeDrawableResType,
+ pDbeWindowPrivPriv->pBackBuffer))
{
/* free the buffer and the drawable resource */
FreeResource(bufId, RT_NONE);
- return(BadAlloc);
+ return (rc == Success) ? BadAlloc : rc;
}
diff-tree 082c0f7fb34458ebb303cf875d1d75686eca25e6 (from 5b36b64192517e2470766ce7ff1d4dc04c936fad)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Wed Sep 19 13:59:35 2007 -0400
devPrivates rework: move devPrivates field in drawable structure types
to just below the DrawableRec. Wish there were a better way to do this
but it has to be in the same place for all drawable types.
diff --git a/include/pixmapstr.h b/include/pixmapstr.h
index 4162c66..5f0e0c5 100644
--- a/include/pixmapstr.h
+++ b/include/pixmapstr.h
@@ -72,10 +72,10 @@ typedef struct _Drawable {
typedef struct _Pixmap {
DrawableRec drawable;
+ PrivateRec *devPrivates;
int refcnt;
int devKind;
DevUnion devPrivate;
- PrivateRec *devPrivates;
#ifdef COMPOSITE
short screen_x;
short screen_y;
diff --git a/include/windowstr.h b/include/windowstr.h
index ca212ad..4359481 100644
--- a/include/windowstr.h
+++ b/include/windowstr.h
@@ -124,6 +124,7 @@ typedef struct _WindowOpt {
typedef struct _Window {
DrawableRec drawable;
+ PrivateRec *devPrivates;
WindowPtr parent; /* ancestor chain */
WindowPtr nextSib; /* next lower sibling */
WindowPtr prevSib; /* next higher sibling */
@@ -160,7 +161,6 @@ typedef struct _Window {
#ifdef COMPOSITE
unsigned redirectDraw:2; /* rendering is redirected from here */
#endif
- PrivateRec *devPrivates;
} WindowRec;
/*
diff --git a/render/picture.c b/render/picture.c
index 660ef12..184edb4 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -728,7 +728,7 @@ CreatePicture (Picture pid,
/* security creation/labeling check */
*error = XaceHook(XACE_RESOURCE_ACCESS, client, pid, PictureType, pPicture,
- RC_DRAWABLE, pDrawable, DixCreateAccess|DixSetAttrAccess);
+ RT_PIXMAP, pDrawable, DixCreateAccess|DixSetAttrAccess);
if (*error != Success)
goto out;
More information about the xorg-commit
mailing list