Xi: Check for DestroyAccess when trying to delete a master device.
This commit is contained in:
parent
b0bf4308ac
commit
6e17184486
|
@ -88,9 +88,6 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
|
||||||
REQUEST(xChangeDeviceHierarchyReq);
|
REQUEST(xChangeDeviceHierarchyReq);
|
||||||
REQUEST_AT_LEAST_SIZE(xChangeDeviceHierarchyReq);
|
REQUEST_AT_LEAST_SIZE(xChangeDeviceHierarchyReq);
|
||||||
|
|
||||||
/* XXX: check if client is allowed to change hierarch */
|
|
||||||
|
|
||||||
|
|
||||||
any = (xAnyHierarchyChangeInfo*)&stuff[1];
|
any = (xAnyHierarchyChangeInfo*)&stuff[1];
|
||||||
while(stuff->num_changes--)
|
while(stuff->num_changes--)
|
||||||
{
|
{
|
||||||
|
@ -109,10 +106,13 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
|
||||||
char* name;
|
char* name;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* XXX: check for creation permission */
|
||||||
|
|
||||||
SWAPIF(swaps(&c->namelen, n));
|
SWAPIF(swaps(&c->namelen, n));
|
||||||
name = xcalloc(c->namelen + 1, sizeof(char));
|
name = xcalloc(c->namelen + 1, sizeof(char));
|
||||||
strncpy(name, (char*)&c[1], c->namelen);
|
strncpy(name, (char*)&c[1], c->namelen);
|
||||||
|
|
||||||
|
|
||||||
ret = AllocMasterDevice(name, &ptr, &keybd);
|
ret = AllocMasterDevice(name, &ptr, &keybd);
|
||||||
if (ret != Success)
|
if (ret != Success)
|
||||||
{
|
{
|
||||||
|
@ -143,7 +143,7 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rc = dixLookupDevice(&ptr, r->deviceid, client,
|
rc = dixLookupDevice(&ptr, r->deviceid, client,
|
||||||
DixWriteAccess);
|
DixDestroyAccess);
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return rc;
|
return rc;
|
||||||
|
|
||||||
|
@ -160,13 +160,26 @@ ProcXChangeDeviceHierarchy(ClientPtr client)
|
||||||
|
|
||||||
/* disable keyboards first */
|
/* disable keyboards first */
|
||||||
if (IsPointerDevice(ptr))
|
if (IsPointerDevice(ptr))
|
||||||
keybd = ptr->spriteInfo->paired;
|
{
|
||||||
|
rc = dixLookupDevice(&keybd,
|
||||||
|
ptr->spriteInfo->paired->id,
|
||||||
|
client,
|
||||||
|
DixDestroyAccess);
|
||||||
|
if (rc != Success)
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
keybd = ptr;
|
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
|
/* Disabling sends the devices floating, reattach them if
|
||||||
* desired. */
|
* desired. */
|
||||||
if (r->returnMode == AttachToMaster)
|
if (r->returnMode == AttachToMaster)
|
||||||
|
|
Loading…
Reference in New Issue