diff options
author | Peter Hutterer <peter.hutterer@redhat.com> | 2008-10-31 16:40:41 +1030 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@redhat.com> | 2008-11-04 16:04:15 +1030 |
commit | d97239956667f8181f30271759573b75bf455fbb (patch) | |
tree | 9d39488c657248ef68eee1afd8b925f8f3c64fee /Xi | |
parent | cbc6f983959595aa21c9dd72fac6a7070a650ef7 (diff) |
Purge device-based WindowAccess code.
Really, this was a bad idea. It's not security, the UI features that would
have been cool (e.g. clicking through windows) aren't implemented anyway, and
there's nothing you can't achieve just by using plain XI anyway.
Requires inputproto 1.9.99.6.
Diffstat (limited to 'Xi')
-rw-r--r-- | Xi/Makefile.am | 4 | ||||
-rw-r--r-- | Xi/chaccess.c | 158 | ||||
-rw-r--r-- | Xi/chaccess.h | 36 | ||||
-rw-r--r-- | Xi/extinit.c | 25 | ||||
-rw-r--r-- | Xi/qryacces.c | 121 | ||||
-rw-r--r-- | Xi/qryacces.h | 38 |
6 files changed, 8 insertions, 374 deletions
diff --git a/Xi/Makefile.am b/Xi/Makefile.am index 768f996cc..09dd41d0e 100644 --- a/Xi/Makefile.am +++ b/Xi/Makefile.am @@ -21,8 +21,6 @@ libXi_la_SOURCES = \ chgprop.h \ chgptr.c \ chgptr.h \ - chaccess.c \ - chaccess.h \ closedev.c \ closedev.h \ devbell.c \ @@ -68,8 +66,6 @@ libXi_la_SOURCES = \ querydp.h \ queryst.c \ queryst.h \ - qryacces.c \ - qryacces.h \ selectev.c \ selectev.h \ sendexev.c \ diff --git a/Xi/chaccess.c b/Xi/chaccess.c deleted file mode 100644 index a6798b793..000000000 --- a/Xi/chaccess.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright 2007-2008 Peter Hutterer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Peter Hutterer, University of South Australia, NICTA - */ - -#define NEED_EVENTS -#define NEED_REPLIES -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> /* for inputstr.h */ -#include <X11/Xproto.h> /* Request macro */ -#include "inputstr.h" /* DeviceIntPtr */ -#include "windowstr.h" /* window structure */ -#include "scrnintstr.h" /* screen structure */ -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "extnsionst.h" -#include "exevents.h" -#include "exglobals.h" - -#include "chaccess.h" - -/*********************************************************************** - * This procedure allows a client to change window access control. - */ - -int -SProcXChangeWindowAccess(ClientPtr client) -{ - char n; - REQUEST(xChangeWindowAccessReq); - - swaps(&stuff->length, n); - swapl(&stuff->win, n); - return ProcXChangeWindowAccess(client); -} - -int -ProcXChangeWindowAccess(ClientPtr client) -{ - int padding, rc, i; - XID* deviceids = NULL; - WindowPtr win; - DeviceIntPtr* perm_devices = NULL; - DeviceIntPtr* deny_devices = NULL; - REQUEST(xChangeWindowAccessReq); - REQUEST_AT_LEAST_SIZE(xChangeWindowAccessReq); - - - padding = (4 - (((stuff->npermit + stuff->ndeny) * sizeof(XID)) % 4)) % 4; - - if (stuff->length != ((sizeof(xChangeWindowAccessReq) + - (((stuff->npermit + stuff->ndeny) * sizeof(XID)) + padding)) >> 2)) - { - return BadLength; - } - - - rc = dixLookupWindow(&win, stuff->win, client, DixWriteAccess); - if (rc != Success) - { - return rc; - } - - /* Are we clearing? if so, ignore the rest */ - if (stuff->clear) - { - rc = ACClearWindowAccess(client, win, stuff->clear); - return rc; - } - - if (stuff->npermit || stuff->ndeny) - deviceids = (XID*)&stuff[1]; - - if (stuff->npermit) - { - perm_devices = - (DeviceIntPtr*)xalloc(stuff->npermit * sizeof(DeviceIntPtr)); - if (!perm_devices) - { - ErrorF("[Xi] ProcXChangeWindowAccess: alloc failure.\n"); - return BadImplementation; - } - - /* if one of the devices cannot be accessed, we don't do anything.*/ - for (i = 0; i < stuff->npermit; i++) - { - rc = dixLookupDevice(&perm_devices[i], deviceids[i], client, - DixWriteAccess); - if (rc != Success) - { - xfree(perm_devices); - return rc; - } - } - } - - if (stuff->ndeny) - { - deny_devices = - (DeviceIntPtr*)xalloc(stuff->ndeny * sizeof(DeviceIntPtr)); - if (!deny_devices) - { - ErrorF("[Xi] ProcXChangeWindowAccecss: alloc failure.\n"); - xfree(perm_devices); - return BadImplementation; - } - - for (i = 0; i < stuff->ndeny; i++) - { - rc = dixLookupDevice(&deny_devices[i], - deviceids[i+stuff->npermit], - client, - DixWriteAccess); - if (rc != Success) - { - xfree(perm_devices); - xfree(deny_devices); - return rc; - } - } - } - - rc = ACChangeWindowAccess(client, win, stuff->defaultRule, - perm_devices, stuff->npermit, - deny_devices, stuff->ndeny); - if (rc != Success) - { - return rc; - } - - xfree(perm_devices); - xfree(deny_devices); - return Success; -} - diff --git a/Xi/chaccess.h b/Xi/chaccess.h deleted file mode 100644 index baea69ca2..000000000 --- a/Xi/chaccess.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2007-2008 Peter Hutterer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Peter Hutterer, University of South Australia, NICTA - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef CHACCESS_H -#define CHACCESS_H 1 - -int SProcXChangeWindowAccess(ClientPtr /* client */); -int ProcXChangeWindowAccess(ClientPtr /* client */); - -#endif /* CHACCESS_H */ diff --git a/Xi/extinit.c b/Xi/extinit.c index e222de6ed..673a7ee15 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -76,7 +76,6 @@ SOFTWARE. /* modules local to Xi */ #include "allowev.h" -#include "chaccess.h" #include "chdevcur.h" #include "chgdctl.h" #include "chdevhier.h" @@ -105,7 +104,6 @@ SOFTWARE. #include "gtmotion.h" #include "listdev.h" #include "opendev.h" -#include "qryacces.h" #include "querydp.h" #include "queryst.h" #include "selectev.h" @@ -219,12 +217,10 @@ static int (*ProcIVector[])(ClientPtr) = { ProcXWarpDevicePointer, /* 41 */ ProcXChangeDeviceCursor, /* 42 */ ProcXChangeDeviceHierarchy, /* 43 */ - ProcXChangeWindowAccess, /* 44 */ - ProcXQueryWindowAccess, /* 45 */ - ProcXSetClientPointer, /* 46 */ - ProcXGetClientPointer, /* 47 */ - ProcXiSelectEvent, /* 48 */ - ProcXExtendedGrabDevice /* 49 */ + ProcXSetClientPointer, /* 44 */ + ProcXGetClientPointer, /* 45 */ + ProcXiSelectEvent, /* 46 */ + ProcXExtendedGrabDevice /* 47 */ }; /* For swapped clients */ @@ -273,12 +269,10 @@ static int (*SProcIVector[])(ClientPtr) = { SProcXWarpDevicePointer, /* 41 */ SProcXChangeDeviceCursor, /* 42 */ SProcXChangeDeviceHierarchy, /* 43 */ - SProcXChangeWindowAccess, /* 44 */ - SProcXQueryWindowAccess, /* 45 */ - SProcXSetClientPointer, /* 46 */ - SProcXGetClientPointer, /* 47 */ - SProcXiSelectEvent, /* 48 */ - SProcXExtendedGrabDevice /* 49 */ + SProcXSetClientPointer, /* 44 */ + SProcXGetClientPointer, /* 45 */ + SProcXiSelectEvent, /* 46 */ + SProcXExtendedGrabDevice /* 47 */ }; /***************************************************************** @@ -481,9 +475,6 @@ SReplyIDispatch(ClientPtr client, int len, xGrabDeviceReply * rep) else if (rep->RepType == X_QueryDevicePointer) SRepXQueryDevicePointer(client, len, (xQueryDevicePointerReply *) rep); - else if (rep->RepType == X_QueryWindowAccess) - SRepXQueryWindowAccess(client, len, - (xQueryWindowAccessReply*) rep); else if (rep->RepType == X_GetClientPointer) SRepXGetClientPointer(client, len, (xGetClientPointerReply*) rep); else if (rep->RepType == X_ExtendedGrabDevice) diff --git a/Xi/qryacces.c b/Xi/qryacces.c deleted file mode 100644 index 99221ea7e..000000000 --- a/Xi/qryacces.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2007-2008 Peter Hutterer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Peter Hutterer, University of South Australia, NICTA - */ - -#define NEED_EVENTS -#define NEED_REPLIES -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#include <X11/X.h> /* for inputstr.h */ -#include <X11/Xproto.h> /* Request macro */ -#include "inputstr.h" /* DeviceIntPtr */ -#include "windowstr.h" /* window structure */ -#include "scrnintstr.h" /* screen structure */ -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "extnsionst.h" -#include "extinit.h" /* LookupDeviceIntRec */ -#include "exevents.h" -#include "exglobals.h" - -#include "qryacces.h" - -/*********************************************************************** - * This procedure allows a client to query window access control. - */ - -int -SProcXQueryWindowAccess(ClientPtr client) -{ - char n; - REQUEST(xQueryWindowAccessReq); - - swaps(&stuff->length, n); - swapl(&stuff->win, n); - return ProcXQueryWindowAccess(client); -} - -int -ProcXQueryWindowAccess(ClientPtr client) -{ - int rc; - WindowPtr win; - DeviceIntPtr *perm, *deny; - int nperm, ndeny, i; - int defaultRule; - XID* deviceids; - xQueryWindowAccessReply rep; - - REQUEST(xQueryWindowAccessReq); - REQUEST_SIZE_MATCH(xQueryWindowAccessReq); - - rc = dixLookupWindow(&win, stuff->win, client, DixReadAccess); - if (rc != Success) - { - return rc; - } - - ACQueryWindowAccess(win, &defaultRule, &perm, &nperm, &deny, &ndeny); - - rep.repType = X_Reply; - rep.RepType = X_QueryWindowAccess; - rep.sequenceNumber = client->sequence; - rep.length = ((nperm + ndeny) * sizeof(XID) + 3) >> 2; - rep.defaultRule = defaultRule; - rep.npermit = nperm; - rep.ndeny = ndeny; - WriteReplyToClient(client, sizeof(xQueryWindowAccessReply), &rep); - - if (nperm + ndeny) - { - deviceids = (XID*)xalloc((nperm + ndeny) * sizeof(XID)); - if (!deviceids) - { - ErrorF("[Xi] ProcXQueryWindowAccess: xalloc failure.\n"); - return BadImplementation; - } - - for (i = 0; i < nperm; i++) - deviceids[i] = perm[i]->id; - for (i = 0; i < ndeny; i++) - deviceids[i + nperm] = deny[i]->id; - - WriteToClient(client, (nperm + ndeny) * sizeof(XID), (char*)deviceids); - xfree(deviceids); - } - return Success; -} - -void -SRepXQueryWindowAccess(ClientPtr client, - int size, - xQueryWindowAccessReply* rep) -{ - char n; - swaps(&rep->sequenceNumber, n); - swapl(&rep->length, n); - WriteToClient(client, size, (char*)rep); -} diff --git a/Xi/qryacces.h b/Xi/qryacces.h deleted file mode 100644 index 238cdba9a..000000000 --- a/Xi/qryacces.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2007-2008 Peter Hutterer - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Peter Hutterer, University of South Australia, NICTA - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif - -#ifndef QRYACCES_H -#define QRYACCES_H 1 - -int SProcXQueryWindowAccess(ClientPtr /* client */); -int ProcXQueryWindowAccess(ClientPtr /* client */); -void SRepXQueryWindowAccess(ClientPtr /* client */, - int /* size */, - xQueryWindowAccessReply* /* rep */); -#endif |