Xi: fix up access modes for calls to dixLookupDevice().
New access modes are being passed to the device access hook for XI2: DixCreateAccess for creating a new master device; DixAdd/RemoveAccess for attaching/removing slave devices to a master; and DixListProp/GetProp/SetPropAccess for device properties. Refer to the XACE-Spec document in xorg-docs, section "Device Access." Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
This commit is contained in:
parent
07c36e4fdc
commit
119b966677
|
@ -2000,7 +2000,7 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type,
|
|||
DeviceIntPtr dev;
|
||||
|
||||
dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient,
|
||||
DixReadAccess);
|
||||
DixGrabAccess);
|
||||
if (!dev)
|
||||
return;
|
||||
|
||||
|
|
|
@ -184,7 +184,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
|
|||
if (device > 255) /* FIXME: we only use 7 bit for devices? */
|
||||
return BadClass;
|
||||
|
||||
rc = dixLookupDevice(&tdev, device, client, DixReadAccess);
|
||||
rc = dixLookupDevice(&tdev, device, client, DixUseAccess);
|
||||
if (rc != BadDevice && rc != Success)
|
||||
return rc;
|
||||
if (rc == BadDevice || (dev != NULL && tdev != dev))
|
||||
|
|
|
@ -119,14 +119,14 @@ ProcXGrabDeviceButton(ClientPtr client)
|
|||
|
||||
if (stuff->modifier_device != UseXKeyboard) {
|
||||
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
|
||||
DixReadAccess);
|
||||
DixUseAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else {
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -116,14 +116,14 @@ ProcXGrabDeviceKey(ClientPtr client)
|
|||
|
||||
if (stuff->modifier_device != UseXKeyboard) {
|
||||
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
|
||||
DixReadAccess);
|
||||
DixUseAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
if (mdev->key == NULL)
|
||||
return BadMatch;
|
||||
} else {
|
||||
mdev = PickKeyboard(client);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
|
||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||
if (ret != Success)
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -153,7 +153,7 @@ AddOtherInputDevices(void)
|
|||
void
|
||||
OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
|
||||
{
|
||||
*status = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess);
|
||||
*status = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixUseAccess);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -95,7 +95,7 @@ int ProcXIChangeCursor(ClientPtr client)
|
|||
else
|
||||
{
|
||||
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
|
||||
RT_CURSOR, client, DixReadAccess);
|
||||
RT_CURSOR, client, DixUseAccess);
|
||||
if (rc != Success)
|
||||
return (rc == BadValue) ? BadCursor : rc;
|
||||
}
|
||||
|
|
|
@ -340,7 +340,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
newkeybd;
|
||||
|
||||
rc = dixLookupDevice(&newptr, r->return_pointer,
|
||||
client, DixWriteAccess);
|
||||
client, DixAddAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
|
@ -352,7 +352,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
}
|
||||
|
||||
rc = dixLookupDevice(&newkeybd, r->return_keyboard,
|
||||
client, DixWriteAccess);
|
||||
client, DixAddAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
|
@ -415,7 +415,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
DeviceIntPtr *xtstdevice;
|
||||
|
||||
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
||||
DixWriteAccess);
|
||||
DixManageAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
|
@ -448,7 +448,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
DeviceIntPtr *xtstdevice;
|
||||
|
||||
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
||||
DixWriteAccess);
|
||||
DixManageAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
|
||||
|
@ -471,7 +471,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
|||
}
|
||||
|
||||
rc = dixLookupDevice(&newmaster, c->new_master,
|
||||
client, DixWriteAccess);
|
||||
client, DixAddAccess);
|
||||
if (rc != Success)
|
||||
goto unwind;
|
||||
if (!IsMaster(newmaster))
|
||||
|
|
|
@ -68,7 +68,7 @@ int ProcXIGetClientPointer(ClientPtr client)
|
|||
if (stuff->win != None)
|
||||
{
|
||||
rc = dixLookupClient(&winclient, stuff->win, client,
|
||||
DixWriteAccess);
|
||||
DixGetAttrAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return BadWindow;
|
||||
|
|
|
@ -858,7 +858,7 @@ ProcXListDeviceProperties (ClientPtr client)
|
|||
REQUEST(xListDevicePropertiesReq);
|
||||
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
|
||||
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -894,7 +894,7 @@ ProcXChangeDeviceProperty (ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
|
||||
UpdateCurrentTime();
|
||||
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -922,7 +922,7 @@ ProcXDeleteDeviceProperty (ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -951,8 +951,8 @@ ProcXGetDeviceProperty (ClientPtr client)
|
|||
if (stuff->delete)
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client,
|
||||
stuff->delete ? DixWriteAccess :
|
||||
DixReadAccess);
|
||||
stuff->delete ? DixSetPropAccess :
|
||||
DixGetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1102,7 +1102,7 @@ ProcXIListProperties(ClientPtr client)
|
|||
REQUEST(xXIListPropertiesReq);
|
||||
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
|
||||
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1138,7 +1138,7 @@ ProcXIChangeProperty(ClientPtr client)
|
|||
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
|
||||
UpdateCurrentTime();
|
||||
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1165,7 +1165,7 @@ ProcXIDeleteProperty(ClientPtr client)
|
|||
|
||||
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -1195,8 +1195,8 @@ ProcXIGetProperty(ClientPtr client)
|
|||
if (stuff->delete)
|
||||
UpdateCurrentTime();
|
||||
rc = dixLookupDevice (&dev, stuff->deviceid, client,
|
||||
stuff->delete ? DixWriteAccess :
|
||||
DixReadAccess);
|
||||
stuff->delete ? DixSetPropAccess :
|
||||
DixGetPropAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ ProcXIQueryPointer(ClientPtr client)
|
|||
return BadDevice;
|
||||
}
|
||||
|
||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixReadAccess);
|
||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
SendErrorToClient(client, IReqCode, X_XIQueryPointer,
|
||||
|
|
|
@ -87,7 +87,7 @@ ProcXISelectEvents(ClientPtr client)
|
|||
{
|
||||
if (evmask->deviceid != XIAllDevices &&
|
||||
evmask->deviceid != XIAllMasterDevices)
|
||||
rc = dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
|
||||
rc = dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
||||
else {
|
||||
/* XXX: XACE here? */
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ ProcXISelectEvents(ClientPtr client)
|
|||
dummy.id = evmask->deviceid;
|
||||
dev = &dummy;
|
||||
} else
|
||||
dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
|
||||
dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
||||
XISetEventMask(dev, win, client, evmask->mask_len * 4, (unsigned char*)&evmask[1]);
|
||||
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
||||
evmask++;
|
||||
|
@ -169,7 +169,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|||
REQUEST(xXIGetSelectedEventsReq);
|
||||
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
||||
|
||||
rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
|
||||
rc = dixLookupWindow(&win, stuff->win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
return rc;
|
||||
|
||||
|
@ -208,7 +208,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
|||
|
||||
if (i > 2)
|
||||
{
|
||||
rc = dixLookupDevice(&dev, i, client, DixReadAccess);
|
||||
rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,7 @@ ProcXISetClientPointer(ClientPtr client)
|
|||
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
|
||||
|
||||
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixManageAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
client->errorValue = stuff->deviceid;
|
||||
|
@ -90,7 +90,7 @@ ProcXISetClientPointer(ClientPtr client)
|
|||
if (stuff->win != None)
|
||||
{
|
||||
rc = dixLookupClient(&targetClient, stuff->win, client,
|
||||
DixWriteAccess);
|
||||
DixManageAccess);
|
||||
|
||||
if (rc != Success)
|
||||
return BadWindow;
|
||||
|
|
|
@ -85,7 +85,7 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
|
||||
if (stuff->dst_win != None)
|
||||
{
|
||||
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
|
||||
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
|
@ -101,7 +101,7 @@ ProcXIWarpPointer(ClientPtr client)
|
|||
int winX, winY;
|
||||
WindowPtr src;
|
||||
|
||||
rc = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
|
||||
rc = dixLookupWindow(&src, stuff->src_win, client, DixGetAttrAccess);
|
||||
if (rc != Success)
|
||||
{
|
||||
return rc;
|
||||
|
|
Loading…
Reference in New Issue
Block a user