ProcQueryKeymap: rework logic around permission to copy key states
Always initialize to zero, and then if permission is granted, copy the current key state maps, instead of always copying and then zeroing out if permission was denied. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Keith Packard <keithp@keithp.com> Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
parent
dccb0858d7
commit
c2fb1a7b2a
|
@ -2388,16 +2388,18 @@ ProcQueryKeymap(ClientPtr client)
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.length = 2;
|
rep.length = 2;
|
||||||
|
memset(rep.map, 0, 32);
|
||||||
|
|
||||||
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
|
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
|
||||||
if (rc != Success && rc != BadAccess)
|
/* If rc is Success, we're allowed to copy out the keymap.
|
||||||
return rc;
|
* If it's BadAccess, we leave it empty & lie to the client.
|
||||||
|
*/
|
||||||
|
if (rc == Success) {
|
||||||
for (i = 0; i < 32; i++)
|
for (i = 0; i < 32; i++)
|
||||||
rep.map[i] = down[i];
|
rep.map[i] = down[i];
|
||||||
|
}
|
||||||
if (rc == BadAccess)
|
else if (rc != BadAccess)
|
||||||
memset(rep.map, 0, 32);
|
return rc;
|
||||||
|
|
||||||
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
|
WriteReplyToClient(client, sizeof(xQueryKeymapReply), &rep);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user