summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2011-04-04 16:32:45 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2011-04-04 19:56:16 -0700
commit7131d5d0706f2b63caad13c815e893627872114c (patch)
tree0ed1b3dc01d0cbd032cb34590b137a74fda061e5 /src
parent70976d87f18d15c2ccc28eb7728e4822d3849e0d (diff)
Use special path to sockets when running under Solaris Trusted Extensions
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@oracle.com> Reviewed-by: Peter Harris <pharris@opentext.com>
Diffstat (limited to 'src')
-rw-r--r--src/xcb_util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/xcb_util.c b/src/xcb_util.c
index 223dcaf..d8a36f1 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,21 @@ 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)
+ /* Check special path for Unix sockets under Solaris Trusted Extensions */
+ if (is_system_labeled())
+ {
+ struct stat sbuf;
+ const char *tsol_base = "/var/tsol/doors/.X11-unix/X";
+ char tsol_socket[PATH_MAX];
+
+ snprintf(tsol_socket, sizeof(tsol_socket), "%s%d", tsol_base, display);
+
+ if (stat(tsol_socket, &sbuf) == 0)
+ base = tsol_base;
+ }
+#endif
+
filelen = strlen(base) + 1 + sizeof(display) * 3 + 1;
file = malloc(filelen);
if(file == NULL)