diff options
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/allowev.c | 8 | ||||
-rw-r--r-- | Xi/chgdctl.c | 7 | ||||
-rw-r--r-- | Xi/chgfctl.c | 8 | ||||
-rw-r--r-- | Xi/chgkmap.c | 7 | ||||
-rw-r--r-- | Xi/chgprop.c | 3 | ||||
-rw-r--r-- | Xi/chgptr.c | 2 | ||||
-rw-r--r-- | Xi/closedev.c | 9 | ||||
-rw-r--r-- | Xi/devbell.c | 9 | ||||
-rw-r--r-- | Xi/exevents.c | 37 | ||||
-rw-r--r-- | Xi/extinit.c | 23 | ||||
-rw-r--r-- | Xi/getbmap.c | 8 | ||||
-rw-r--r-- | Xi/getdctl.c | 9 | ||||
-rw-r--r-- | Xi/getfctl.c | 9 | ||||
-rw-r--r-- | Xi/getfocus.c | 8 | ||||
-rw-r--r-- | Xi/getkmap.c | 8 | ||||
-rw-r--r-- | Xi/getmmap.c | 8 | ||||
-rw-r--r-- | Xi/getprop.c | 3 | ||||
-rw-r--r-- | Xi/getselev.c | 3 | ||||
-rw-r--r-- | Xi/getvers.c | 1 | ||||
-rw-r--r-- | Xi/grabdev.c | 15 | ||||
-rw-r--r-- | Xi/grabdevb.c | 14 | ||||
-rw-r--r-- | Xi/grabdevk.c | 14 | ||||
-rw-r--r-- | Xi/gtmotion.c | 9 | ||||
-rw-r--r-- | Xi/listdev.c | 10 | ||||
-rw-r--r-- | Xi/opendev.c | 7 | ||||
-rw-r--r-- | Xi/queryst.c | 9 | ||||
-rw-r--r-- | Xi/selectev.c | 3 | ||||
-rw-r--r-- | Xi/sendexev.c | 8 | ||||
-rw-r--r-- | Xi/setbmap.c | 7 | ||||
-rw-r--r-- | Xi/setdval.c | 8 | ||||
-rw-r--r-- | Xi/setfocus.c | 7 | ||||
-rw-r--r-- | Xi/setmmap.c | 7 | ||||
-rw-r--r-- | Xi/setmode.c | 8 | ||||
-rw-r--r-- | Xi/stubs.c | 2 | ||||
-rw-r--r-- | Xi/ungrdev.c | 8 | ||||
-rw-r--r-- | Xi/ungrdevb.c | 14 | ||||
-rw-r--r-- | Xi/ungrdevk.c | 14 |
37 files changed, 161 insertions, 173 deletions
diff --git a/Xi/allowev.c b/Xi/allowev.c index cf075e112..0043cb138 100644 --- a/Xi/allowev.c +++ b/Xi/allowev.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "allowev.h" @@ -95,13 +94,14 @@ ProcXAllowDeviceEvents(ClientPtr client) { TimeStamp time; DeviceIntPtr thisdev; + int rc; REQUEST(xAllowDeviceEventsReq); REQUEST_SIZE_MATCH(xAllowDeviceEventsReq); - thisdev = LookupDeviceIntRec(stuff->deviceid); - if (thisdev == NULL) - return BadDevice; + rc = dixLookupDevice(&thisdev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; time = ClientTimeToServerTime(stuff->time); switch (stuff->mode) { diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 055f459d0..e7d04a781 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -61,7 +61,6 @@ SOFTWARE. #include <X11/extensions/XIproto.h> /* control constants */ #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "exevents.h" @@ -112,11 +111,9 @@ ProcXChangeDeviceControl(ClientPtr client) REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); len = stuff->length - (sizeof(xChangeDeviceControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { - ret = BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (ret != Success) goto out; - } rep.repType = X_Reply; rep.RepType = X_ChangeDeviceControl; diff --git a/Xi/chgfctl.c b/Xi/chgfctl.c index 46bb8e78f..8fc24d5ff 100644 --- a/Xi/chgfctl.c +++ b/Xi/chgfctl.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> /* control constants */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "chgfctl.h" @@ -444,14 +443,15 @@ ProcXChangeFeedbackControl(ClientPtr client) StringFeedbackPtr s; BellFeedbackPtr b; LedFeedbackPtr l; + int rc; REQUEST(xChangeFeedbackControlReq); REQUEST_AT_LEAST_SIZE(xChangeFeedbackControlReq); len = stuff->length - (sizeof(xChangeFeedbackControlReq) >> 2); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (rc != Success) + return rc; switch (stuff->feedbackid) { case KbdFeedbackClass: diff --git a/Xi/chgkmap.c b/Xi/chgkmap.c index bfdc1cedc..3361e9801 100644 --- a/Xi/chgkmap.c +++ b/Xi/chgkmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -107,9 +106,9 @@ ProcXChangeDeviceKeyMapping(ClientPtr client) REQUEST(xChangeDeviceKeyMappingReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceKeyMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (ret != Success) + return ret; len = stuff->length - (sizeof(xChangeDeviceKeyMappingReq) >> 2); ret = ChangeKeyMapping(client, dev, len, DeviceMappingNotify, diff --git a/Xi/chgprop.c b/Xi/chgprop.c index 13463dd1c..58db88620 100644 --- a/Xi/chgprop.c +++ b/Xi/chgprop.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -115,7 +114,7 @@ ProcXChangeDeviceDontPropagateList(ClientPtr client) stuff->count) return BadLength; - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixSetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/chgptr.c b/Xi/chgptr.c index 2ce81d1d6..28950918f 100644 --- a/Xi/chgptr.c +++ b/Xi/chgptr.c @@ -63,8 +63,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ -#include "extinit.h" /* LookupDeviceIntRec */ - #include "dixevents.h" #include "exevents.h" #include "exglobals.h" diff --git a/Xi/closedev.c b/Xi/closedev.c index 1ec3fa163..b2b5f69a6 100644 --- a/Xi/closedev.c +++ b/Xi/closedev.c @@ -62,7 +62,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "closedev.h" @@ -140,16 +139,16 @@ DeleteEventsFromChildren(DeviceIntPtr dev, WindowPtr p1, ClientPtr client) int ProcXCloseDevice(ClientPtr client) { - int i; + int rc, i; WindowPtr pWin, p1; DeviceIntPtr d; REQUEST(xCloseDeviceReq); REQUEST_SIZE_MATCH(xCloseDeviceReq); - d = LookupDeviceIntRec(stuff->deviceid); - if (d == NULL) - return BadDevice; + rc = dixLookupDevice(&d, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; if (d->grab && SameClient(d->grab, client)) (*d->DeactivateGrab) (d); /* release active grab */ diff --git a/Xi/devbell.c b/Xi/devbell.c index 83e844d93..264f64800 100644 --- a/Xi/devbell.c +++ b/Xi/devbell.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "devbell.h" @@ -93,7 +92,7 @@ ProcXDeviceBell(ClientPtr client) DeviceIntPtr dev; KbdFeedbackPtr k; BellFeedbackPtr b; - int base; + int rc, base; int newpercent; CARD8 class; pointer ctrl; @@ -102,10 +101,10 @@ ProcXDeviceBell(ClientPtr client) REQUEST(xDeviceBellReq); REQUEST_SIZE_MATCH(xDeviceBellReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) { + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixBellAccess); + if (rc != Success) { client->errorValue = stuff->deviceid; - return BadDevice; + return rc; } if (stuff->percent < -100 || stuff->percent > 100) { diff --git a/Xi/exevents.c b/Xi/exevents.c index 377311ec9..9a179500b 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -67,11 +67,11 @@ SOFTWARE. #include "region.h" #include "exevents.h" #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* DeliverFocusedEvent */ #include "dixgrabs.h" /* CreateGrab() */ #include "scrnintstr.h" +#include "xace.h" #ifdef XKB #include "xkbsrv.h" @@ -511,6 +511,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin, confineTo; CursorPtr cursor; GrabPtr grab; + Mask access_mode = DixGrabAccess; int rc; if ((this_device_mode != GrabModeSync) && @@ -531,25 +532,33 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; if (rconfineTo == None) confineTo = NullWindow; else { - rc = dixLookupWindow(&confineTo, rconfineTo, client, DixUnknownAccess); + rc = dixLookupWindow(&confineTo, rconfineTo, client, DixSetAttrAccess); if (rc != Success) return rc; } if (rcursor == None) cursor = NullCursor; else { - cursor = (CursorPtr) LookupIDByType(rcursor, RT_CURSOR); - if (!cursor) { + rc = dixLookupResource((pointer *)&cursor, rcursor, RT_CURSOR, + client, DixUseAccess); + if (rc != Success) + { client->errorValue = rcursor; - return BadCursor; + return (rc == BadValue) ? BadCursor : rc; } + access_mode |= DixForceAccess; } + if (this_device_mode == GrabModeSync || other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); + if (rc != Success) + return rc; grab = CreateGrab(client->index, dev, pWin, eventMask, (Bool) ownerEvents, (Bool) this_device_mode, @@ -569,6 +578,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, WindowPtr pWin; GrabPtr grab; KeyClassPtr k = dev->key; + Mask access_mode = DixGrabAccess; int rc; if (k == NULL) @@ -596,7 +606,12 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, BYTE this_device_mode, client->errorValue = ownerEvents; return BadValue; } - rc = dixLookupWindow(&pWin, grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, grabWindow, client, DixSetAttrAccess); + if (rc != Success) + return rc; + if (this_device_mode == GrabModeSync || other_devices_mode == GrabModeSync) + access_mode |= DixFreezeAccess; + rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, access_mode); if (rc != Success) return rc; @@ -837,7 +852,7 @@ SendEvent(ClientPtr client, DeviceIntPtr d, Window dest, Bool propagate, if (!mask) break; } - } else + } else if (!XaceHook(XACE_SEND_ACCESS, client, NULL, pWin, ev, count)) (void)(DeliverEventsToWindow(pWin, ev, count, mask, NullGrab, d->id)); return Success; } @@ -1101,7 +1116,8 @@ MaybeSendDeviceMotionNotifyHint(deviceKeyButtonPointer * pEvents, Mask mask) { DeviceIntPtr dev; - dev = LookupDeviceIntRec(pEvents->deviceid & DEVICE_BITS); + dixLookupDevice(&dev, pEvents->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); if (!dev) return 0; @@ -1125,7 +1141,8 @@ CheckDeviceGrabAndHintWindow(WindowPtr pWin, int type, { DeviceIntPtr dev; - dev = LookupDeviceIntRec(xE->deviceid & DEVICE_BITS); + dixLookupDevice(&dev, xE->deviceid & DEVICE_BITS, serverClient, + DixReadAccess); if (!dev) return; diff --git a/Xi/extinit.c b/Xi/extinit.c index 73bae5e85..1a435edad 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -856,29 +856,6 @@ MakeDeviceTypeAtoms(void) MakeAtom(dev_type[i].name, strlen(dev_type[i].name), 1); } -/************************************************************************** - * Return a DeviceIntPtr corresponding to a specified device id. - * - */ - -DeviceIntPtr -LookupDeviceIntRec(CARD8 id) -{ - DeviceIntPtr dev; - - for (dev = inputInfo.devices; dev; dev = dev->next) { - if (dev->id == id) - return dev; - } - - for (dev = inputInfo.off_devices; dev; dev = dev->next) { - if (dev->id == id) - return dev; - } - - return NULL; -} - /***************************************************************************** * * SEventIDispatch diff --git a/Xi/getbmap.c b/Xi/getbmap.c index ebb0613af..9f93b06ef 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getbmap.h" @@ -92,6 +91,7 @@ ProcXGetDeviceButtonMapping(ClientPtr client) DeviceIntPtr dev; xGetDeviceButtonMappingReply rep; ButtonClassPtr b; + int rc; REQUEST(xGetDeviceButtonMappingReq); REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq); @@ -102,9 +102,9 @@ ProcXGetDeviceButtonMapping(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; b = dev->button; if (b == NULL) diff --git a/Xi/getdctl.c b/Xi/getdctl.c index 8a84e91bc..3f2bb29ae 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getdctl.h" @@ -238,7 +237,7 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep) int ProcXGetDeviceControl(ClientPtr client) { - int total_length = 0; + int rc, total_length = 0; char *buf, *savbuf; DeviceIntPtr dev; xGetDeviceControlReply rep; @@ -246,9 +245,9 @@ ProcXGetDeviceControl(ClientPtr client) REQUEST(xGetDeviceControlReq); REQUEST_SIZE_MATCH(xGetDeviceControlReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; rep.repType = X_Reply; rep.RepType = X_GetDeviceControl; diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 7dff32f4f..1b1e594a2 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getfctl.h" @@ -290,7 +289,7 @@ SRepXGetFeedbackControl(ClientPtr client, int size, int ProcXGetFeedbackControl(ClientPtr client) { - int total_length = 0; + int rc, total_length = 0; char *buf, *savbuf; DeviceIntPtr dev; KbdFeedbackPtr k; @@ -304,9 +303,9 @@ ProcXGetFeedbackControl(ClientPtr client) REQUEST(xGetFeedbackControlReq); REQUEST_SIZE_MATCH(xGetFeedbackControlReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; rep.repType = X_Reply; rep.RepType = X_GetFeedbackControl; diff --git a/Xi/getfocus.c b/Xi/getfocus.c index 073913bf2..dfef22fb7 100644 --- a/Xi/getfocus.c +++ b/Xi/getfocus.c @@ -60,7 +60,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getfocus.h" @@ -93,12 +92,15 @@ ProcXGetDeviceFocus(ClientPtr client) DeviceIntPtr dev; FocusClassPtr focus; xGetDeviceFocusReply rep; + int rc; REQUEST(xGetDeviceFocusReq); REQUEST_SIZE_MATCH(xGetDeviceFocusReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL || !dev->focus) + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetFocusAccess); + if (rc != Success) + return rc; + if (!dev->focus) return BadDevice; rep.repType = X_Reply; diff --git a/Xi/getkmap.c b/Xi/getkmap.c index eaa0cffcc..0eec1d8df 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" @@ -94,13 +93,14 @@ ProcXGetDeviceKeyMapping(ClientPtr client) xGetDeviceKeyMappingReply rep; DeviceIntPtr dev; KeySymsPtr k; + int rc; REQUEST(xGetDeviceKeyMappingReq); REQUEST_SIZE_MATCH(xGetDeviceKeyMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; if (dev->key == NULL) return BadMatch; k = &dev->key->curKeySyms; diff --git a/Xi/getmmap.c b/Xi/getmmap.c index 8a99d63ed..c6c9c3362 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> /* Request macro */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getmmap.h" @@ -94,13 +93,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client) DeviceIntPtr dev; xGetDeviceModifierMappingReply rep; KeyClassPtr kp; + int rc; REQUEST(xGetDeviceModifierMappingReq); REQUEST_SIZE_MATCH(xGetDeviceModifierMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; kp = dev->key; if (kp == NULL) diff --git a/Xi/getprop.c b/Xi/getprop.c index 531e65f27..188f549e5 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structs */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" @@ -112,7 +111,7 @@ ProcXGetDeviceDontPropagateList(ClientPtr client) rep.length = 0; rep.count = 0; - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/getselev.c b/Xi/getselev.c index 819b2dbd0..caa376fcb 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window struct */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "swaprep.h" @@ -114,7 +113,7 @@ ProcXGetSelectedExtensionEvents(ClientPtr client) rep.this_client_count = 0; rep.all_clients_count = 0; - rc = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/getvers.c b/Xi/getvers.c index a223a5d1e..a4afe808f 100644 --- a/Xi/getvers.c +++ b/Xi/getvers.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "getvers.h" diff --git a/Xi/grabdev.c b/Xi/grabdev.c index b303695fd..110fc6b5f 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixevents.h" /* GrabDevice */ @@ -122,9 +121,9 @@ ProcXGrabDevice(ClientPtr client) rep.sequenceNumber = client->sequence; rep.length = 0; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); + if (rc != Success) + return rc; if ((rc = CreateMaskFromList(client, (XEventClass *) & stuff[1], stuff->event_count, tmp, dev, @@ -153,7 +152,7 @@ int CreateMaskFromList(ClientPtr client, XEventClass * list, int count, struct tmask *mask, DeviceIntPtr dev, int req) { - int i, j; + int rc, i, j; int device; DeviceIntPtr tdev; @@ -167,8 +166,10 @@ CreateMaskFromList(ClientPtr client, XEventClass * list, int count, if (device > 255) return BadClass; - tdev = LookupDeviceIntRec(device); - if (tdev == NULL || (dev != NULL && tdev != dev)) + rc = dixLookupDevice(&tdev, device, client, DixReadAccess); + if (rc != BadDevice && rc != Success) + return rc; + if (rc == BadDevice || (dev != NULL && tdev != dev)) return BadClass; for (j = 0; j < ExtEventIndex; j++) diff --git a/Xi/grabdevb.c b/Xi/grabdevb.c index 21e46fceb..7eb542232 100644 --- a/Xi/grabdevb.c +++ b/Xi/grabdevb.c @@ -61,7 +61,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "grabdev.h" @@ -117,14 +116,15 @@ ProcXGrabDeviceButton(ClientPtr client) (sizeof(xGrabDeviceButtonReq) >> 2) + stuff->event_count) return BadLength; - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (ret != Success) + return ret; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - return BadDevice; + ret = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (ret != Success) + return ret; if (mdev->key == NULL) return BadMatch; } else diff --git a/Xi/grabdevk.c b/Xi/grabdevk.c index 8da36ba8f..e187a4f7b 100644 --- a/Xi/grabdevk.c +++ b/Xi/grabdevk.c @@ -61,7 +61,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "grabdev.h" @@ -115,14 +114,15 @@ ProcXGrabDeviceKey(ClientPtr client) if (stuff->length != (sizeof(xGrabDeviceKeyReq) >> 2) + stuff->event_count) return BadLength; - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (ret != Success) + return ret; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) - return BadDevice; + ret = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (ret != Success) + return ret; if (mdev->key == NULL) return BadMatch; } else diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 51d4248cd..de22d0484 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -96,7 +95,7 @@ ProcXGetDeviceMotionEvents(ClientPtr client) INT32 *coords = NULL, *bufptr; xGetDeviceMotionEventsReply rep; unsigned long i; - int num_events, axes, size = 0, tsize; + int rc, num_events, axes, size = 0, tsize; unsigned long nEvents; DeviceIntPtr dev; TimeStamp start, stop; @@ -106,9 +105,9 @@ ProcXGetDeviceMotionEvents(ClientPtr client) REQUEST(xGetDeviceMotionEventsReq); REQUEST_SIZE_MATCH(xGetDeviceMotionEventsReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); + if (rc != Success) + return rc; v = dev->valuator; if (v == NULL || v->numAxes == 0) return BadMatch; diff --git a/Xi/listdev.c b/Xi/listdev.c index 160ad02fb..041de7635 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -63,8 +63,8 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "XIstubs.h" #include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" /* FIXME */ +#include "xace.h" #include "listdev.h" @@ -310,7 +310,7 @@ ProcXListInputDevices(ClientPtr client) xListInputDevicesReply rep; int numdevs = 0; int namesize = 1; /* need 1 extra byte for strcpy */ - int size = 0; + int rc, size = 0; int total_length; char *devbuf; char *classbuf; @@ -329,10 +329,16 @@ ProcXListInputDevices(ClientPtr client) AddOtherInputDevices(); for (d = inputInfo.devices; d; d = d->next) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess); + if (rc != Success) + return rc; SizeDeviceInfo(d, &namesize, &size); numdevs++; } for (d = inputInfo.off_devices; d; d = d->next) { + rc = XaceHook(XACE_DEVICE_ACCESS, client, d, DixGetAttrAccess); + if (rc != Success) + return rc; SizeDeviceInfo(d, &namesize, &size); numdevs++; } diff --git a/Xi/opendev.c b/Xi/opendev.c index dfefe055c..128b1bd9c 100644 --- a/Xi/opendev.c +++ b/Xi/opendev.c @@ -61,7 +61,6 @@ SOFTWARE. #include <X11/extensions/XIproto.h> #include "XIstubs.h" #include "windowstr.h" /* window structure */ -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "opendev.h" @@ -107,13 +106,15 @@ ProcXOpenDevice(ClientPtr client) stuff->deviceid == inputInfo.keyboard->id) return BadDevice; - if ((dev = LookupDeviceIntRec(stuff->deviceid)) == NULL) { /* not open */ + status = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); + if (status == BadDevice) { /* not open */ for (dev = inputInfo.off_devices; dev; dev = dev->next) if (dev->id == stuff->deviceid) break; if (dev == NULL) return BadDevice; - } + } else if (status != Success) + return status; OpenInputDevice(dev, client, &status); if (status != Success) diff --git a/Xi/queryst.c b/Xi/queryst.c index 2b66b7eb2..71ab79be8 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -42,7 +42,6 @@ from The Open Group. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -74,7 +73,7 @@ int ProcXQueryDeviceState(ClientPtr client) { char n; - int i; + int rc, i; int num_classes = 0; int total_length = 0; char *buf, *savbuf; @@ -96,9 +95,9 @@ ProcXQueryDeviceState(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); + if (rc != Success) + return rc; v = dev->valuator; if (v != NULL && v->motionHintWindow != NULL) diff --git a/Xi/selectev.c b/Xi/selectev.c index a5cf56754..b93618ace 100644 --- a/Xi/selectev.c +++ b/Xi/selectev.c @@ -61,7 +61,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -164,7 +163,7 @@ ProcXSelectExtensionEvent(ClientPtr client) if (stuff->length != (sizeof(xSelectExtensionEventReq) >> 2) + stuff->count) return BadLength; - ret = dixLookupWindow(&pWin, stuff->window, client, DixUnknownAccess); + ret = dixLookupWindow(&pWin, stuff->window, client, DixReceiveAccess); if (ret != Success) return ret; diff --git a/Xi/sendexev.c b/Xi/sendexev.c index 20b415a1f..e4e38d790 100644 --- a/Xi/sendexev.c +++ b/Xi/sendexev.c @@ -59,9 +59,9 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* Window */ +#include "extnsionst.h" /* EventSwapPtr */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" #include "exglobals.h" @@ -131,9 +131,9 @@ ProcXSendExtensionEvent(ClientPtr client) (stuff->num_events * (sizeof(xEvent) >> 2))) return BadLength; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixWriteAccess); + if (ret != Success) + return ret; /* The client's event type must be one defined by an extension. */ diff --git a/Xi/setbmap.c b/Xi/setbmap.c index 40f0f9a99..3035c649e 100644 --- a/Xi/setbmap.c +++ b/Xi/setbmap.c @@ -63,7 +63,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setbmap.h" @@ -110,9 +109,9 @@ ProcXSetDeviceButtonMapping(ClientPtr client) rep.sequenceNumber = client->sequence; rep.status = MappingSuccess; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (ret != Success) + return ret; ret = SetButtonMapping(client, dev, stuff->map_length, (BYTE *) & stuff[1]); diff --git a/Xi/setdval.c b/Xi/setdval.c index cb35b9157..b1e22fc21 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setdval.h" @@ -92,6 +91,7 @@ ProcXSetDeviceValuators(ClientPtr client) { DeviceIntPtr dev; xSetDeviceValuatorsReply rep; + int rc; REQUEST(xSetDeviceValuatorsReq); REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq); @@ -106,9 +106,9 @@ ProcXSetDeviceValuators(ClientPtr client) stuff->num_valuators) return BadLength; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (rc != Success) + return rc; if (dev->valuator == NULL) return BadMatch; diff --git a/Xi/setfocus.c b/Xi/setfocus.c index 74de17e97..c6edbc2e5 100644 --- a/Xi/setfocus.c +++ b/Xi/setfocus.c @@ -63,7 +63,6 @@ SOFTWARE. #include "dixevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setfocus.h" @@ -102,8 +101,10 @@ ProcXSetDeviceFocus(ClientPtr client) REQUEST(xSetDeviceFocusReq); REQUEST_SIZE_MATCH(xSetDeviceFocusReq); - dev = LookupDeviceIntRec(stuff->device); - if (dev == NULL || !dev->focus) + ret = dixLookupDevice(&dev, stuff->device, client, DixSetFocusAccess); + if (ret != Success) + return ret; + if (!dev->focus) return BadDevice; ret = SetInputFocus(client, dev, stuff->focus, stuff->revertTo, diff --git a/Xi/setmmap.c b/Xi/setmmap.c index 19ec71bbe..be3d3cb6c 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "exevents.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setmmap.h" @@ -99,9 +98,9 @@ ProcXSetDeviceModifierMapping(ClientPtr client) REQUEST(xSetDeviceModifierMappingReq); REQUEST_AT_LEAST_SIZE(xSetDeviceModifierMappingReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + ret = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (ret != Success) + return ret; rep.repType = X_Reply; rep.RepType = X_SetDeviceModifierMapping; diff --git a/Xi/setmode.c b/Xi/setmode.c index 957721c66..8b6003ad0 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -60,7 +60,6 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "setmode.h" @@ -92,6 +91,7 @@ ProcXSetDeviceMode(ClientPtr client) { DeviceIntPtr dev; xSetDeviceModeReply rep; + int rc; REQUEST(xSetDeviceModeReq); REQUEST_SIZE_MATCH(xSetDeviceModeReq); @@ -101,9 +101,9 @@ ProcXSetDeviceMode(ClientPtr client) rep.length = 0; rep.sequenceNumber = client->sequence; - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); + if (rc != Success) + return rc; if (dev->valuator == NULL) return BadMatch; if ((dev->grab) && !SameClient(dev->grab, client)) diff --git a/Xi/stubs.c b/Xi/stubs.c index 40cd02fe1..80ddd73c0 100644 --- a/Xi/stubs.c +++ b/Xi/stubs.c @@ -65,6 +65,7 @@ SOFTWARE. #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> #include "XIstubs.h" +#include "xace.h" /*********************************************************************** * @@ -153,6 +154,7 @@ AddOtherInputDevices(void) void OpenInputDevice(DeviceIntPtr dev, ClientPtr client, int *status) { + *status = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixReadAccess); } /**************************************************************************** diff --git a/Xi/ungrdev.c b/Xi/ungrdev.c index 505d6690f..7abb1d061 100644 --- a/Xi/ungrdev.c +++ b/Xi/ungrdev.c @@ -59,7 +59,6 @@ SOFTWARE. #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "ungrdev.h" @@ -94,13 +93,14 @@ ProcXUngrabDevice(ClientPtr client) DeviceIntPtr dev; GrabPtr grab; TimeStamp time; + int rc; REQUEST(xUngrabDeviceReq); REQUEST_SIZE_MATCH(xUngrabDeviceReq); - dev = LookupDeviceIntRec(stuff->deviceid); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); + if (rc != Success) + return rc; grab = dev->grab; time = ClientTimeToServerTime(stuff->time); diff --git a/Xi/ungrdevb.c b/Xi/ungrdevb.c index 0dfe805b7..85ca5c6ce 100644 --- a/Xi/ungrdevb.c +++ b/Xi/ungrdevb.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" @@ -107,22 +106,23 @@ ProcXUngrabDeviceButton(ClientPtr client) REQUEST(xUngrabDeviceButtonReq); REQUEST_SIZE_MATCH(xUngrabDeviceButtonReq); - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (rc != Success) + return rc; if (dev->button == NULL) return BadMatch; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) + rc = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (rc != Success) return BadDevice; if (mdev->key == NULL) return BadMatch; } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; diff --git a/Xi/ungrdevk.c b/Xi/ungrdevk.c index e6307af01..ac4003569 100644 --- a/Xi/ungrdevk.c +++ b/Xi/ungrdevk.c @@ -60,7 +60,6 @@ SOFTWARE. #include "windowstr.h" /* window structure */ #include <X11/extensions/XI.h> #include <X11/extensions/XIproto.h> -#include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" #include "dixgrabs.h" @@ -107,22 +106,23 @@ ProcXUngrabDeviceKey(ClientPtr client) REQUEST(xUngrabDeviceKeyReq); REQUEST_SIZE_MATCH(xUngrabDeviceKeyReq); - dev = LookupDeviceIntRec(stuff->grabbed_device); - if (dev == NULL) - return BadDevice; + rc = dixLookupDevice(&dev, stuff->grabbed_device, client, DixGrabAccess); + if (rc != Success) + return rc; if (dev->key == NULL) return BadMatch; if (stuff->modifier_device != UseXKeyboard) { - mdev = LookupDeviceIntRec(stuff->modifier_device); - if (mdev == NULL) + rc = dixLookupDevice(&mdev, stuff->modifier_device, client, + DixReadAccess); + if (rc != Success) return BadDevice; if (mdev->key == NULL) return BadMatch; } else mdev = (DeviceIntPtr) LookupKeyboardDevice(); - rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixUnknownAccess); + rc = dixLookupWindow(&pWin, stuff->grabWindow, client, DixSetAttrAccess); if (rc != Success) return rc; |