xserver: Branch 'XACE-SELINUX' - 2 commits
Eamon Walsh
ewalsh at kemper.freedesktop.org
Thu Aug 30 15:28:28 PDT 2007
Xext/saver.c | 51 +++++++++++++++++++++++++++++++++++----------------
Xext/shape.c | 26 +++++++++++++-------------
2 files changed, 48 insertions(+), 29 deletions(-)
New commits:
diff-tree 53f346b158fa8e10de5a8777fa6d8d86f918878b (from 766c693ef3637ee6fc402df594060ed2c1346761)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Aug 30 13:20:04 2007 -0400
xace: add hooks + new access codes: SHAPE extension
diff --git a/Xext/shape.c b/Xext/shape.c
index 928eeee..0f49f73 100644
--- a/Xext/shape.c
+++ b/Xext/shape.c
@@ -323,7 +323,7 @@ ProcShapeRectangles (client)
REQUEST_AT_LEAST_SIZE (xShapeRectanglesReq);
UpdateCurrentTime();
- rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
@@ -423,7 +423,7 @@ ProcShapeMask (client)
REQUEST_SIZE_MATCH (xShapeMaskReq);
UpdateCurrentTime();
- rc = dixLookupWindow(&pWin, stuff->dest, client, DixWriteAccess);
+ rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
@@ -444,10 +444,10 @@ ProcShapeMask (client)
if (stuff->src == None)
srcRgn = 0;
else {
- pPixmap = (PixmapPtr) SecurityLookupIDByType(client, stuff->src,
- RT_PIXMAP, DixReadAccess);
- if (!pPixmap)
- return BadPixmap;
+ rc = dixLookupResource((pointer *)&pPixmap, stuff->src, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc != Success)
+ return (rc == BadValue) ? BadPixmap : rc;
if (pPixmap->drawable.pScreen != pScreen ||
pPixmap->drawable.depth != 1)
return BadMatch;
@@ -531,7 +531,7 @@ ProcShapeCombine (client)
REQUEST_SIZE_MATCH (xShapeCombineReq);
UpdateCurrentTime();
- rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pDestWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
return rc;
if (!pDestWin->optional)
@@ -552,7 +552,7 @@ ProcShapeCombine (client)
}
pScreen = pDestWin->drawable.pScreen;
- rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pSrcWin, stuff->src, client, DixGetAttrAccess);
if (rc != Success)
return rc;
switch (stuff->srcKind) {
@@ -651,7 +651,7 @@ ProcShapeOffset (client)
REQUEST_SIZE_MATCH (xShapeOffsetReq);
UpdateCurrentTime();
- rc = dixLookupWindow(&pWin, stuff->dest, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->dest, client, DixSetAttrAccess);
if (rc != Success)
return rc;
switch (stuff->destKind) {
@@ -716,7 +716,7 @@ ProcShapeQueryExtents (client)
RegionPtr region;
REQUEST_SIZE_MATCH (xShapeQueryExtentsReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
rep.type = X_Reply;
@@ -826,7 +826,7 @@ ProcShapeSelectInput (client)
int rc;
REQUEST_SIZE_MATCH (xShapeSelectInputReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess);
if (rc != Success)
return rc;
pHead = (ShapeEventPtr *)SecurityLookupIDByType(client,
@@ -999,7 +999,7 @@ ProcShapeInputSelected (client)
register int n;
REQUEST_SIZE_MATCH (xShapeInputSelectedReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
pHead = (ShapeEventPtr *) SecurityLookupIDByType(client,
@@ -1041,7 +1041,7 @@ ProcShapeGetRectangles (client)
register int n;
REQUEST_SIZE_MATCH(xShapeGetRectanglesReq);
- rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess);
+ rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
switch (stuff->kind) {
diff-tree 766c693ef3637ee6fc402df594060ed2c1346761 (from cda92bbf12107865e93c03c71b901ef51466dc31)
Author: Eamon Walsh <ewalsh at tycho.nsa.gov>
Date: Thu Aug 30 13:06:28 2007 -0400
xace: add hooks + new access codes: MIT-SCREEN-SAVER extension
diff --git a/Xext/saver.c b/Xext/saver.c
index 0042583..d282173 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -48,6 +48,7 @@ in this Software without prior written a
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
+#include "xace.h"
#ifdef PANORAMIX
#include "panoramiX.h"
#include "panoramiXsrv.h"
@@ -789,7 +790,11 @@ ProcScreenSaverQueryInfo (client)
REQUEST_SIZE_MATCH (xScreenSaverQueryInfoReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixUnknownAccess);
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
+ DixGetAttrAccess);
if (rc != Success)
return rc;
@@ -858,9 +863,15 @@ ProcScreenSaverSelectInput (client)
REQUEST_SIZE_MATCH (xScreenSaverSelectInputReq);
rc = dixLookupDrawable (&pDraw, stuff->drawable, client, 0,
- DixUnknownAccess);
+ DixGetAttrAccess);
+ if (rc != Success)
+ return rc;
+
+ rc = XaceHook(XACE_SCREENSAVER_ACCESS, client, pDraw->pScreen,
+ DixSetAttrAccess);
if (rc != Success)
return rc;
+
if (!setEventMask (pDraw->pScreen, client, stuff->eventMask))
return BadAlloc;
return Success;
@@ -894,12 +905,16 @@ ScreenSaverSetAttributes (ClientPtr clie
REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
ret = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixUnknownAccess);
+ DixGetAttrAccess);
if (ret != Success)
return ret;
pScreen = pDraw->pScreen;
pParent = WindowTable[pScreen->myNum];
+ ret = XaceHook(XACE_SCREENSAVER_ACCESS, client, pScreen, DixSetAttrAccess);
+ if (ret != Success)
+ return ret;
+
len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
if (Ones(stuff->mask) != len)
return BadLength;
@@ -1055,8 +1070,9 @@ ScreenSaverSetAttributes (ClientPtr clie
}
else
{
- pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP);
- if (pPixmap != (PixmapPtr) NULL)
+ ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ client, DixReadAccess);
+ if (ret == Success)
{
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen))
@@ -1070,7 +1086,7 @@ ScreenSaverSetAttributes (ClientPtr clie
}
else
{
- ret = BadPixmap;
+ ret = (ret == BadValue) ? BadPixmap : ret;
client->errorValue = pixID;
goto PatchUp;
}
@@ -1092,8 +1108,9 @@ ScreenSaverSetAttributes (ClientPtr clie
}
else
{
- pPixmap = (PixmapPtr)LookupIDByType(pixID, RT_PIXMAP);
- if (pPixmap)
+ ret = dixLookupResource((pointer *)&pPixmap, pixID, RT_PIXMAP,
+ client, DixReadAccess);
+ if (ret == Success)
{
if ((pPixmap->drawable.depth != depth) ||
(pPixmap->drawable.pScreen != pScreen))
@@ -1107,7 +1124,7 @@ ScreenSaverSetAttributes (ClientPtr clie
}
else
{
- ret = BadPixmap;
+ ret = (ret == BadValue) ? BadPixmap : ret;
client->errorValue = pixID;
goto PatchUp;
}
@@ -1185,10 +1202,11 @@ ScreenSaverSetAttributes (ClientPtr clie
break;
case CWColormap:
cmap = (Colormap) *pVlist;
- pCmap = (ColormapPtr)LookupIDByType(cmap, RT_COLORMAP);
- if (!pCmap)
+ ret = dixLookupResource((pointer *)&pCmap, cmap, RT_COLORMAP,
+ client, DixUseAccess);
+ if (ret != Success)
{
- ret = BadColor;
+ ret = (ret == BadValue) ? BadColor : ret;
client->errorValue = cmap;
goto PatchUp;
}
@@ -1208,10 +1226,11 @@ ScreenSaverSetAttributes (ClientPtr clie
}
else
{
- pCursor = (CursorPtr)LookupIDByType(cursorID, RT_CURSOR);
- if (!pCursor)
+ ret = dixLookupResource((pointer *)&pCursor, cursorID,
+ RT_CURSOR, client, DixUseAccess);
+ if (ret != Success)
{
- ret = BadCursor;
+ ret = (ret == BadValue) ? BadCursor : ret;
client->errorValue = cursorID;
goto PatchUp;
}
@@ -1253,7 +1272,7 @@ ScreenSaverUnsetAttributes (ClientPtr cl
REQUEST_SIZE_MATCH (xScreenSaverUnsetAttributesReq);
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
- DixUnknownAccess);
+ DixGetAttrAccess);
if (rc != Success)
return rc;
pPriv = GetScreenPrivate (pDraw->pScreen);
More information about the xorg-commit
mailing list