summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2006-08-25 18:17:01 -0400
committerEamon Walsh <ewalsh@moss-uranus.epoch.ncsc.mil>2006-08-25 18:17:01 -0400
commit13c6713c82763a85c725c998b37ad02156d803ba (patch)
treec8a3c6c08607acda2d6178d3d8b3ce50b680e277
parent52ba722e4c89c052609b4fc62e965d92778aa2dd (diff)
Add four new XACE hooks: auditing, key event notification, window init
-rw-r--r--Xext/xace.c33
-rw-r--r--Xext/xace.h6
-rw-r--r--Xext/xacestr.h20
-rw-r--r--dix/dispatch.c8
-rw-r--r--dix/events.c4
-rw-r--r--dix/window.c8
6 files changed, 78 insertions, 1 deletions
diff --git a/Xext/xace.c b/Xext/xace.c
index 29853b38b..44aaa421d 100644
--- a/Xext/xace.c
+++ b/Xext/xace.c
@@ -169,6 +169,39 @@ int XaceHook(int hook, ...)
calldata = &rec;
break;
}
+ case XACE_KEY_AVAIL: {
+ XaceKeyAvailRec rec = {
+ va_arg(ap, xEventPtr),
+ va_arg(ap, DeviceIntPtr),
+ va_arg(ap, int)
+ };
+ calldata = &rec;
+ break;
+ }
+ case XACE_WINDOW_INIT: {
+ XaceWindowRec rec = {
+ va_arg(ap, ClientPtr),
+ va_arg(ap, WindowPtr)
+ };
+ calldata = &rec;
+ break;
+ }
+ case XACE_AUDIT_BEGIN: {
+ XaceAuditRec rec = {
+ va_arg(ap, ClientPtr),
+ 0
+ };
+ calldata = &rec;
+ break;
+ }
+ case XACE_AUDIT_END: {
+ XaceAuditRec rec = {
+ va_arg(ap, ClientPtr),
+ va_arg(ap, int)
+ };
+ calldata = &rec;
+ break;
+ }
default: {
va_end(ap);
return 0; /* unimplemented hook number */
diff --git a/Xext/xace.h b/Xext/xace.h
index 68f6dd442..6cb4b4f5d 100644
--- a/Xext/xace.h
+++ b/Xext/xace.h
@@ -46,7 +46,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define XACE_SITE_POLICY 10
#define XACE_DECLARE_EXT_SECURE 11
#define XACE_AUTH_AVAIL 12
-#define XACE_NUM_HOOKS 13
+#define XACE_KEY_AVAIL 13
+#define XACE_WINDOW_INIT 14
+#define XACE_AUDIT_BEGIN 15
+#define XACE_AUDIT_END 16
+#define XACE_NUM_HOOKS 17
extern CallbackListPtr XaceHooks[XACE_NUM_HOOKS];
diff --git a/Xext/xacestr.h b/Xext/xacestr.h
index a01bf4a2a..7114d066b 100644
--- a/Xext/xacestr.h
+++ b/Xext/xacestr.h
@@ -112,4 +112,24 @@ typedef struct {
XID authId;
} XaceAuthAvailRec;
+/* XACE_KEY_AVAIL */
+typedef struct {
+ xEventPtr event;
+ DeviceIntPtr keybd;
+ int count;
+} XaceKeyAvailRec;
+
+/* XACE_WINDOW_INIT */
+typedef struct {
+ ClientPtr client;
+ WindowPtr pWin;
+} XaceWindowRec;
+
+/* XACE_AUDIT_BEGIN */
+/* XACE_AUDIT_END */
+typedef struct {
+ ClientPtr client;
+ int requestResult;
+} XaceAuditRec;
+
#endif /* _XACESTR_H */
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 95331f12e..aa67dc43e 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -451,7 +451,15 @@ Dispatch(void)
if (result > (maxBigRequestSize << 2))
result = BadLength;
else
+#ifdef XACE
+ {
+ XaceHook(XACE_AUDIT_BEGIN, client);
result = (* client->requestVector[MAJOROP])(client);
+ XaceHook(XACE_AUDIT_END, client, result);
+ }
+#else
+ result = (* client->requestVector[MAJOROP])(client);
+#endif /* XACE */
if (result != Success)
{
diff --git a/dix/events.c b/dix/events.c
index c00a0003d..c57a30ed8 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -2846,6 +2846,10 @@ drawable.id:0;
DeliverFocusedEvent(keybd, xE, sprite.win, count);
if (deactivateGrab)
(*keybd->DeactivateGrab)(keybd);
+
+#ifdef XACE
+ XaceHook(XACE_KEY_AVAIL, xE, keybd, count);
+#endif
}
#ifdef XKB
diff --git a/dix/window.c b/dix/window.c
index d710d07bf..3dfeda36e 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -530,6 +530,10 @@ InitRootWindow(WindowPtr pWin)
/* We SHOULD check for an error value here XXX */
(*pScreen->ChangeWindowAttributes)(pWin, backFlag);
+#ifdef XACE
+ XaceHook(XACE_WINDOW_INIT, serverClient, pWin);
+#endif
+
MapWindow(pWin, serverClient);
}
@@ -762,6 +766,10 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w,
REGION_NULL(pScreen, &pWin->winSize);
REGION_NULL(pScreen, &pWin->borderSize);
+#ifdef XACE
+ XaceHook(XACE_WINDOW_INIT, client, pWin);
+#endif
+
pHead = RealChildHead(pParent);
if (pHead)
{