Xi: check for Use permission on the device in SetClientPointer().
Presumably, some intelligent, XI2-aware management app will be calling XISetClientPointer on behalf of other clients; this check makes sure the target client has permission on the device. Requires changing the prototype to return status code instead of Bool. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov> Acked-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
parent
119b966677
commit
00bc8d34c6
|
@ -98,10 +98,11 @@ ProcXISetClientPointer(ClientPtr client)
|
||||||
} else
|
} else
|
||||||
targetClient = client;
|
targetClient = client;
|
||||||
|
|
||||||
if (!SetClientPointer(targetClient, pDev))
|
rc = SetClientPointer(targetClient, pDev);
|
||||||
|
if (rc != Success)
|
||||||
{
|
{
|
||||||
client->errorValue = stuff->deviceid;
|
client->errorValue = stuff->deviceid;
|
||||||
return BadDevice;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
|
|
12
dix/events.c
12
dix/events.c
|
@ -5699,21 +5699,25 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events)
|
||||||
* PickPointer()).
|
* PickPointer()).
|
||||||
* If a keyboard is needed, the first keyboard paired with the CP is used.
|
* If a keyboard is needed, the first keyboard paired with the CP is used.
|
||||||
*/
|
*/
|
||||||
Bool
|
int
|
||||||
SetClientPointer(ClientPtr client, DeviceIntPtr device)
|
SetClientPointer(ClientPtr client, DeviceIntPtr device)
|
||||||
{
|
{
|
||||||
|
int rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixUseAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
|
||||||
if (!IsMaster(device))
|
if (!IsMaster(device))
|
||||||
{
|
{
|
||||||
ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n");
|
ErrorF("[dix] Need master device for ClientPointer. This is a bug.\n");
|
||||||
return FALSE;
|
return BadDevice;
|
||||||
} else if (!device->spriteInfo->spriteOwner)
|
} else if (!device->spriteInfo->spriteOwner)
|
||||||
{
|
{
|
||||||
ErrorF("[dix] Device %d does not have a sprite. "
|
ErrorF("[dix] Device %d does not have a sprite. "
|
||||||
"Cannot be ClientPointer\n", device->id);
|
"Cannot be ClientPointer\n", device->id);
|
||||||
return FALSE;
|
return BadDevice;
|
||||||
}
|
}
|
||||||
client->clientPtr = device;
|
client->clientPtr = device;
|
||||||
return TRUE;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* PickPointer will pick an appropriate pointer for the given client.
|
/* PickPointer will pick an appropriate pointer for the given client.
|
||||||
|
|
|
@ -485,7 +485,7 @@ extern _X_EXPORT int TryClientEvents(
|
||||||
|
|
||||||
extern _X_EXPORT void WindowsRestructured(void);
|
extern _X_EXPORT void WindowsRestructured(void);
|
||||||
|
|
||||||
extern Bool SetClientPointer(
|
extern int SetClientPointer(
|
||||||
ClientPtr /* client */,
|
ClientPtr /* client */,
|
||||||
DeviceIntPtr /* device */);
|
DeviceIntPtr /* device */);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue