xserver: Branch 'mpx'
Peter Hutterer
whot at kemper.freedesktop.org
Sun Aug 26 18:08:38 PDT 2007
dix/access.c | 33 ++++++++++++++++++++++++++++++---
dix/events.c | 6 ++++--
include/input.h | 3 ++-
3 files changed, 36 insertions(+), 6 deletions(-)
New commits:
diff-tree 88a9828ef906bba973debc191e35ea669b7ec271 (from 2c1431a76e7219e3bd14fd7f7888a8bc4fea0f58)
Author: Peter Hutterer <peter at cs.unisa.edu.au>
Date: Thu Aug 23 18:02:10 2007 +0930
dix: Only check device events for possible ACLs.
We shouldn't be able to restrict events like Expose, etc. with device based
ACLs. So we just ignore all non-input events when checking for permissions.
diff --git a/dix/access.c b/dix/access.c
index 970d7c4..2015716 100644
--- a/dix/access.c
+++ b/dix/access.c
@@ -36,6 +36,7 @@ from the author.
#include <X11/Xlib.h>
#include <X11/extensions/XI.h>
+#include "exglobals.h"
#include "input.h"
#include "inputstr.h"
@@ -257,15 +258,41 @@ ACQueryWindowAccess(WindowPtr win,
* If no rule could be found, allow.
*/
Bool
-ACDeviceAllowed(WindowPtr win, DeviceIntPtr dev)
+ACDeviceAllowed(WindowPtr win, DeviceIntPtr dev, xEvent* xE)
{
int i;
if (!win) /* happens for parent of RootWindow */
return True;
+ /* there's a number of events we don't care about */
+ switch (xE->u.u.type)
+ {
+ case ButtonPress:
+ case ButtonRelease:
+ case MotionNotify:
+ case EnterNotify:
+ case LeaveNotify:
+ case KeyPress:
+ case KeyRelease:
+ break;
+ default:
+ if (xE->u.u.type == DeviceMotionNotify ||
+ xE->u.u.type == DeviceButtonPress ||
+ xE->u.u.type == DeviceButtonRelease ||
+ xE->u.u.type == DeviceKeyPress ||
+ xE->u.u.type == DeviceKeyRelease ||
+ xE->u.u.type == DeviceEnterNotify ||
+ xE->u.u.type == DeviceLeaveNotify)
+ {
+ break;
+ }
+ return True;
+ }
+
+
if (!win->optional) /* no list, check parent */
- return ACDeviceAllowed(win->parent, dev);
+ return ACDeviceAllowed(win->parent, dev, xE);
for (i = 0; i < win->optional->access.nperm; i++)
{
@@ -282,6 +309,6 @@ ACDeviceAllowed(WindowPtr win, DeviceInt
return False;
}
- return ACDeviceAllowed(win->parent, dev);
+ return ACDeviceAllowed(win->parent, dev, xE);
}
diff --git a/dix/events.c b/dix/events.c
index 4c9ca3b..0f413a6 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1928,8 +1928,10 @@ DeliverEventsToWindow(DeviceIntPtr pDev,
/* if a is denied, we return 0. This could cause the caller to
* traverse the parent. May be bad! (whot) */
- if (!ACDeviceAllowed(pWin, pDev))
+ if (!ACDeviceAllowed(pWin, pDev, pEvents))
+ {
return 0;
+ }
/* CantBeFiltered means only window owner gets the event */
if ((filter == CantBeFiltered) ||
@@ -3348,7 +3350,7 @@ DeliverGrabbedEvent(xEvent *xE, DeviceIn
}
if (!deliveries)
{
- if (ACDeviceAllowed(grab->window, thisDev))
+ if (ACDeviceAllowed(grab->window, thisDev, xE))
{
if (xE->u.u.type == GenericEvent)
{
diff --git a/include/input.h b/include/input.h
index 6443a58..d86a969 100644
--- a/include/input.h
+++ b/include/input.h
@@ -495,7 +495,8 @@ extern void ACQueryWindowAccess(WindowPt
int* ndeny);
extern Bool ACDeviceAllowed(WindowPtr win,
- DeviceIntPtr dev);
+ DeviceIntPtr dev,
+ xEvent* xE);
/* Implemented by the DDX. */
extern int NewInputDeviceRequest(
More information about the xorg-commit
mailing list