aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2014-06-11 10:42:04 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2014-06-11 10:42:04 +0200
commit57fb5bb5733fb69c98a9c2fecb06ed4cd7b922f3 (patch)
treebb37c6c7311e8cd450f1073144ff7a9af5f1de72
parenteb36421013cc93221136f37e7b2872d1bd457de7 (diff)
downloadnx-libs-57fb5bb5733fb69c98a9c2fecb06ed4cd7b922f3.tar.gz
nx-libs-57fb5bb5733fb69c98a9c2fecb06ed4cd7b922f3.tar.bz2
nx-libs-57fb5bb5733fb69c98a9c2fecb06ed4cd7b922f3.zip
Add 027_nxcomp_abstract-X11-socket.patch. In proxy mode server let NX proxy attempt connecting to the abstract X11 socket first, and only fallback to the file system socket, if the abstract socket is not available. (Fixes: #505).
-rw-r--r--debian/changelog4
-rw-r--r--debian/patches/027_nxcomp_abstract-X11-socket.patch56
-rw-r--r--debian/patches/series1
3 files changed, 61 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index 5b53ee146..60c5fe796 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,10 @@ nx-libs (2:3.5.0.25-0x2go1) UNRELEASED; urgency=low
* Add 606_nx-X11_build-on-aarch64.full.patch. Build on aarch64
architectures. (Fixes: #490).
+ * Add 027_nxcomp_abstract-X11-socket.patch. In proxy mode "server" let
+ NX proxy attempt connecting to the abstract X11 socket first, and only
+ fallback to the file system socket, if the abstract socket is not
+ available. (Fixes: #505).
-- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 07 May 2014 09:58:10 +0200
diff --git a/debian/patches/027_nxcomp_abstract-X11-socket.patch b/debian/patches/027_nxcomp_abstract-X11-socket.patch
new file mode 100644
index 000000000..4f614338c
--- /dev/null
+++ b/debian/patches/027_nxcomp_abstract-X11-socket.patch
@@ -0,0 +1,56 @@
+diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp
+index 92b6fc2..d86809d 100644
+--- a/nxcomp/Loop.cpp
++++ b/nxcomp/Loop.cpp
+@@ -4250,6 +4250,39 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
+ // where the socket will be created.
+ //
+
++ // Try abstract X11 socket first (via a test connect), if that fails
++ // fall back to Unix domain socket file.
++
++ #ifdef __linux__
++ int testSocketFD;
++ testSocketFD = socket(xServerAddrFamily, SOCK_STREAM, PF_UNSPEC);
++
++ int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort);
++ unixSocketName[0] = '\0';
++
++ sockaddr_un *xServerAddrABSTRACT = new sockaddr_un;
++ memset(xServerAddrABSTRACT, 0, xServerAddrLength);
++ xServerAddrABSTRACT -> sun_family = AF_UNIX;
++ memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1);
++ xServerAddrLength = len +3;
++
++ int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, xServerAddrLength);
++ if (ret == 0) {
++
++ cerr << "Info" << ": Using abstract X11 socket in kernel namespace "
++ << "for accessing DISPLAY=:" << xPort << ".\n";
++
++ close(testSocketFD);
++ xServerAddr = (sockaddr *) xServerAddrABSTRACT;
++ return 1;
++
++ } else {
++
++ cerr << "Info" << ": Falling back to file system X11 socket "
++ << "for accessing DISPLAY=:" << xPort << ".\n";
++
++ #endif
++
+ struct stat statInfo;
+
+ char unixSocketDir[DEFAULT_STRING_LENGTH];
+@@ -4322,6 +4355,11 @@ int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr,
+
+ xServerAddr = (sockaddr *) xServerAddrUNIX;
+ xServerAddrLength = sizeof(sockaddr_un);
++
++ #ifdef __linux__
++
++ }
++ #endif
+ }
+ else
+ {
diff --git a/debian/patches/series b/debian/patches/series
index e0fdb323e..162c52281 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -22,6 +22,7 @@
026_nxcompext_honour-optflags.full.patch
026_nxcomp_honour-optflags.full+lite.patch
026_nxcompshad_honour-optflags.full.patch
+027_nxcomp_abstract-X11-socket.patch
030_nx-X11_configure-args.full.patch
031_nx-X11_parallel-make.full.patch
051_nxcomp_macos105-fdisset.full+lite.patch