diff options
author | Paulo Ricardo Zanoni <prz05@c3sl.ufpr.br> | 2007-07-10 10:14:47 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-07-10 10:14:47 +0930 |
commit | 25c023f91851a4b32b295b6d5633f6ee87d0ba14 (patch) | |
tree | f5c559187f02154b599b234c45328250b9c8755e /src | |
parent | caa4ab9a959140119c6c2fd12a379b55b0dff258 (diff) |
Access control: change calls to use XID* instead of char*.
X{Deny|Perm}Devices: clear perm/deny list if called with no devices.
Diffstat (limited to 'src')
-rw-r--r-- | src/XDenyDev.c | 12 | ||||
-rw-r--r-- | src/XGetCPtr.c | 2 | ||||
-rw-r--r-- | src/XGetPairP.c | 2 | ||||
-rw-r--r-- | src/XPermDev.c | 12 | ||||
-rw-r--r-- | src/XQryAccRl.c | 14 |
5 files changed, 25 insertions, 17 deletions
diff --git a/src/XDenyDev.c b/src/XDenyDev.c index d4f9ca2..686ef12 100644 --- a/src/XDenyDev.c +++ b/src/XDenyDev.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "XIint.h" Status -XDenyDevices(Display* dpy, Window win, char* devices, int count) +XDenyDevices(Display* dpy, Window win, XID* devices, int count) { xChangeWindowAccessReq* req; @@ -52,12 +52,16 @@ XDenyDevices(Display* dpy, Window win, char* devices, int count) req->reqType = info->codes->major_opcode; req->ReqType = X_ChangeWindowAccess; req->win = win; - req->clear = WindowAccessClearNone; + /* If list is empty, clear all devices */ + if (!count) + req->clear = WindowAccessClearDeny; + else + req->clear = WindowAccessClearNone; req->defaultRule = WindowAccessKeepRule; req->ndeny = count; - req->length += (count + 3) >> 2; + req->length += (count * sizeof(XID) + 3) >> 2; req->npermit = 0; - Data(dpy, devices, count); + Data(dpy, (char*)devices, count * sizeof(XID)); UnlockDisplay(dpy); SyncHandle(); diff --git a/src/XGetCPtr.c b/src/XGetCPtr.c index 33bd30b..0944ee1 100644 --- a/src/XGetCPtr.c +++ b/src/XGetCPtr.c @@ -41,7 +41,7 @@ Bool XGetClientPointer(dpy, win, deviceid) Display* dpy; Window win; - int* deviceid; + XID* deviceid; { xGetClientPointerReq *req; xGetClientPointerReply rep; diff --git a/src/XGetPairP.c b/src/XGetPairP.c index 6d0475d..c84f4bf 100644 --- a/src/XGetPairP.c +++ b/src/XGetPairP.c @@ -41,7 +41,7 @@ Bool XGetPairedPointer(dpy, keyboard, deviceid) Display* dpy; XDevice* keyboard; - int* deviceid; + XID* deviceid; { xGetPairedPointerReq *req; xGetPairedPointerReply rep; diff --git a/src/XPermDev.c b/src/XPermDev.c index 66def1c..1e5cd1e 100644 --- a/src/XPermDev.c +++ b/src/XPermDev.c @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #include "XIint.h" Status -XPermitDevices(Display* dpy, Window win, char* devices, int count) +XPermitDevices(Display* dpy, Window win, XID* devices, int count) { xChangeWindowAccessReq* req; @@ -52,12 +52,16 @@ XPermitDevices(Display* dpy, Window win, char* devices, int count) req->reqType = info->codes->major_opcode; req->ReqType = X_ChangeWindowAccess; req->win = win; - req->clear = WindowAccessClearNone; + /* If list is empty, clear all devices */ + if (! count) + req->clear = WindowAccessClearPerm; + else + req->clear = WindowAccessClearNone; req->defaultRule = WindowAccessKeepRule; req->npermit = count; - req->length += (count + 3) >> 2; + req->length += (count * sizeof(XID) + 3) >> 2; req->ndeny = 0; - Data(dpy, devices, count); + Data(dpy, (char*)devices, count * sizeof(XID)); UnlockDisplay(dpy); SyncHandle(); diff --git a/src/XQryAccRl.c b/src/XQryAccRl.c index 74b76cc..0896b8a 100644 --- a/src/XQryAccRl.c +++ b/src/XQryAccRl.c @@ -41,9 +41,9 @@ Status XQueryWindowAccess(Display* dpy, Window win, int* rule, - char** permdevs, + XID** permdevs, int* nperm, - char** denydevs, + XID** denydevs, int* ndeny) { xQueryWindowAccessReq* req; @@ -69,7 +69,7 @@ XQueryWindowAccess(Display* dpy, *rule = rep.defaultRule; *nperm = rep.npermit; *ndeny = rep.ndeny; - *permdevs = (char*)Xmalloc(*nperm * sizeof(int)); + *permdevs = (XID *)Xmalloc(*nperm * sizeof(XID)); if (!*permdevs) { _XEatData(dpy, (unsigned long)rep.length << 2); @@ -78,7 +78,7 @@ XQueryWindowAccess(Display* dpy, return BadImplementation; } - *denydevs = (char*)Xmalloc(*ndeny * sizeof(int)); + *denydevs = (XID*)Xmalloc(*ndeny * sizeof(XID)); if (!*denydevs) { _XEatData(dpy, (unsigned long)rep.length << 2); @@ -86,11 +86,11 @@ XQueryWindowAccess(Display* dpy, SyncHandle(); return BadImplementation; } - _XRead(dpy, *permdevs, *nperm); - _XRead(dpy, *denydevs, *ndeny); + _XRead(dpy, (char*)*permdevs, *nperm * sizeof(XID)); + _XRead(dpy, (char*)*denydevs, *ndeny * sizeof(XID)); /* discard padding */ - _XEatData(dpy, (rep.length << 2) - *ndeny - *nperm); + _XEatData(dpy, (rep.length << 2) - (*ndeny * sizeof(XID)) - (*nperm * sizeof(XID))); UnlockDisplay(dpy); SyncHandle(); |