summaryrefslogtreecommitdiff
path: root/xserver/Xext
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2015-11-07 16:48:54 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2015-11-07 16:48:54 +0000
commit6c07b8ab53c2bbf0feb0afbbe98b33171c7b7872 (patch)
tree35eb85f0db40ffe6e6614d780b3de61b93edb3bc /xserver/Xext
parentf4e01ac5608a8dfd9a4ee2f7aa43d28cc1710d81 (diff)
Update to xserver 1.17.4.
tested by naddy@
Diffstat (limited to 'xserver/Xext')
-rw-r--r--xserver/Xext/xace.c15
-rw-r--r--xserver/Xext/xace.h5
-rw-r--r--xserver/Xext/xselinux_hooks.c8
3 files changed, 26 insertions, 2 deletions
diff --git a/xserver/Xext/xace.c b/xserver/Xext/xace.c
index d77b3126a..b3c67f632 100644
--- a/xserver/Xext/xace.c
+++ b/xserver/Xext/xace.c
@@ -213,6 +213,21 @@ XaceHook(int hook, ...)
return prv ? *prv : Success;
}
+/* XaceHookIsSet
+ *
+ * Utility function to determine whether there are any callbacks listening on a
+ * particular XACE hook.
+ *
+ * Returns non-zero if there is a callback, zero otherwise.
+ */
+int
+XaceHookIsSet(int hook)
+{
+ if (hook < 0 || hook >= XACE_NUM_HOOKS)
+ return 0;
+ return XaceHooks[hook] != NULL;
+}
+
/* XaceCensorImage
*
* Called after pScreen->GetImage to prevent pieces or trusted windows from
diff --git a/xserver/Xext/xace.h b/xserver/Xext/xace.h
index 5e6cb0437..6a8d0c4bd 100644
--- a/xserver/Xext/xace.h
+++ b/xserver/Xext/xace.h
@@ -65,6 +65,9 @@ extern _X_EXPORT int XaceHook(int /*hook */ ,
... /*appropriate args for hook */
);
+/* determine whether any callbacks are present for the XACE hook */
+extern _X_EXPORT int XaceHookIsSet(int hook);
+
/* Special-cased hook functions
*/
extern _X_EXPORT int XaceHookDispatch(ClientPtr ptr, int major);
@@ -109,6 +112,7 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
#ifdef __GNUC__
#define XaceHook(args...) Success
+#define XaceHookIsSet(args...) 0
#define XaceHookDispatch(args...) Success
#define XaceHookPropertyAccess(args...) Success
#define XaceHookSelectionAccess(args...) Success
@@ -116,6 +120,7 @@ extern _X_EXPORT void XaceCensorImage(ClientPtr client,
#define XaceCensorImage(args...) { ; }
#else
#define XaceHook(...) Success
+#define XaceHookIsSet(...) 0
#define XaceHookDispatch(...) Success
#define XaceHookPropertyAccess(...) Success
#define XaceHookSelectionAccess(...) Success
diff --git a/xserver/Xext/xselinux_hooks.c b/xserver/Xext/xselinux_hooks.c
index 48219a9e0..e69bfe7ae 100644
--- a/xserver/Xext/xselinux_hooks.c
+++ b/xserver/Xext/xselinux_hooks.c
@@ -147,7 +147,7 @@ SELinuxLabelClient(ClientPtr client)
strncpy(subj->command, cmdname, COMMAND_LEN - 1);
if (!cached)
- free(cmdname); /* const char * */
+ free((void *) cmdname); /* const char * */
}
finish:
@@ -295,6 +295,9 @@ SELinuxAudit(void *auditdata,
}
static int
+SELinuxLog(int type, const char *fmt, ...) _X_ATTRIBUTE_PRINTF(2, 3);
+
+static int
SELinuxLog(int type, const char *fmt, ...)
{
va_list ap;
@@ -316,6 +319,7 @@ SELinuxLog(int type, const char *fmt, ...)
va_start(ap, fmt);
vsnprintf(buf, MAX_AUDIT_MESSAGE_LENGTH, fmt, ap);
rc = audit_log_user_avc_message(audit_fd, aut, buf, NULL, NULL, NULL, 0);
+ (void) rc;
va_end(ap);
LogMessageVerb(X_WARNING, 0, "%s", buf);
return 0;
@@ -476,7 +480,7 @@ SELinuxExtension(CallbackListPtr *pcbl, void *unused, void *calldata)
}
/* Perform the security check */
- auditdata.extension = rec->ext->name;
+ auditdata.extension = (char *) rec->ext->name;
rc = SELinuxDoCheck(subj, obj, SECCLASS_X_EXTENSION, rec->access_mode,
&auditdata);
if (rc != Success)