summaryrefslogtreecommitdiff
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 20:58:23 -0400
commit2180174034ae007023f248964be315fccc3c32ee (patch)
tree7f9396b707c860748323c1fc8c537fdc6ac901c9
parent439c58849304907900e4dc7429aedb0192749c02 (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. [Backport to 1.6] Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
-rw-r--r--Xi/queryst.c14
-rw-r--r--dix/devices.c5
-rw-r--r--dix/events.c11
3 files changed, 23 insertions, 7 deletions
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 21de843f3..2d5402027 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -98,3 +98,3 @@ ProcXQueryDeviceState(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
- if (rc != Success)
+ if (rc != Success && rc != BadAccess)
return rc;
@@ -131,4 +131,5 @@ ProcXQueryDeviceState(ClientPtr client)
tk->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode + 1;
- for (i = 0; i < 32; i++)
- tk->keys[i] = k->down[i];
+ if (rc != BadAccess)
+ for (i = 0; i < 32; i++)
+ tk->keys[i] = k->down[i];
buf += sizeof(xKeyState);
@@ -141,3 +142,4 @@ ProcXQueryDeviceState(ClientPtr client)
tb->num_buttons = b->numButtons;
- memcpy(tb->buttons, b->down, sizeof(b->down));
+ if (rc != BadAccess)
+ memcpy(tb->buttons, b->down, sizeof(b->down));
buf += sizeof(xButtonState);
@@ -153,3 +155,5 @@ ProcXQueryDeviceState(ClientPtr client)
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
- *((int *)buf) = *values++;
+ if (rc != BadAccess)
+ *((int *)buf) = *values;
+ values++;
if (client->swapped) {
diff --git a/dix/devices.c b/dix/devices.c
index 3b8d544da..9e3542d6e 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -2479,3 +2479,3 @@ ProcQueryKeymap(ClientPtr client)
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
- if (rc != Success)
+ if (rc != Success && rc != BadAccess)
return rc;
@@ -2485,2 +2485,5 @@ ProcQueryKeymap(ClientPtr client)
+ if (rc == BadAccess)
+ memset(rep.map, 0, 32);
+
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
diff --git a/dix/events.c b/dix/events.c
index f9448ba76..9b0ff55a8 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -4773,3 +4773,3 @@ ProcQueryPointer(ClientPtr client)
rc = XaceHook(XACE_DEVICE_ACCESS, client, mouse, DixReadAccess);
- if (rc != Success)
+ if (rc != Success && rc != BadAccess)
return rc;
@@ -4817,2 +4817,11 @@ ProcQueryPointer(ClientPtr client)
+ 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);