[Xcb] [PATCH] Use special path to sockets when running under Solaris Trusted Extensions
Alan Coopersmith
alan.coopersmith at oracle.com
Fri Jan 28 14:09:17 PST 2011
Solaris Trusted Extensions puts the endpoints for the X server's Unix
domain sockets in a special directory shared from the global zone to
each of the labeled zones, since each labeled zone has a separate /tmp.
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
configure.ac | 4 ++++
src/xcb_util.c | 19 +++++++++++++++++++
2 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/configure.ac b/configure.ac
index a8e171b..c0c69f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -105,6 +105,10 @@ AC_CHECK_MEMBER([struct sockaddr_un.sun_len],
#include <sys/un.h>
])
+dnl check for support for Solaris Trusted Extensions
+AC_CHECK_HEADERS([tsol/label.h])
+AC_CHECK_FUNCS([is_system_labeled])
+
xcbincludedir='${includedir}/xcb'
AC_SUBST(xcbincludedir)
diff --git a/src/xcb_util.c b/src/xcb_util.c
index 223dcaf..5a5cf3a 100644
--- a/src/xcb_util.c
+++ b/src/xcb_util.c
@@ -54,6 +54,12 @@
#include "xcbext.h"
#include "xcbint.h"
+/* must be after "xcbint.h" to get autoconf #defines */
+#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED)
+# include <tsol/label.h>
+# include <sys/stat.h>
+#endif
+
int xcb_popcount(uint32_t mask)
{
uint32_t y;
@@ -204,6 +210,19 @@ static int _xcb_open(const char *host, char *protocol, const int display)
}
#ifndef _WIN32
+#if defined(HAVE_TSOL_LABEL_H) && defined(HAVE_IS_SYSTEM_LABELED)
+/* Use special path for Unix sockets under Solaris Trusted Extensions */
+# define TSOL_UNIX_DIR "/var/tsol/doors/.X11-unix"
+
+ if (is_system_labeled())
+ {
+ struct stat sbuf;
+
+ if (stat(TSOL_UNIX_DIR, &sbuf) == 0)
+ base = TSOL_UNIX_DIR "/X";
+ }
+#endif
+
filelen = strlen(base) + 1 + sizeof(display) * 3 + 1;
file = malloc(filelen);
if(file == NULL)
--
1.7.3.2
More information about the Xcb
mailing list