aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/xace.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext/xace.c')
-rw-r--r--xorg-server/Xext/xace.c159
1 files changed, 84 insertions, 75 deletions
diff --git a/xorg-server/Xext/xace.c b/xorg-server/Xext/xace.c
index 9d2d2fa51..02a0c1ebc 100644
--- a/xorg-server/Xext/xace.c
+++ b/xorg-server/Xext/xace.c
@@ -1,6 +1,6 @@
/************************************************************
-Author: Eamon Walsh <ewalsh@epoch.ncsc.mil>
+Author: Eamon Walsh <ewalsh@tycho.nsa.gov>
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
@@ -31,7 +31,12 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "gcstruct.h"
#include "xacestr.h"
-CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
+#define XSERV_t
+#define TRANS_SERVER
+#include <X11/Xtrans/Xtrans.h>
+#include "../os/osdep.h"
+
+_X_EXPORT CallbackListPtr XaceHooks[XACE_NUM_HOOKS] = {0};
/* Special-cased hook functions. Called by Xserver.
*/
@@ -97,114 +102,104 @@ int XaceHook(int hook, ...)
switch (hook)
{
case XACE_RESOURCE_ACCESS: {
- XaceResourceAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, XID),
- va_arg(ap, RESTYPE),
- va_arg(ap, pointer),
- va_arg(ap, RESTYPE),
- va_arg(ap, pointer),
- va_arg(ap, Mask),
- Success /* default allow */
- };
+ XaceResourceAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.id = va_arg(ap, XID);
+ rec.rtype = va_arg(ap, RESTYPE);
+ rec.res = va_arg(ap, pointer);
+ rec.ptype = va_arg(ap, RESTYPE);
+ rec.parent = va_arg(ap, pointer);
+ rec.access_mode = va_arg(ap, Mask);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_DEVICE_ACCESS: {
- XaceDeviceAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, DeviceIntPtr),
- va_arg(ap, Mask),
- Success /* default allow */
- };
+ XaceDeviceAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.dev = va_arg(ap, DeviceIntPtr);
+ rec.access_mode = va_arg(ap, Mask);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_SEND_ACCESS: {
- XaceSendAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, DeviceIntPtr),
- va_arg(ap, WindowPtr),
- va_arg(ap, xEventPtr),
- va_arg(ap, int),
- Success /* default allow */
- };
+ XaceSendAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.dev = va_arg(ap, DeviceIntPtr);
+ rec.pWin = va_arg(ap, WindowPtr);
+ rec.events = va_arg(ap, xEventPtr);
+ rec.count = va_arg(ap, int);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_RECEIVE_ACCESS: {
- XaceReceiveAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, WindowPtr),
- va_arg(ap, xEventPtr),
- va_arg(ap, int),
- Success /* default allow */
- };
+ XaceReceiveAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.pWin = va_arg(ap, WindowPtr);
+ rec.events = va_arg(ap, xEventPtr);
+ rec.count = va_arg(ap, int);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_CLIENT_ACCESS: {
- XaceClientAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, ClientPtr),
- va_arg(ap, Mask),
- Success /* default allow */
- };
+ XaceClientAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.target = va_arg(ap, ClientPtr);
+ rec.access_mode = va_arg(ap, Mask);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_EXT_ACCESS: {
- XaceExtAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, ExtensionEntry*),
- DixGetAttrAccess,
- Success /* default allow */
- };
+ XaceExtAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.ext = va_arg(ap, ExtensionEntry*);
+ rec.access_mode = DixGetAttrAccess;
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_SERVER_ACCESS: {
- XaceServerAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, Mask),
- Success /* default allow */
- };
+ XaceServerAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.access_mode = va_arg(ap, Mask);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_SCREEN_ACCESS:
case XACE_SCREENSAVER_ACCESS: {
- XaceScreenAccessRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, ScreenPtr),
- va_arg(ap, Mask),
- Success /* default allow */
- };
+ XaceScreenAccessRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.screen = va_arg(ap, ScreenPtr);
+ rec.access_mode = va_arg(ap, Mask);
+ rec.status = Success; /* default allow */
calldata = &rec;
prv = &rec.status;
break;
}
case XACE_AUTH_AVAIL: {
- XaceAuthAvailRec rec = {
- va_arg(ap, ClientPtr),
- va_arg(ap, XID)
- };
+ XaceAuthAvailRec rec;
+ rec.client = va_arg(ap, ClientPtr);
+ rec.authId = va_arg(ap, XID);
calldata = &rec;
break;
}
case XACE_KEY_AVAIL: {
- XaceKeyAvailRec rec = {
- va_arg(ap, xEventPtr),
- va_arg(ap, DeviceIntPtr),
- va_arg(ap, int)
- };
+ XaceKeyAvailRec rec;
+ rec.event = va_arg(ap, xEventPtr);
+ rec.keybd = va_arg(ap, DeviceIntPtr);
+ rec.count = va_arg(ap, int);
calldata = &rec;
break;
}
@@ -241,15 +236,14 @@ int XaceHook(int hook, ...)
* region of the window will be destroyed (overwritten) in pBuf.
*/
void
-XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
- format, pBuf)
- ClientPtr client;
- RegionPtr pVisibleRegion;
- long widthBytesLine;
- DrawablePtr pDraw;
- int x, y, w, h;
- unsigned int format;
- char * pBuf;
+XaceCensorImage(
+ ClientPtr client,
+ RegionPtr pVisibleRegion,
+ long widthBytesLine,
+ DrawablePtr pDraw,
+ int x, int y, int w, int h,
+ unsigned int format,
+ char *pBuf)
{
ScreenPtr pScreen;
RegionRec imageRegion; /* region representing x,y,w,h */
@@ -282,7 +276,7 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
/* convert region to list-of-rectangles for PolyFillRect */
- pRects = (xRectangle *)xalloc(nRects * sizeof(xRectangle));
+ pRects = xalloc(nRects * sizeof(xRectangle));
if (!pRects)
{
failed = TRUE;
@@ -341,3 +335,18 @@ XaceCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h,
REGION_UNINIT(pScreen, &imageRegion);
REGION_UNINIT(pScreen, &censorRegion);
} /* XaceCensorImage */
+
+/*
+ * Xtrans wrappers for use by modules
+ */
+int XaceGetConnectionNumber(ClientPtr client)
+{
+ XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+ return _XSERVTransGetConnectionNumber(ci);
+}
+
+int XaceIsLocal(ClientPtr client)
+{
+ XtransConnInfo ci = ((OsCommPtr)client->osPrivate)->trans_conn;
+ return _XSERVTransIsLocal(ci);
+}