diff options
author | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-11-03 16:23:41 +0100 |
---|---|---|
committer | Mike Gabriel <mike.gabriel@das-netzwerkteam.de> | 2017-11-03 16:23:41 +0100 |
commit | e3f498e6211d8518f10c674ce347ab11d92c0e28 (patch) | |
tree | dc47e95c6407989185d9bfd91297dea791f7721b /nxcomp/src | |
parent | 1c6c9c04b56656d9ab3f486738a4950e71f29b74 (diff) | |
parent | bd25453bd41957079c7516adf407b8785ef22f1f (diff) | |
download | nx-libs-e3f498e6211d8518f10c674ce347ab11d92c0e28.tar.gz nx-libs-e3f498e6211d8518f10c674ce347ab11d92c0e28.tar.bz2 nx-libs-e3f498e6211d8518f10c674ce347ab11d92c0e28.zip |
Merge branch 'Ionic-bugfix/fix-X-cookie-on-osx' into 3.6.x
Attributes GH PR #543: https://github.com/ArcticaProject/nx-libs/pull/543
Diffstat (limited to 'nxcomp/src')
-rw-r--r-- | nxcomp/src/Auth.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/nxcomp/src/Auth.cpp b/nxcomp/src/Auth.cpp index d42c0556d..d398f5f85 100644 --- a/nxcomp/src/Auth.cpp +++ b/nxcomp/src/Auth.cpp @@ -279,11 +279,33 @@ int Auth::getCookie() // char line[DEFAULT_STRING_LIMIT]; + FILE *data = NULL; + int result = -1; if (strncmp(display_, "localhost:", 10) == 0) { snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", display_ + 10); } + else if ((0 == strncasecmp(display_, "/tmp/launch", 11)) || (0 == strncasecmp(display_, "/private/tmp/com.apple.launchd", 30))) + { + /* + * Launchd socket support, mostly for OS X, but maybe also other BSD derivates. + */ + const char *separator = strrchr(display_, ':'); + + if ((NULL == separator) || (!isdigit(*(separator + 1)))) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Unable to find separating colon character '" + << "in launchd socket path '" << display_ + << "'.\n" << logofs_flush; + #endif + + goto AuthGetCookieResult; + } + + snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", separator + 1); + } else { snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_); @@ -316,9 +338,7 @@ int Auth::getCookie() // implementation. // - FILE *data = Popen((char *const *) parameters, "r"); - - int result = -1; + data = Popen((char *const *) parameters, "r"); if (data == NULL) { |