xace: add hooks + new access codes: DOUBLE-BUFFER extension
This commit is contained in:
parent
082c0f7fb3
commit
e93cff52fe
16
dbe/dbe.c
16
dbe/dbe.c
|
@ -54,6 +54,7 @@
|
||||||
#define NEED_DBE_PROTOCOL
|
#define NEED_DBE_PROTOCOL
|
||||||
#include "dbestruct.h"
|
#include "dbestruct.h"
|
||||||
#include "midbe.h"
|
#include "midbe.h"
|
||||||
|
#include "xace.h"
|
||||||
|
|
||||||
/* GLOBALS */
|
/* GLOBALS */
|
||||||
|
|
||||||
|
@ -233,7 +234,7 @@ ProcDbeAllocateBackBufferName(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
|
REQUEST_SIZE_MATCH(xDbeAllocateBackBufferNameReq);
|
||||||
|
|
||||||
/* The window must be valid. */
|
/* The window must be valid. */
|
||||||
status = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess);
|
status = dixLookupWindow(&pWin, stuff->window, client, DixManageAccess);
|
||||||
if (status != Success)
|
if (status != Success)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
|
@ -720,7 +721,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
for (i = 0; i < stuff->n; i++)
|
for (i = 0; i < stuff->n; i++)
|
||||||
{
|
{
|
||||||
rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
|
rc = dixLookupDrawable(pDrawables+i, drawables[i], client, 0,
|
||||||
DixReadAccess);
|
DixGetAttrAccess);
|
||||||
if (rc != Success) {
|
if (rc != Success) {
|
||||||
Xfree(pDrawables);
|
Xfree(pDrawables);
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -748,7 +749,9 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
pDrawables[i]->pScreen;
|
pDrawables[i]->pScreen;
|
||||||
pDbeScreenPriv = DBE_SCREEN_PRIV(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. */
|
/* We failed to alloc pScrVisInfo[i].visinfo. */
|
||||||
|
|
||||||
|
@ -764,7 +767,7 @@ ProcDbeGetVisualInfo(ClientPtr client)
|
||||||
Xfree(pDrawables);
|
Xfree(pDrawables);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(BadAlloc);
|
return (rc == Success) ? BadAlloc : rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Account for n, number of xDbeVisInfo items in list. */
|
/* Account for n, number of xDbeVisInfo items in list. */
|
||||||
|
@ -877,7 +880,7 @@ ProcDbeGetBackBufferAttributes(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
|
REQUEST_SIZE_MATCH(xDbeGetBackBufferAttributesReq);
|
||||||
|
|
||||||
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
|
if (!(pDbeWindowPriv = (DbeWindowPrivPtr)SecurityLookupIDByType(client,
|
||||||
stuff->buffer, dbeWindowPrivResType, DixReadAccess)))
|
stuff->buffer, dbeWindowPrivResType, DixGetAttrAccess)))
|
||||||
{
|
{
|
||||||
rep.attributes = None;
|
rep.attributes = None;
|
||||||
}
|
}
|
||||||
|
@ -1615,6 +1618,9 @@ DbeExtensionInit(void)
|
||||||
CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
|
CreateNewResourceType(DbeDrawableDelete) | RC_DRAWABLE;
|
||||||
dbeWindowPrivResType =
|
dbeWindowPrivResType =
|
||||||
CreateNewResourceType(DbeWindowPrivDelete);
|
CreateNewResourceType(DbeWindowPrivDelete);
|
||||||
|
if (!dixRegisterPrivateOffset(dbeDrawableResType,
|
||||||
|
offsetof(PixmapRec, devPrivates)))
|
||||||
|
return;
|
||||||
|
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
{
|
{
|
||||||
|
|
12
dbe/midbe.c
12
dbe/midbe.c
|
@ -56,6 +56,7 @@
|
||||||
#include "gcstruct.h"
|
#include "gcstruct.h"
|
||||||
#include "inputstr.h"
|
#include "inputstr.h"
|
||||||
#include "midbe.h"
|
#include "midbe.h"
|
||||||
|
#include "xace.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -153,6 +154,7 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
DbeScreenPrivPtr pDbeScreenPriv;
|
DbeScreenPrivPtr pDbeScreenPriv;
|
||||||
GCPtr pGC;
|
GCPtr pGC;
|
||||||
xRectangle clearRect;
|
xRectangle clearRect;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
|
||||||
pScreen = pWin->drawable.pScreen;
|
pScreen = pWin->drawable.pScreen;
|
||||||
|
@ -191,14 +193,18 @@ miDbeAllocBackBufferName(WindowPtr pWin, XID bufId, int swapAction)
|
||||||
return(BadAlloc);
|
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. */
|
/* Make the back pixmap a DBE drawable resource. */
|
||||||
if (!AddResource(bufId, dbeDrawableResType,
|
if (rc != Success || !AddResource(bufId, dbeDrawableResType,
|
||||||
(pointer)pDbeWindowPrivPriv->pBackBuffer))
|
pDbeWindowPrivPriv->pBackBuffer))
|
||||||
{
|
{
|
||||||
/* free the buffer and the drawable resource */
|
/* free the buffer and the drawable resource */
|
||||||
FreeResource(bufId, RT_NONE);
|
FreeResource(bufId, RT_NONE);
|
||||||
return(BadAlloc);
|
return (rc == Success) ? BadAlloc : rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue