summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2009-09-15 19:29:34 -0400
committerEamon Walsh <ewalsh@tycho.nsa.gov>2009-10-14 19:19:19 -0400
commit8502c06e19a4c00bf1311f54f9a365ee9e026e97 (patch)
tree5b0bafb13e45ba65097ff4fedbc5b7745840c325 /dix
parent0493935691e925ae137af7636fa15befa76c8b45 (diff)
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>
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c5
-rw-r--r--dix/events.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/dix/devices.c b/dix/devices.c
index e86e606c0..6a7907399 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -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;
diff --git a/dix/events.c b/dix/events.c
index aaf28b53f..4bc97b170 100644
--- a/dix/events.c
+++ b/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);