Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nx-libs
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dimbor
nx-libs
Commits
bd25453b
Commit
bd25453b
authored
Nov 03, 2017
by
Mihai Moldovan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nxcomp/src/Auth.cpp: handle launchd sockets in DISPLAY variable correctly when fetching X cookie.
parent
1c6c9c04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
3 deletions
+23
-3
Auth.cpp
nxcomp/src/Auth.cpp
+23
-3
No files found.
nxcomp/src/Auth.cpp
View file @
bd25453b
...
...
@@ -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
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment