Unverified Commit e3f498e6 authored by Mike Gabriel's avatar Mike Gabriel

Merge branch 'Ionic-bugfix/fix-X-cookie-on-osx' into 3.6.x

parents 1c6c9c04 bd25453b
...@@ -279,11 +279,33 @@ int Auth::getCookie() ...@@ -279,11 +279,33 @@ int Auth::getCookie()
// //
char line[DEFAULT_STRING_LIMIT]; char line[DEFAULT_STRING_LIMIT];
FILE *data = NULL;
int result = -1;
if (strncmp(display_, "localhost:", 10) == 0) if (strncmp(display_, "localhost:", 10) == 0)
{ {
snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", display_ + 10); 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 else
{ {
snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_); snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_);
...@@ -316,9 +338,7 @@ int Auth::getCookie() ...@@ -316,9 +338,7 @@ int Auth::getCookie()
// implementation. // implementation.
// //
FILE *data = Popen((char *const *) parameters, "r"); data = Popen((char *const *) parameters, "r");
int result = -1;
if (data == NULL) if (data == NULL)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment