xace: add hooks + new access codes: core protocol GC requests
This commit is contained in:
parent
9a183d7ba5
commit
42d6112ec2
|
@ -1583,15 +1583,16 @@ ProcCreateGC(ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
|
REQUEST_AT_LEAST_SIZE(xCreateGCReq);
|
||||||
client->errorValue = stuff->gc;
|
client->errorValue = stuff->gc;
|
||||||
LEGAL_NEW_RESOURCE(stuff->gc, client);
|
LEGAL_NEW_RESOURCE(stuff->gc, client);
|
||||||
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, DixReadAccess);
|
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0,
|
||||||
|
DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
len = client->req_len - (sizeof(xCreateGCReq) >> 2);
|
len = client->req_len - (sizeof(xCreateGCReq) >> 2);
|
||||||
if (len != Ones(stuff->mask))
|
if (len != Ones(stuff->mask))
|
||||||
return BadLength;
|
return BadLength;
|
||||||
pGC = (GC *)CreateGC(pDraw, stuff->mask,
|
pGC = (GC *)CreateGC(pDraw, stuff->mask, (XID *) &stuff[1], &error,
|
||||||
(XID *) &stuff[1], &error);
|
stuff->gc, client);
|
||||||
if (error != Success)
|
if (error != Success)
|
||||||
return error;
|
return error;
|
||||||
if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
|
if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
|
||||||
|
@ -1608,7 +1609,7 @@ ProcChangeGC(ClientPtr client)
|
||||||
REQUEST(xChangeGCReq);
|
REQUEST(xChangeGCReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
|
REQUEST_AT_LEAST_SIZE(xChangeGCReq);
|
||||||
|
|
||||||
result = dixLookupGC(&pGC, stuff->gc, client, DixWriteAccess);
|
result = dixLookupGC(&pGC, stuff->gc, client, DixSetAttrAccess);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -1635,10 +1636,10 @@ ProcCopyGC(ClientPtr client)
|
||||||
REQUEST(xCopyGCReq);
|
REQUEST(xCopyGCReq);
|
||||||
REQUEST_SIZE_MATCH(xCopyGCReq);
|
REQUEST_SIZE_MATCH(xCopyGCReq);
|
||||||
|
|
||||||
result = dixLookupGC(&pGC, stuff->srcGC, client, DixReadAccess);
|
result = dixLookupGC(&pGC, stuff->srcGC, client, DixGetAttrAccess);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
result = dixLookupGC(&dstGC, stuff->dstGC, client, DixWriteAccess);
|
result = dixLookupGC(&dstGC, stuff->dstGC, client, DixSetAttrAccess);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
|
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
|
||||||
|
@ -1667,7 +1668,7 @@ ProcSetDashes(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess);
|
result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
@ -1696,7 +1697,7 @@ ProcSetClipRectangles(ClientPtr client)
|
||||||
client->errorValue = stuff->ordering;
|
client->errorValue = stuff->ordering;
|
||||||
return BadValue;
|
return BadValue;
|
||||||
}
|
}
|
||||||
result = dixLookupGC(&pGC,stuff->gc, client, DixWriteAccess);
|
result = dixLookupGC(&pGC,stuff->gc, client, DixSetAttrAccess);
|
||||||
if (result != Success)
|
if (result != Success)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|
58
dix/gc.c
58
dix/gc.c
|
@ -63,6 +63,7 @@ SOFTWARE.
|
||||||
|
|
||||||
#include "privates.h"
|
#include "privates.h"
|
||||||
#include "dix.h"
|
#include "dix.h"
|
||||||
|
#include "xace.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
extern XID clientErrorValue;
|
extern XID clientErrorValue;
|
||||||
|
@ -148,7 +149,7 @@ _X_EXPORT int
|
||||||
dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion)
|
dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr pUnion)
|
||||||
{
|
{
|
||||||
BITS32 index2;
|
BITS32 index2;
|
||||||
int error = 0;
|
int rc, error = 0;
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
BITS32 maskQ;
|
BITS32 maskQ;
|
||||||
|
|
||||||
|
@ -267,14 +268,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
if (pUnion)
|
if (pUnion)
|
||||||
{
|
{
|
||||||
NEXT_PTR(PixmapPtr, pPixmap);
|
NEXT_PTR(PixmapPtr, pPixmap);
|
||||||
|
rc = Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NEXTVAL(XID, newpix);
|
NEXTVAL(XID, newpix);
|
||||||
pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
|
rc = dixLookupResource((pointer *)&pPixmap, newpix,
|
||||||
newpix, RT_PIXMAP, DixReadAccess);
|
RT_PIXMAP, client, DixReadAccess);
|
||||||
}
|
}
|
||||||
if (pPixmap)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
if ((pPixmap->drawable.depth != pGC->depth) ||
|
if ((pPixmap->drawable.depth != pGC->depth) ||
|
||||||
(pPixmap->drawable.pScreen != pGC->pScreen))
|
(pPixmap->drawable.pScreen != pGC->pScreen))
|
||||||
|
@ -293,7 +295,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clientErrorValue = newpix;
|
clientErrorValue = newpix;
|
||||||
error = BadPixmap;
|
error = (rc == BadValue) ? BadPixmap : rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -303,14 +305,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
if (pUnion)
|
if (pUnion)
|
||||||
{
|
{
|
||||||
NEXT_PTR(PixmapPtr, pPixmap);
|
NEXT_PTR(PixmapPtr, pPixmap);
|
||||||
|
rc = Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NEXTVAL(XID, newstipple)
|
NEXTVAL(XID, newstipple)
|
||||||
pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
|
rc = dixLookupResource((pointer *)&pPixmap, newstipple,
|
||||||
newstipple, RT_PIXMAP, DixReadAccess);
|
RT_PIXMAP, client, DixReadAccess);
|
||||||
}
|
}
|
||||||
if (pPixmap)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
if ((pPixmap->drawable.depth != 1) ||
|
if ((pPixmap->drawable.depth != 1) ||
|
||||||
(pPixmap->drawable.pScreen != pGC->pScreen))
|
(pPixmap->drawable.pScreen != pGC->pScreen))
|
||||||
|
@ -328,7 +331,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clientErrorValue = newstipple;
|
clientErrorValue = newstipple;
|
||||||
error = BadPixmap;
|
error = (rc == BadValue) ? BadPixmap : rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -345,14 +348,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
if (pUnion)
|
if (pUnion)
|
||||||
{
|
{
|
||||||
NEXT_PTR(FontPtr, pFont);
|
NEXT_PTR(FontPtr, pFont);
|
||||||
|
rc = Success;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
NEXTVAL(XID, newfont)
|
NEXTVAL(XID, newfont)
|
||||||
pFont = (FontPtr)SecurityLookupIDByType(client, newfont,
|
rc = dixLookupResource((pointer *)&pFont, newfont,
|
||||||
RT_FONT, DixReadAccess);
|
RT_FONT, client, DixUseAccess);
|
||||||
}
|
}
|
||||||
if (pFont)
|
if (rc == Success)
|
||||||
{
|
{
|
||||||
pFont->refcnt++;
|
pFont->refcnt++;
|
||||||
if (pGC->font)
|
if (pGC->font)
|
||||||
|
@ -362,7 +366,7 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
clientErrorValue = newfont;
|
clientErrorValue = newfont;
|
||||||
error = BadFont;
|
error = (rc == BadValue) ? BadFont : rc;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -415,9 +419,15 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
clipType = CT_NONE;
|
clipType = CT_NONE;
|
||||||
pPixmap = NullPixmap;
|
pPixmap = NullPixmap;
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
pPixmap = (PixmapPtr)SecurityLookupIDByType(client,
|
rc = dixLookupResource((pointer *)&pPixmap, pid,
|
||||||
pid, RT_PIXMAP, DixReadAccess);
|
RT_PIXMAP, client,
|
||||||
|
DixReadAccess);
|
||||||
|
if (rc != Success) {
|
||||||
|
clientErrorValue = pid;
|
||||||
|
error = (rc == BadValue) ? BadPixmap : rc;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pPixmap)
|
if (pPixmap)
|
||||||
|
@ -433,11 +443,6 @@ dixChangeGC(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32, ChangeGCValPtr
|
||||||
pPixmap->refcnt++;
|
pPixmap->refcnt++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!pUnion && (pid != None))
|
|
||||||
{
|
|
||||||
clientErrorValue = pid;
|
|
||||||
error = BadPixmap;
|
|
||||||
}
|
|
||||||
if(error == Success)
|
if(error == Success)
|
||||||
{
|
{
|
||||||
(*pGC->funcs->ChangeClip)(pGC, clipType,
|
(*pGC->funcs->ChangeClip)(pGC, clipType,
|
||||||
|
@ -601,7 +606,8 @@ AllocateGC(ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
_X_EXPORT GCPtr
|
_X_EXPORT GCPtr
|
||||||
CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus)
|
CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
|
||||||
|
XID gcid, ClientPtr client)
|
||||||
{
|
{
|
||||||
GCPtr pGC;
|
GCPtr pGC;
|
||||||
|
|
||||||
|
@ -663,6 +669,12 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus)
|
||||||
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
|
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
|
||||||
pGC->stipple->refcnt++;
|
pGC->stipple->refcnt++;
|
||||||
|
|
||||||
|
/* security creation/labeling check */
|
||||||
|
*pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC,
|
||||||
|
DixCreateAccess|DixSetAttrAccess, pGC);
|
||||||
|
if (*pStatus != Success)
|
||||||
|
goto out;
|
||||||
|
|
||||||
pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
|
pGC->stateChanges = (1 << (GCLastBit+1)) - 1;
|
||||||
if (!(*pGC->pScreen->CreateGC)(pGC))
|
if (!(*pGC->pScreen->CreateGC)(pGC))
|
||||||
*pStatus = BadAlloc;
|
*pStatus = BadAlloc;
|
||||||
|
@ -670,6 +682,8 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus)
|
||||||
*pStatus = ChangeGC(pGC, mask, pval);
|
*pStatus = ChangeGC(pGC, mask, pval);
|
||||||
else
|
else
|
||||||
*pStatus = Success;
|
*pStatus = Success;
|
||||||
|
|
||||||
|
out:
|
||||||
if (*pStatus != Success)
|
if (*pStatus != Success)
|
||||||
{
|
{
|
||||||
if (!pGC->tileIsPixel && !pGC->tile.pixmap)
|
if (!pGC->tileIsPixel && !pGC->tile.pixmap)
|
||||||
|
|
|
@ -1844,7 +1844,8 @@ xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes)
|
||||||
int status;
|
int status;
|
||||||
pval[0] = key;
|
pval[0] = key;
|
||||||
pval[1] = IncludeInferiors;
|
pval[1] = IncludeInferiors;
|
||||||
pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status);
|
pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status,
|
||||||
|
(XID)0, serverClient);
|
||||||
if(!pGC) return;
|
if(!pGC) return;
|
||||||
ValidateGC(pDraw, pGC);
|
ValidateGC(pDraw, pGC);
|
||||||
if (pPriv) pPriv->pGC = pGC;
|
if (pPriv) pPriv->pGC = pGC;
|
||||||
|
|
|
@ -88,7 +88,7 @@ SOFTWARE.
|
||||||
DixWriteAccess);\
|
DixWriteAccess);\
|
||||||
if (rc != Success)\
|
if (rc != Success)\
|
||||||
return rc;\
|
return rc;\
|
||||||
rc = dixLookupGC(&(pGC), stuff->gc, client, DixReadAccess);\
|
rc = dixLookupGC(&(pGC), stuff->gc, client, DixUseAccess);\
|
||||||
if (rc != Success)\
|
if (rc != Success)\
|
||||||
return rc;\
|
return rc;\
|
||||||
if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
|
if ((pGC->depth != pDraw->depth) || (pGC->pScreen != pDraw->pScreen))\
|
||||||
|
|
|
@ -115,7 +115,9 @@ extern GCPtr CreateGC(
|
||||||
DrawablePtr /*pDrawable*/,
|
DrawablePtr /*pDrawable*/,
|
||||||
BITS32 /*mask*/,
|
BITS32 /*mask*/,
|
||||||
XID* /*pval*/,
|
XID* /*pval*/,
|
||||||
int* /*pStatus*/);
|
int* /*pStatus*/,
|
||||||
|
XID /*gcid*/,
|
||||||
|
ClientPtr /*client*/);
|
||||||
|
|
||||||
extern int CopyGC(
|
extern int CopyGC(
|
||||||
GCPtr/*pgcSrc*/,
|
GCPtr/*pgcSrc*/,
|
||||||
|
|
|
@ -3468,7 +3468,8 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
|
||||||
|
|
||||||
/* We never want ops with the backingGC to generate GraphicsExpose */
|
/* We never want ops with the backingGC to generate GraphicsExpose */
|
||||||
pBackingGC = CreateGC ((DrawablePtr)pWindowPriv->pBackingPixmap,
|
pBackingGC = CreateGC ((DrawablePtr)pWindowPriv->pBackingPixmap,
|
||||||
GCGraphicsExposures, &noexpose, &status);
|
GCGraphicsExposures, &noexpose, &status,
|
||||||
|
(XID)0, serverClient);
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
lift_functions = TRUE;
|
lift_functions = TRUE;
|
||||||
else
|
else
|
||||||
|
|
|
@ -450,7 +450,8 @@ miDCMakeGC(
|
||||||
gcvals[0] = IncludeInferiors;
|
gcvals[0] = IncludeInferiors;
|
||||||
gcvals[1] = FALSE;
|
gcvals[1] = FALSE;
|
||||||
pGC = CreateGC((DrawablePtr)pWin,
|
pGC = CreateGC((DrawablePtr)pWin,
|
||||||
GCSubwindowMode|GCGraphicsExposures, gcvals, &status);
|
GCSubwindowMode|GCGraphicsExposures, gcvals, &status,
|
||||||
|
(XID)0, serverClient);
|
||||||
if (pGC && pWin->drawable.pScreen->DrawGuarantee)
|
if (pGC && pWin->drawable.pScreen->DrawGuarantee)
|
||||||
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);
|
(*pWin->drawable.pScreen->DrawGuarantee) (pWin, pGC, GuaranteeVisBack);
|
||||||
*ppGC = pGC;
|
*ppGC = pGC;
|
||||||
|
@ -746,7 +747,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
|
||||||
if (!pScreenPriv->pMoveGC)
|
if (!pScreenPriv->pMoveGC)
|
||||||
{
|
{
|
||||||
pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp,
|
pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp,
|
||||||
GCGraphicsExposures, &gcval, &status);
|
GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
|
||||||
if (!pScreenPriv->pMoveGC)
|
if (!pScreenPriv->pMoveGC)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -782,14 +783,14 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
|
||||||
if (!pScreenPriv->pPixSourceGC)
|
if (!pScreenPriv->pPixSourceGC)
|
||||||
{
|
{
|
||||||
pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
|
pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
|
||||||
GCGraphicsExposures, &gcval, &status);
|
GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
|
||||||
if (!pScreenPriv->pPixSourceGC)
|
if (!pScreenPriv->pPixSourceGC)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!pScreenPriv->pPixMaskGC)
|
if (!pScreenPriv->pPixMaskGC)
|
||||||
{
|
{
|
||||||
pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
|
pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
|
||||||
GCGraphicsExposures, &gcval, &status);
|
GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
|
||||||
if (!pScreenPriv->pPixMaskGC)
|
if (!pScreenPriv->pPixMaskGC)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -763,7 +763,7 @@ int what;
|
||||||
if (!ResType && !(ResType = CreateNewResourceType(tossGC)))
|
if (!ResType && !(ResType = CreateNewResourceType(tossGC)))
|
||||||
return;
|
return;
|
||||||
screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0,
|
screenContext[i] = CreateGC((DrawablePtr)pWin, (BITS32) 0,
|
||||||
(XID *)NULL, &status);
|
(XID *)NULL, &status, 0, serverClient);
|
||||||
if (!screenContext[i])
|
if (!screenContext[i])
|
||||||
return;
|
return;
|
||||||
numGCs++;
|
numGCs++;
|
||||||
|
|
|
@ -123,7 +123,7 @@ cwCreateBackingGC(GCPtr pGC, DrawablePtr pDrawable)
|
||||||
|
|
||||||
pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
|
pBackingDrawable = cwGetBackingDrawable(pDrawable, &x_off, &y_off);
|
||||||
pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures,
|
pPriv->pBackingGC = CreateGC(pBackingDrawable, GCGraphicsExposures,
|
||||||
&noexpose, &status);
|
&noexpose, &status, (XID)0, serverClient);
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue