Commit e095b8f6 authored by Mihai Moldovan's avatar Mihai Moldovan

nxcomp: Handle launchd sockets in DISPLAY variable correctly when fetching X cookie.

Backported from Arctica GH 3.6.x branch. v2: backport to nx-libs 3.5.0.x (Mihai Moldovan) Adds: - debian/patches/1600_nxcomp-handle-launchd-socket-in-Auth.full+lite.patch
parent 288cc6fe
......@@ -54,6 +54,12 @@ nx-libs (2:3.5.0.33-0x2go1) UNRELEASED; urgency=low
- Refresh all patches. Removes some fuzziness and adds the -p diff option
to show the C function name in hunk headers.
- Fixup series file to include previous patch.
* nxcomp: Handle launchd sockets in DISPLAY variable correctly when fetching
X cookie.
Backported from Arctica GH 3.6.x branch.
v2: backport to nx-libs 3.5.0.x (Mihai Moldovan)
Adds:
- debian/patches/1600_nxcomp-handle-launchd-socket-in-Auth.full+lite.patch
[ Mike Gabriel ]
* debian/libxinerama1.postinst.in:
......
From bd25453bd41957079c7516adf407b8785ef22f1f Mon Sep 17 00:00:00 2001
From: Mihai Moldovan <ionic@ionic.de>
Date: Fri, 3 Nov 2017 12:30:12 +0100
Subject: [PATCH] nxcomp/src/Auth.cpp: handle launchd sockets in DISPLAY
variable correctly when fetching X cookie.
Backported from Arctica GH 3.6.x branch.
v2: backport to nx-libs 3.5.0.x (Mihai Moldovan)
---
nxcomp/src/Auth.cpp | 26 +++++++++++++++++++++++---
1 file changed, 23 insertions(+), 3 deletions(-)
--- a/nxcomp/Auth.cpp
+++ b/nxcomp/Auth.cpp
@@ -267,11 +267,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_);
@@ -304,9 +326,7 @@ int Auth::getCookie()
// implementation.
//
- FILE *data = Popen((char *const *) parameters, "r");
-
- int result = -1;
+ data = Popen((char *const *) parameters, "r");
if (data == NULL)
{
......@@ -152,6 +152,7 @@
1301_nxcomp_Reduce-TokenSize-slightly-for.full+lite.patch
1400_nx-X11_Render.c-Improve-situation-fo.full+lite.patch
1500_all_propagate-optflags-to-subcompone.full+lite.patch
1600_nxcomp-handle-launchd-socket-in-Auth.full+lite.patch
9900-dxpc-license-history.full+lite.patch
0016_nx-X11_install-location.debian.patch
0102_xserver-xext_set-securitypolicy-path.debian.patch
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