From 2b459f44f3edaea137df9a28bc7adfeb1b9f1df7 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Fri, 5 Jun 2009 10:15:04 +1000 Subject: [PATCH] Xi: return BadImplementation for deviceids 256 and above The protocol allows for 16 bit device ids, but the implementation doesn't yet. We need to break the input ABI once more to shift the DeviceIntRec's CARD8 to a CARD16, along with some changes in the privates. Once that is done, revert this patch. Signed-off-by: Peter Hutterer --- Xi/chdevcur.c | 6 ++++++ Xi/chdevhier.c | 35 +++++++++++++++++++++++++++++++++++ Xi/querydev.c | 6 ++++++ Xi/querydp.c | 6 ++++++ Xi/setcptr.c | 5 +++++ Xi/warpdevp.c | 6 ++++++ Xi/xiallowev.c | 6 ++++++ Xi/xigrabdev.c | 9 +++++++++ Xi/xipassivegrab.c | 9 +++++++++ Xi/xiproperty.c | 26 ++++++++++++++++++++++++++ Xi/xiselectev.c | 6 ++++++ Xi/xisetdevfocus.c | 12 ++++++++++++ 12 files changed, 132 insertions(+) diff --git a/Xi/chdevcur.c b/Xi/chdevcur.c index fdea106d75..9dba78b369 100644 --- a/Xi/chdevcur.c +++ b/Xi/chdevcur.c @@ -74,6 +74,12 @@ int ProcXIChangeCursor(ClientPtr client) REQUEST(xXIChangeCursorReq); REQUEST_SIZE_MATCH(xXIChangeCursorReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixSetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/chdevhier.c b/Xi/chdevhier.c index 927df5569c..bd3da08d78 100644 --- a/Xi/chdevhier.c +++ b/Xi/chdevhier.c @@ -238,6 +238,12 @@ ProcXIChangeHierarchy(ClientPtr client) r->return_mode != XIFloating) return BadValue; + if (r->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = r->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&ptr, r->deviceid, client, DixDestroyAccess); if (rc != Success) @@ -338,6 +344,12 @@ ProcXIChangeHierarchy(ClientPtr client) newptr, newkeybd; + if (r->return_pointer > 0xFF) /* FIXME */ + { + client->errorValue = r->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&newptr, r->return_pointer, client, DixWriteAccess); if (rc != Success) @@ -350,6 +362,12 @@ ProcXIChangeHierarchy(ClientPtr client) goto unwind; } + if (r->return_keyboard > 0xFF) /* FIXME */ + { + client->errorValue = r->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&newkeybd, r->return_keyboard, client, DixWriteAccess); if (rc != Success) @@ -413,6 +431,12 @@ ProcXIChangeHierarchy(ClientPtr client) xXIDetachSlaveInfo* c = (xXIDetachSlaveInfo*)any; DeviceIntPtr *xtstdevice; + if (c->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = c->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&ptr, c->deviceid, client, DixWriteAccess); if (rc != Success) @@ -446,6 +470,17 @@ ProcXIChangeHierarchy(ClientPtr client) DeviceIntPtr newmaster; DeviceIntPtr *xtstdevice; + if (c->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = c->deviceid; + return BadImplementation; + } + if (c->new_master > 0xFF) /* FIXME */ + { + client->errorValue = c->new_master; + return BadImplementation; + } + rc = dixLookupDevice(&ptr, c->deviceid, client, DixWriteAccess); if (rc != Success) diff --git a/Xi/querydev.c b/Xi/querydev.c index 0d661a9f8c..a44cf223e9 100644 --- a/Xi/querydev.c +++ b/Xi/querydev.c @@ -70,6 +70,12 @@ ProcXIQueryDevice(ClientPtr client) REQUEST(xXIQueryDeviceReq); REQUEST_SIZE_MATCH(xXIQueryDeviceReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + if (stuff->deviceid != XIAllDevices && stuff->deviceid != XIAllMasterDevices) { rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); diff --git a/Xi/querydp.c b/Xi/querydp.c index 2e2cfaaece..bc6feb1b13 100644 --- a/Xi/querydp.c +++ b/Xi/querydp.c @@ -81,6 +81,12 @@ ProcXIQueryPointer(ClientPtr client) REQUEST(xXIQueryPointerReq); REQUEST_SIZE_MATCH(xXIQueryPointerReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess); if (rc != Success) return rc; diff --git a/Xi/setcptr.c b/Xi/setcptr.c index 0bfc1eab7b..ba76246912 100644 --- a/Xi/setcptr.c +++ b/Xi/setcptr.c @@ -69,6 +69,11 @@ ProcXISetClientPointer(ClientPtr client) REQUEST(xXISetClientPointerReq); REQUEST_SIZE_MATCH(xXISetClientPointerReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess); if (rc != Success) diff --git a/Xi/warpdevp.c b/Xi/warpdevp.c index 025a4cef76..bb45bdafc4 100644 --- a/Xi/warpdevp.c +++ b/Xi/warpdevp.c @@ -76,6 +76,12 @@ ProcXIWarpPointer(ClientPtr client) REQUEST(xXIWarpPointerReq); REQUEST_SIZE_MATCH(xXIWarpPointerReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + /* FIXME: panoramix stuff is missing, look at ProcWarpPointer */ rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess); diff --git a/Xi/xiallowev.c b/Xi/xiallowev.c index 3077e1a44b..dd52c53c6e 100644 --- a/Xi/xiallowev.c +++ b/Xi/xiallowev.c @@ -65,6 +65,12 @@ ProcXIAllowEvents(ClientPtr client) REQUEST(xXIAllowEventsReq); REQUEST_SIZE_MATCH(xXIAllowEventsReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); if (ret != Success) return ret; diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c index 95beb832b0..a825a89066 100644 --- a/Xi/xigrabdev.c +++ b/Xi/xigrabdev.c @@ -70,6 +70,9 @@ ProcXIGrabDevice(ClientPtr client) REQUEST(xXIGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xXIGrabDeviceReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + return BadImplementation; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); if (ret != Success) return ret; @@ -129,6 +132,12 @@ ProcXIUngrabDevice(ClientPtr client) REQUEST(xXIUngrabDeviceReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); if (ret != Success) return ret; diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index 0c74544e4b..25ecc035ca 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -90,6 +90,9 @@ ProcXIPassiveGrabDevice(ClientPtr client) REQUEST(xXIPassiveGrabDeviceReq); REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + return BadImplementation; + if (stuff->deviceid == XIAllDevices) dev = inputInfo.all_devices; else if (stuff->deviceid == XIAllMasterDevices) @@ -260,6 +263,12 @@ ProcXIPassiveUngrabDevice(ClientPtr client) REQUEST(xXIPassiveUngrabDeviceReq); REQUEST_AT_LEAST_SIZE(xXIPassiveUngrabDeviceReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); if (rc != Success) return rc; diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index cd4946026e..dc54d10fe1 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -1102,6 +1102,12 @@ ProcXIListProperties(ClientPtr client) REQUEST(xXIListPropertiesReq); REQUEST_SIZE_MATCH(xXIListPropertiesReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + rc = dixLookupDevice (&dev, stuff->deviceid, client, DixReadAccess); if (rc != Success) return rc; @@ -1136,6 +1142,12 @@ ProcXIChangeProperty(ClientPtr client) REQUEST(xXIChangePropertyReq); REQUEST_AT_LEAST_SIZE(xXIChangePropertyReq); + + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } UpdateCurrentTime(); rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess); @@ -1164,6 +1176,13 @@ ProcXIDeleteProperty(ClientPtr client) REQUEST(xXIDeletePropertyReq); REQUEST_SIZE_MATCH(xXIDeletePropertyReq); + + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + UpdateCurrentTime(); rc = dixLookupDevice (&dev, stuff->deviceid, client, DixWriteAccess); if (rc != Success) @@ -1192,6 +1211,13 @@ ProcXIGetProperty(ClientPtr client) Atom type; REQUEST_SIZE_MATCH(xXIGetPropertyReq); + + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + if (stuff->delete) UpdateCurrentTime(); rc = dixLookupDevice (&dev, stuff->deviceid, client, diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 31e6a77f57..9dbdea72cd 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -82,6 +82,12 @@ ProcXISelectEvent(ClientPtr client) num_masks = stuff->num_masks; while(num_masks--) { + if (evmask->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = evmask->deviceid; + return BadImplementation; + } + if (evmask->deviceid != XIAllDevices && evmask->deviceid != XIAllMasterDevices) rc = dixLookupDevice(&dev, evmask->deviceid, client, DixReadAccess); diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c index 32f7e597b8..cd1f6a6221 100644 --- a/Xi/xisetdevfocus.c +++ b/Xi/xisetdevfocus.c @@ -75,6 +75,12 @@ ProcXISetFocus(ClientPtr client) REQUEST(xXISetFocusReq); REQUEST_AT_LEAST_SIZE(xXISetFocusReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetFocusAccess); if (ret != Success) return ret; @@ -95,6 +101,12 @@ ProcXIGetFocus(ClientPtr client) REQUEST(xXIGetFocusReq); REQUEST_AT_LEAST_SIZE(xXIGetFocusReq); + if (stuff->deviceid > 0xFF) /* FIXME */ + { + client->errorValue = stuff->deviceid; + return BadImplementation; + } + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixGetFocusAccess); if (ret != Success) return ret;