Commit 6e171844 authored by Peter Hutterer's avatar Peter Hutterer

Xi: Check for DestroyAccess when trying to delete a master device.

parent b0bf4308
......@@ -88,9 +88,6 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
REQUEST(xChangeDeviceHierarchyReq);
REQUEST_AT_LEAST_SIZE(xChangeDeviceHierarchyReq);
/* XXX: check if client is allowed to change hierarch */
any = (xAnyHierarchyChangeInfo*)&stuff[1];
while(stuff->num_changes--)
{
......@@ -109,10 +106,13 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
char* name;
int ret;
/* XXX: check for creation permission */
SWAPIF(swaps(&c->namelen, n));
name = xcalloc(c->namelen + 1, sizeof(char));
strncpy(name, (char*)&c[1], c->namelen);
ret = AllocMasterDevice(name, &ptr, &keybd);
if (ret != Success)
{
......@@ -143,7 +143,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
return BadValue;
rc = dixLookupDevice(&ptr, r->deviceid, client,
DixWriteAccess);
DixDestroyAccess);
if (rc != Success)
return rc;
......@@ -160,13 +160,26 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
/* disable keyboards first */
if (IsPointerDevice(ptr))
keybd = ptr->spriteInfo->paired;
{
rc = dixLookupDevice(&keybd,
ptr->spriteInfo->paired->id,
client,
DixDestroyAccess);
if (rc != Success)
return rc;
}
else
{
keybd = ptr;
ptr = keybd->spriteInfo->paired;
rc = dixLookupDevice(&ptr,
keybd->spriteInfo->paired->id,
client,
DixDestroyAccess);
if (rc != Success)
return rc;
}
/* Disabling sends the devices floating, reattach them if
* desired. */
if (r->returnMode == AttachToMaster)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment