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;
|
DeviceIntPtr dev;
|
||||||
|
|
||||||
dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient,
|
dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient,
|
||||||
DixReadAccess);
|
DixGrabAccess);
|
||||||
if (!dev)
|
if (!dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count,
|
||||||
if (device > 255) /* FIXME: we only use 7 bit for devices? */
|
if (device > 255) /* FIXME: we only use 7 bit for devices? */
|
||||||
return BadClass;
|
return BadClass;
|
||||||
|
|
||||||
rc = dixLookupDevice(&tdev, device, client, DixReadAccess);
|
rc = dixLookupDevice(&tdev, device, client, DixUseAccess);
|
||||||
if (rc != BadDevice && rc != Success)
|
if (rc != BadDevice && rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
if (rc == BadDevice || (dev != NULL && tdev != dev))
|
if (rc == BadDevice || (dev != NULL && tdev != dev))
|
||||||
|
|
|
@ -119,14 +119,14 @@ ProcXGrabDeviceButton(ClientPtr client)
|
||||||
|
|
||||||
if (stuff->modifier_device != UseXKeyboard) {
|
if (stuff->modifier_device != UseXKeyboard) {
|
||||||
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
|
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
|
||||||
DixReadAccess);
|
DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
if (mdev->key == NULL)
|
if (mdev->key == NULL)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else {
|
} else {
|
||||||
mdev = PickKeyboard(client);
|
mdev = PickKeyboard(client);
|
||||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
|
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -116,14 +116,14 @@ ProcXGrabDeviceKey(ClientPtr client)
|
||||||
|
|
||||||
if (stuff->modifier_device != UseXKeyboard) {
|
if (stuff->modifier_device != UseXKeyboard) {
|
||||||
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
|
ret = dixLookupDevice(&mdev, stuff->modifier_device, client,
|
||||||
DixReadAccess);
|
DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
if (mdev->key == NULL)
|
if (mdev->key == NULL)
|
||||||
return BadMatch;
|
return BadMatch;
|
||||||
} else {
|
} else {
|
||||||
mdev = PickKeyboard(client);
|
mdev = PickKeyboard(client);
|
||||||
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixReadAccess);
|
ret = XaceHook(XACE_DEVICE_ACCESS, client, mdev, DixUseAccess);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ AddOtherInputDevices(void)
|
||||||
void
|
void
|
||||||
OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status)
|
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
|
else
|
||||||
{
|
{
|
||||||
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
|
rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor,
|
||||||
RT_CURSOR, client, DixReadAccess);
|
RT_CURSOR, client, DixUseAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return (rc == BadValue) ? BadCursor : rc;
|
return (rc == BadValue) ? BadCursor : rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,7 +340,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
newkeybd;
|
newkeybd;
|
||||||
|
|
||||||
rc = dixLookupDevice(&newptr, r->return_pointer,
|
rc = dixLookupDevice(&newptr, r->return_pointer,
|
||||||
client, DixWriteAccess);
|
client, DixAddAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dixLookupDevice(&newkeybd, r->return_keyboard,
|
rc = dixLookupDevice(&newkeybd, r->return_keyboard,
|
||||||
client, DixWriteAccess);
|
client, DixAddAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
|
@ -415,7 +415,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
DeviceIntPtr *xtstdevice;
|
DeviceIntPtr *xtstdevice;
|
||||||
|
|
||||||
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
||||||
DixWriteAccess);
|
DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
DeviceIntPtr *xtstdevice;
|
DeviceIntPtr *xtstdevice;
|
||||||
|
|
||||||
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
rc = dixLookupDevice(&ptr, c->deviceid, client,
|
||||||
DixWriteAccess);
|
DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
|
|
||||||
|
@ -471,7 +471,7 @@ ProcXIChangeHierarchy(ClientPtr client)
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dixLookupDevice(&newmaster, c->new_master,
|
rc = dixLookupDevice(&newmaster, c->new_master,
|
||||||
client, DixWriteAccess);
|
client, DixAddAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
goto unwind;
|
goto unwind;
|
||||||
if (!IsMaster(newmaster))
|
if (!IsMaster(newmaster))
|
||||||
|
|
|
@ -68,7 +68,7 @@ int ProcXIGetClientPointer(ClientPtr client)
|
||||||
if (stuff->win != None)
|
if (stuff->win != None)
|
||||||
{
|
{
|
||||||
rc = dixLookupClient(&winclient, stuff->win, client,
|
rc = dixLookupClient(&winclient, stuff->win, client,
|
||||||
DixWriteAccess);
|
DixGetAttrAccess);
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadWindow;
|
return BadWindow;
|
||||||
|
|
|
@ -858,7 +858,7 @@ ProcXListDeviceProperties (ClientPtr client)
|
||||||
REQUEST(xListDevicePropertiesReq);
|
REQUEST(xListDevicePropertiesReq);
|
||||||
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
|
REQUEST_SIZE_MATCH(xListDevicePropertiesReq);
|
||||||
|
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
|
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -894,7 +894,7 @@ ProcXChangeDeviceProperty (ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDevicePropertyReq);
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
|
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -922,7 +922,7 @@ ProcXDeleteDeviceProperty (ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
|
REQUEST_SIZE_MATCH(xDeleteDevicePropertyReq);
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -951,8 +951,8 @@ ProcXGetDeviceProperty (ClientPtr client)
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client,
|
rc = dixLookupDevice (&dev, stuff->deviceid, client,
|
||||||
stuff->delete ? DixWriteAccess :
|
stuff->delete ? DixSetPropAccess :
|
||||||
DixReadAccess);
|
DixGetPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1102,7 +1102,7 @@ ProcXIListProperties(ClientPtr client)
|
||||||
REQUEST(xXIListPropertiesReq);
|
REQUEST(xXIListPropertiesReq);
|
||||||
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
|
REQUEST_SIZE_MATCH(xXIListPropertiesReq);
|
||||||
|
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess);
|
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixListPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1138,7 +1138,7 @@ ProcXIChangeProperty(ClientPtr client)
|
||||||
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
|
REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq);
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
|
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1165,7 +1165,7 @@ ProcXIDeleteProperty(ClientPtr client)
|
||||||
|
|
||||||
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
|
REQUEST_SIZE_MATCH(xXIDeletePropertyReq);
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess);
|
rc = dixLookupDevice (&dev, stuff->deviceid, client, DixSetPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -1195,8 +1195,8 @@ ProcXIGetProperty(ClientPtr client)
|
||||||
if (stuff->delete)
|
if (stuff->delete)
|
||||||
UpdateCurrentTime();
|
UpdateCurrentTime();
|
||||||
rc = dixLookupDevice (&dev, stuff->deviceid, client,
|
rc = dixLookupDevice (&dev, stuff->deviceid, client,
|
||||||
stuff->delete ? DixWriteAccess :
|
stuff->delete ? DixSetPropAccess :
|
||||||
DixReadAccess);
|
DixGetPropAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ ProcXIQueryPointer(ClientPtr client)
|
||||||
return BadDevice;
|
return BadDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = dixLookupWindow(&pWin, stuff->win, client, DixReadAccess);
|
rc = dixLookupWindow(&pWin, stuff->win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
SendErrorToClient(client, IReqCode, X_XIQueryPointer,
|
SendErrorToClient(client, IReqCode, X_XIQueryPointer,
|
||||||
|
|
|
@ -87,7 +87,7 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
{
|
{
|
||||||
if (evmask->deviceid != XIAllDevices &&
|
if (evmask->deviceid != XIAllDevices &&
|
||||||
evmask->deviceid != XIAllMasterDevices)
|
evmask->deviceid != XIAllMasterDevices)
|
||||||
rc = dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess);
|
rc = dixLookupDevice(&dev, evmask->deviceid, client, DixUseAccess);
|
||||||
else {
|
else {
|
||||||
/* XXX: XACE here? */
|
/* XXX: XACE here? */
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ ProcXISelectEvents(ClientPtr client)
|
||||||
dummy.id = evmask->deviceid;
|
dummy.id = evmask->deviceid;
|
||||||
dev = &dummy;
|
dev = &dummy;
|
||||||
} else
|
} 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]);
|
XISetEventMask(dev, win, client, evmask->mask_len * 4, (unsigned char*)&evmask[1]);
|
||||||
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
evmask = (xXIEventMask*)(((unsigned char*)evmask) + evmask->mask_len * 4);
|
||||||
evmask++;
|
evmask++;
|
||||||
|
@ -169,7 +169,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
REQUEST(xXIGetSelectedEventsReq);
|
REQUEST(xXIGetSelectedEventsReq);
|
||||||
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
REQUEST_SIZE_MATCH(xXIGetSelectedEventsReq);
|
||||||
|
|
||||||
rc = dixLookupWindow(&win, stuff->win, client, DixReceiveAccess);
|
rc = dixLookupWindow(&win, stuff->win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ ProcXIGetSelectedEvents(ClientPtr client)
|
||||||
|
|
||||||
if (i > 2)
|
if (i > 2)
|
||||||
{
|
{
|
||||||
rc = dixLookupDevice(&dev, i, client, DixReadAccess);
|
rc = dixLookupDevice(&dev, i, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ ProcXISetClientPointer(ClientPtr client)
|
||||||
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
|
REQUEST_SIZE_MATCH(xXISetClientPointerReq);
|
||||||
|
|
||||||
|
|
||||||
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
|
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixManageAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
|
@ -90,7 +90,7 @@ ProcXISetClientPointer(ClientPtr client)
|
||||||
if (stuff->win != None)
|
if (stuff->win != None)
|
||||||
{
|
{
|
||||||
rc = dixLookupClient(&targetClient, stuff->win, client,
|
rc = dixLookupClient(&targetClient, stuff->win, client,
|
||||||
DixWriteAccess);
|
DixManageAccess);
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return BadWindow;
|
return BadWindow;
|
||||||
|
|
|
@ -85,7 +85,7 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
|
|
||||||
if (stuff->dst_win != None)
|
if (stuff->dst_win != None)
|
||||||
{
|
{
|
||||||
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixReadAccess);
|
rc = dixLookupWindow(&dest, stuff->dst_win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -101,7 +101,7 @@ ProcXIWarpPointer(ClientPtr client)
|
||||||
int winX, winY;
|
int winX, winY;
|
||||||
WindowPtr src;
|
WindowPtr src;
|
||||||
|
|
||||||
rc = dixLookupWindow(&src, stuff->src_win, client, DixReadAccess);
|
rc = dixLookupWindow(&src, stuff->src_win, client, DixGetAttrAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
return rc;
|
return rc;
|
||||||
|
|
Loading…
Reference in New Issue