summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2009-08-28 22:52:48 -0400
committerEamon Walsh <ewalsh@tycho.nsa.gov>2009-08-28 23:29:17 -0400
commit24716b9254fa7d609792596723a192bb044a7d3f (patch)
treef96cf17b98d82bbf630d3287e9ee9c1922f1466a /hw
parent0f3a64c3a5bce6cf3f00fe42cc7d1d3e69822945 (diff)
xace: fix up access modes in dixLookupDrawable calls from dri2.
Referencing a screen through a drawable only requires GetAttr access. Treat dri2 drawables as child windows (Add/Remove access). Treat getting buffers as intent to read/write the drawable. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/dri2/dri2ext.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c
index 029dce84e..72f9a448b 100644
--- a/hw/xfree86/dri2/dri2ext.c
+++ b/hw/xfree86/dri2/dri2ext.c
@@ -53,10 +53,10 @@ static ExtensionEntry *dri2Extension;
static RESTYPE dri2DrawableRes;
static Bool
-validDrawable(ClientPtr client, XID drawable,
+validDrawable(ClientPtr client, XID drawable, Mask access_mode,
DrawablePtr *pDrawable, int *status)
{
- *status = dixLookupDrawable(pDrawable, drawable, client, 0, DixReadAccess);
+ *status = dixLookupDrawable(pDrawable, drawable, client, 0, access_mode);
if (*status != Success) {
client->errorValue = drawable;
return FALSE;
@@ -105,7 +105,8 @@ ProcDRI2Connect(ClientPtr client)
const char *deviceName;
REQUEST_SIZE_MATCH(xDRI2ConnectReq);
- if (!validDrawable(client, stuff->window, &pDraw, &status))
+ if (!validDrawable(client, stuff->window, DixGetAttrAccess,
+ &pDraw, &status))
return status;
rep.type = X_Reply;
@@ -140,7 +141,8 @@ ProcDRI2Authenticate(ClientPtr client)
int status;
REQUEST_SIZE_MATCH(xDRI2AuthenticateReq);
- if (!validDrawable(client, stuff->window, &pDraw, &status))
+ if (!validDrawable(client, stuff->window, DixGetAttrAccess,
+ &pDraw, &status))
return status;
rep.type = X_Reply;
@@ -161,7 +163,8 @@ ProcDRI2CreateDrawable(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CreateDrawableReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixAddAccess,
+ &pDrawable, &status))
return status;
status = DRI2CreateDrawable(pDrawable);
@@ -184,7 +187,8 @@ ProcDRI2DestroyDrawable(ClientPtr client)
int status;
REQUEST_SIZE_MATCH(xDRI2DestroyDrawableReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixRemoveAccess,
+ &pDrawable, &status))
return status;
FreeResourceByType(stuff->drawable, dri2DrawableRes, FALSE);
@@ -250,7 +254,8 @@ ProcDRI2GetBuffers(ClientPtr client)
unsigned int *attachments;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * 4);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
+ &pDrawable, &status))
return status;
attachments = (unsigned int *) &stuff[1];
@@ -273,7 +278,8 @@ ProcDRI2GetBuffersWithFormat(ClientPtr client)
unsigned int *attachments;
REQUEST_FIXED_SIZE(xDRI2GetBuffersReq, stuff->count * (2 * 4));
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixReadAccess | DixWriteAccess,
+ &pDrawable, &status))
return status;
attachments = (unsigned int *) &stuff[1];
@@ -296,7 +302,8 @@ ProcDRI2CopyRegion(ClientPtr client)
REQUEST_SIZE_MATCH(xDRI2CopyRegionReq);
- if (!validDrawable(client, stuff->drawable, &pDrawable, &status))
+ if (!validDrawable(client, stuff->drawable, DixWriteAccess,
+ &pDrawable, &status))
return status;
VERIFY_REGION(pRegion, stuff->region, client, DixReadAccess);