mirror of
https://github.com/X11Libre/xserver.git
synced 2026-10-16 00:19:55 +00:00
xace: Fake return values on denials in input polling requests.
Instead of returning BadAccess when "read" permission is denied on a device, falsify the device state (buttons down, keys pressed). This is nicer to applications, but may still have undesired side effects. The long-term solution is not to use these requests in event-driven code! Requests affected: QueryPointer, QueryKeymap, XiQueryDevice. Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
This commit is contained in:
parent
0493935691
commit
8502c06e19
5 changed files with 55 additions and 24 deletions
|
|
@ -2221,12 +2221,15 @@ ProcQueryKeymap(ClientPtr client)
|
|||
rep.length = 2;
|
||||
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
|
||||
if (rc != Success)
|
||||
if (rc != Success && rc != BadAccess)
|
||||
return rc;
|
||||
|
||||
for (i = 0; i<32; i++)
|
||||
rep.map[i] = down[i];
|
||||
|
||||
if (rc == BadAccess)
|
||||
memset(rep.map, 0, 32);
|
||||
|
||||
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
|
||||
|
||||
return Success;
|
||||
|
|
|
|||
11
dix/events.c
11
dix/events.c
|
|
@ -4974,7 +4974,7 @@ ProcQueryPointer(ClientPtr client)
|
|||
if (rc != Success)
|
||||
return rc;
|
||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess);
|
||||
if (rc != Success)
|
||||
if (rc != Success && rc != BadAccess)
|
||||
return rc;
|
||||
|
||||
keyboard = GetPairedDevice(mouse);
|
||||
|
|
@ -5022,6 +5022,15 @@ ProcQueryPointer(ClientPtr client)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (rc == BadAccess) {
|
||||
rep.mask = 0;
|
||||
rep.child = None;
|
||||
rep.rootX = 0;
|
||||
rep.rootY = 0;
|
||||
rep.winX = 0;
|
||||
rep.winY = 0;
|
||||
}
|
||||
|
||||
WriteReplyToClient(client, sizeof(xQueryPointerReply), &rep);
|
||||
|
||||
return(Success);
|
||||
|
|
|
|||
Loading…
Reference in a new issue