aboutsummaryrefslogtreecommitdiff
path: root/nxproxy
diff options
context:
space:
mode:
Diffstat (limited to 'nxproxy')
-rw-r--r--nxproxy/.gitignore2
-rw-r--r--nxproxy/Main.c120
-rw-r--r--nxproxy/Makefile.in112
l---------nxproxy/VERSION1
-rw-r--r--nxproxy/configure.in186
-rwxr-xr-xnxproxy/install-sh238
-rw-r--r--nxproxy/man/nxproxy.1395
-rwxr-xr-xnxproxy/mkinstalldirs34
8 files changed, 1088 insertions, 0 deletions
diff --git a/nxproxy/.gitignore b/nxproxy/.gitignore
new file mode 100644
index 000000000..3d98254b2
--- /dev/null
+++ b/nxproxy/.gitignore
@@ -0,0 +1,2 @@
+Makefile
+nxproxy
diff --git a/nxproxy/Main.c b/nxproxy/Main.c
new file mode 100644
index 000000000..d9fb1ef4f
--- /dev/null
+++ b/nxproxy/Main.c
@@ -0,0 +1,120 @@
+/**************************************************************************/
+/* */
+/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */
+/* */
+/* NXPROXY, NX protocol compression and NX extensions to this software */
+/* are copyright of NoMachine. Redistribution and use of the present */
+/* software is allowed according to terms specified in the file LICENSE */
+/* which comes in the source distribution. */
+/* */
+/* Check http://www.nomachine.com/licensing.html for applicability. */
+/* */
+/* NX and NoMachine are trademarks of Medialogic S.p.A. */
+/* */
+/* All rigths reserved. */
+/* */
+/**************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <errno.h>
+#include <limits.h>
+
+#include "NX.h"
+
+#define PANIC
+#define WARNING
+#undef TEST
+#undef DEBUG
+
+extern const char *__progname;
+
+/*
+ * Entry point when running nxproxy stand-alone.
+ */
+
+int main(int argc, const char **argv)
+{
+ int result = -1;
+
+ char *options = NULL;
+
+ char *nx_commfd_str = NULL;
+
+ options = getenv("NX_DISPLAY");
+
+ if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL)
+ {
+ errno = 0;
+ unsigned long int nx_commfd = strtoul(nx_commfd_str, NULL, 10);
+
+ if ((errno) && (0 == nx_commfd))
+ {
+ fprintf(stderr, "%s: NX_COMMFD environment variable's value [%s] is not a file descriptor number. "
+ "Aborting...\n",
+ __progname, nx_commfd_str
+ );
+ NXTransCleanup();
+ }
+ else if ((unsigned long int) INT_MAX < nx_commfd)
+ {
+ fprintf(stderr, "%s: NX_COMMFD environment variable's value [%lu] is out of range for a file descriptor number. "
+ "Aborting...\n",
+ __progname, nx_commfd);
+ NXTransCleanup();
+ }
+ else {
+ result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options);
+
+ if (result != 1)
+ {
+ fprintf(stderr, "%s: NXTransCreate failed for FD#%lu\n"
+ "Aborting...",
+ __progname, nx_commfd);
+ NXTransCleanup();
+ }
+
+ }
+
+ // go into endless loop
+
+ if (result == 1)
+ {
+ while (NXTransRunning(NX_FD_ANY))
+ result = NXTransContinue(NULL);
+ }
+ }
+ else
+ {
+
+ if (NXTransParseCommandLine(argc, argv) < 0)
+ {
+ NXTransCleanup();
+ }
+
+ if (NXTransParseEnvironment(options, 0) < 0)
+ {
+ NXTransCleanup();
+ }
+
+ /*
+ * This should not return...
+ */
+
+ #ifdef TEST
+ fprintf(stderr, "%s: Yielding control to NX entry point.\n", __progname);
+ #endif
+
+ result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY);
+ }
+
+ /*
+ * ...So these should not be called.
+ */
+
+ NXTransExit(result);
+
+ return 0;
+}
diff --git a/nxproxy/Makefile.in b/nxproxy/Makefile.in
new file mode 100644
index 000000000..3a27cbd29
--- /dev/null
+++ b/nxproxy/Makefile.in
@@ -0,0 +1,112 @@
+#
+# Get values from configure script.
+#
+VERSION=@VERSION@
+LIBVERSION=@LIBVERSION@
+
+#
+# Enable really all warnings. This, though, gives
+# a warning due to pthread.h and unistd.h.
+#
+# -Wredundant-decls
+#
+CXX = @CXX@
+CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \
+ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \
+ -Wmissing-declarations -Wnested-externs
+
+CXXINCLUDES = -I. -I../nxcomp
+
+CC = @CC@
+CCFLAGS = $(CXXFLAGS)
+CCINCLUDES = -I. -I../nxcomp
+CCDEFINES =
+
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+
+#
+# Only if THREADS is defined.
+#
+# LIBS = $(LIBS) -lpthread
+#
+
+srcdir = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+bindir = @bindir@
+man1dir = @mandir@/man1
+VPATH = @srcdir@
+
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+DESTDIR =
+RM_FILE = rm -f
+
+#
+# This should be autodetected.
+#
+
+MAKEDEPEND = @MAKEDEPEND@
+DEPENDINCLUDES = -I/usr/include/g++ -I/usr/include/g++-3
+
+.SUFFIXES: .cpp.c
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $<
+.c.o:
+ $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $<
+
+PROGRAM = nxproxy
+
+all: depend $(PROGRAM)
+
+MSRC = Main.c
+
+CSRC =
+
+CXXSRC =
+
+MOBJ = $(MSRC:.c=.o)
+COBJ = $(CSRC:.c=.o)
+CXXOBJ = $(CXXSRC:.cpp=.o)
+
+$(PROGRAM): $(MOBJ) $(COBJ) $(CXXOBJ)
+ $(CXX) $(CXXFLAGS) -o $@ $(MOBJ) $(LDFLAGS) $(LIBS)
+
+depends: depend.status
+
+depend: depend.status
+
+depend.status:
+ if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \
+ $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \
+ $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) $(CXXSRC) 2>/dev/null; \
+ fi
+ touch depend.status
+
+install: install.bin install.man
+
+install.bin: $(PROGRAM)
+ $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM)
+
+install.man:
+ $(srcdir)/mkinstalldirs $(DESTDIR)$(man1dir)
+ $(INSTALL_DATA) man/$(PROGRAM).1 $(DESTDIR)$(man1dir)/$(PROGRAM).1
+
+uninstall: uninstall.bin uninstall.man
+
+uninstall.bin:
+ $(RM_FILE) $(DESTDIR)$(bindir)/$(PROGRAM)
+
+uninstall.man:
+ $(RM_FILE) $(DESTDIR)$(man1dir)/nxproxy.1
+
+clean:
+ -rm -f *~ *.o *.bak st?????? core core.* *.out.* \
+ $(PROGRAM) $(PROGRAM).exe $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE)
+
+distclean: clean
+ -rm -rf autom4te.cache config.status config.log config.cache depend.status Makefile tags configure
diff --git a/nxproxy/VERSION b/nxproxy/VERSION
new file mode 120000
index 000000000..6ff19de4b
--- /dev/null
+++ b/nxproxy/VERSION
@@ -0,0 +1 @@
+../VERSION \ No newline at end of file
diff --git a/nxproxy/configure.in b/nxproxy/configure.in
new file mode 100644
index 000000000..12e2a08d2
--- /dev/null
+++ b/nxproxy/configure.in
@@ -0,0 +1,186 @@
+dnl Process this file with autoconf to produce a configure script.
+
+dnl Prolog
+
+AC_INIT(Main.c)
+AC_PREREQ(2.13)
+
+dnl Reset default compilation flags.
+
+if test "x$CXXFLAGS" == "x"; then
+ CXXFLAGS="-O3"
+fi
+if test "x$CPPFLAGS" == "x"; then
+ CPPFLAGS="-O3"
+fi
+
+dnl Prefer headers and libraries from nx-X11 if present.
+
+if test -d "../nx-X11/exports/include" ; then
+ CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include"
+ LIBS="$LIBS -L../nx-X11/exports/lib"
+fi
+
+dnl Check whether --with-ipaq was given.
+
+if test "${with_ipaq}" = yes; then
+ echo -e "enabling ipaq configuration"
+ CXX="arm-linux-c++"
+ CC="arm-linux-gcc"
+ unset ac_cv_prog_armcxx
+ unset ac_cv_prog_armcc
+ unset ac_cv_prog_CXXCPP
+ AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH])
+ AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH])
+ if test $armcxx = "yes" && test $armcc = "yes" ; then
+ ac_cv_prog_CXX="$CXX"
+ ac_cv_prog_CC="$CC"
+ else
+ AC_MSG_ERROR(installation or configuration problem: I cannot find compiler for arm-linux)
+ fi
+else
+ unset ac_cv_prog_CXX
+ unset ac_cv_prog_CC
+ unset ac_cv_prog_CXXCPP
+fi
+
+dnl Check for programs.
+
+AC_PROG_CXX
+AC_PROG_CC
+AC_LANG_CPLUSPLUS
+
+dnl Check for BSD compatible install.
+
+AC_PROG_INSTALL
+
+dnl Check for extra header files.
+
+AC_PATH_XTRA
+
+dnl Custom addition.
+
+ac_help="$ac_help
+ --with-symbols give -g flag to compiler to produce debug symbols
+ --with-info define INFO at compile time to get basic log output
+ --with-valgrind clean up allocated buffers to avoid valgrind warnings
+ --with-version use this version for produced libraries"
+
+dnl Check to see if we're running under Cygwin32.
+
+
+dnl Check to see if we're running under FreeBSD.
+AC_DEFUN(nxconf_FreeBSD,
+[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd,
+[AC_TRY_COMPILE(,[return __FreeBSD__;],
+nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no)
+rm -f conftest*])
+FreeBSD=
+test "$nxconf_cv_freebsd" = yes && FreeBSD=yes])
+nxconf_FreeBSD
+
+
+AC_DEFUN(nxconf_CYGWIN32,
+[AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32,
+[AC_TRY_COMPILE(,[return __CYGWIN32__;],
+nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no)
+rm -f conftest*])
+CYGWIN32=
+test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes])
+nxconf_CYGWIN32
+
+dnl Check for Darwin environment.
+
+AC_DEFUN(nxconf_DARWIN,
+[AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin,
+[AC_TRY_COMPILE(,[return __APPLE__;],
+nxconf_cv_darwin=yes, nxconf_cv_darwin=no)
+rm -f conftest*])
+DARWIN=
+test "$nxconf_cv_darwin" = yes && DARWIN=yes])
+nxconf_DARWIN
+
+dnl Check to see if we're running under Solaris.
+
+AC_DEFUN(nxconf_SUN,
+[AC_CACHE_CHECK(for SunOS environment, nxconf_cv_sun,
+[AC_TRY_COMPILE(,[return __sun;],
+nxconf_cv_sun=yes, nxconf_cv_sun=no)
+rm -f conftest*])
+SUN=
+test "$nxconf_cv_sun" = yes && SUN=yes])
+nxconf_SUN
+
+dnl Check whether --with-version was given.
+
+AC_SUBST(LIBVERSION)
+AC_SUBST(VERSION)
+if test "${with_version}" = yes; then
+ VERSION=${ac_option}
+else
+ VERSION=`cat VERSION`
+fi
+echo -e "compiling version ${VERSION}"
+
+LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1`
+
+CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\""
+CPPFLAGS="$CPPFLAGS -DVERSION=\\\"${VERSION}\\\""
+
+dnl Check whether --with-symbols or --without-symbols was
+dnl given and set the required optimization level.
+
+if test "${with_symbols}" = yes; then
+ echo -e "enabling production of debug symbols"
+ CXXFLAGS="-g $CXXFLAGS"
+ CPPFLAGS="-g $CPPFLAGS"
+else
+ echo -e "disabling production of debug symbols"
+fi
+
+dnl Check whether --with-info or --without-info was given.
+
+if test "${with_info}" = yes; then
+ echo -e "enabling info output in the log file"
+ CXXFLAGS="$CXXFLAGS -DINFO"
+ CPPFLAGS="$CPPFLAGS -DINFO"
+else
+ echo -e "disabling info output in the log file"
+fi
+
+dnl Check whether --with-valgrind or --without-valgrind was given.
+
+if test "${with_valgrind}" = yes; then
+ echo -e "enabling valgrind memory checker workarounds"
+ CXXFLAGS="$CXXFLAGS -DVALGRIND"
+ CPPFLAGS="$CPPFLAGS -DVALGRIND"
+else
+ echo -e "disabling valgrind memory checker workarounds"
+fi
+
+dnl Cygwin requires that the stdc++ library is linked explicitly.
+dnl GCC 3.3.x requires also the z, png and jpeg libraries. This is
+dnl not true anymore since GCC 3.4.x.
+
+if test "$CYGWIN32" = yes; then
+ LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng -lz"
+else
+ LIBS="$LIBS -L../nxcomp -lXcomp"
+fi
+
+dnl Find makedepend somewhere.
+
+AC_SUBST(MAKEDEPEND)
+MAKEDEPEND="$(which makedepend)"
+
+# Try to desperately find makedepend.
+# Set MAKEDEPEND to the shipped makedepend binary. This will not
+# exist in nx-libs-lite, though, in which case MAKEDEPEND
+# will stay empty.
+if test -z "${MAKEDEPEND}"; then
+ if test -x "../nx-X11/config/makedepend/makedepend"; then
+ MAKEDEPEND="../nx-X11/config/makedepend/makedepend"
+ fi
+fi
+
+AC_OUTPUT(Makefile)
diff --git a/nxproxy/install-sh b/nxproxy/install-sh
new file mode 100755
index 000000000..58719246f
--- /dev/null
+++ b/nxproxy/install-sh
@@ -0,0 +1,238 @@
+#! /bin/sh
+#
+# install - install a program, script, or datafile
+# This comes from X11R5.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+#
+
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit="${DOITPROG-}"
+
+
+# put in absolute paths if you don't have them in your path; or use env. vars.
+
+mvprog="${MVPROG-mv}"
+cpprog="${CPPROG-cp}"
+chmodprog="${CHMODPROG-chmod}"
+chownprog="${CHOWNPROG-chown}"
+chgrpprog="${CHGRPPROG-chgrp}"
+stripprog="${STRIPPROG-strip}"
+rmprog="${RMPROG-rm}"
+mkdirprog="${MKDIRPROG-mkdir}"
+
+transformbasename=""
+transform_arg=""
+instcmd="$mvprog"
+chmodcmd="$chmodprog 0755"
+chowncmd=""
+chgrpcmd=""
+stripcmd=""
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
+src=""
+dst=""
+dir_arg=""
+
+while [ x"$1" != x ]; do
+ case $1 in
+ -c) instcmd="$cpprog"
+ shift
+ continue;;
+
+ -d) dir_arg=true
+ shift
+ continue;;
+
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
+
+ -o) chowncmd="$chownprog $2"
+ shift
+ shift
+ continue;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift
+ shift
+ continue;;
+
+ -s) stripcmd="$stripprog"
+ shift
+ continue;;
+
+ -t=*) transformarg=`echo $1 | sed 's/-t=//'`
+ shift
+ continue;;
+
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
+
+ *) if [ x"$src" = x ]
+ then
+ src=$1
+ else
+ # this colon is to work around a 386BSD /bin/sh bug
+ :
+ dst=$1
+ fi
+ shift
+ continue;;
+ esac
+done
+
+if [ x"$src" = x ]
+then
+ echo "install: no input file specified"
+ exit 1
+else
+ true
+fi
+
+if [ x"$dir_arg" != x ]; then
+ dst=$src
+ src=""
+
+ if [ -d $dst ]; then
+ instcmd=:
+ else
+ instcmd=mkdir
+ fi
+else
+
+# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
+# might cause directories to be created, which would be especially bad
+# if $src (and thus $dsttmp) contains '*'.
+
+ if [ -f $src -o -d $src ]
+ then
+ true
+ else
+ echo "install: $src does not exist"
+ exit 1
+ fi
+
+ if [ x"$dst" = x ]
+ then
+ echo "install: no destination specified"
+ exit 1
+ else
+ true
+ fi
+
+# If destination is a directory, append the input filename; if your system
+# does not like double slashes in filenames, you may need to add some logic
+
+ if [ -d $dst ]
+ then
+ dst="$dst"/`basename $src`
+ else
+ true
+ fi
+fi
+
+## this sed command emulates the dirname command
+dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
+
+# Make sure that the destination directory exists.
+# this part is taken from Noah Friedman's mkinstalldirs script
+
+# Skip lots of stat calls in the usual case.
+if [ ! -d "$dstdir" ]; then
+defaultIFS='
+'
+IFS="${IFS-${defaultIFS}}"
+
+oIFS="${IFS}"
+# Some sh's can't handle IFS=/ for some reason.
+IFS='%'
+set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
+IFS="${oIFS}"
+
+pathcomp=''
+
+while [ $# -ne 0 ] ; do
+ pathcomp="${pathcomp}${1}"
+ shift
+
+ if [ ! -d "${pathcomp}" ] ;
+ then
+ $mkdirprog "${pathcomp}"
+ else
+ true
+ fi
+
+ pathcomp="${pathcomp}/"
+done
+fi
+
+if [ x"$dir_arg" != x ]
+then
+ $doit $instcmd $dst &&
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
+else
+
+# If we're going to rename the final executable, determine the name now.
+
+ if [ x"$transformarg" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ dstfile=`basename $dst $transformbasename |
+ sed $transformarg`$transformbasename
+ fi
+
+# don't allow the sed command to completely eliminate the filename
+
+ if [ x"$dstfile" = x ]
+ then
+ dstfile=`basename $dst`
+ else
+ true
+ fi
+
+# Make a temp file name in the proper directory.
+
+ dsttmp=$dstdir/#inst.$$#
+
+# Move or copy the file name to the temp name
+
+ $doit $instcmd $src $dsttmp &&
+
+ trap "rm -f ${dsttmp}" 0 &&
+
+# and set any options; do chmod last to preserve setuid bits
+
+# If any of these fail, we abort the whole thing. If we want to
+# ignore errors from any of these, just make sure not to ignore
+# errors from the above "$doit $instcmd $src $dsttmp" command.
+
+ if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
+ if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
+ if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
+ if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
+
+# Now rename the file to the real destination.
+
+ $doit $rmcmd -f $dstdir/$dstfile &&
+ $doit $mvcmd $dsttmp $dstdir/$dstfile
+
+fi &&
+
+
+exit 0
diff --git a/nxproxy/man/nxproxy.1 b/nxproxy/man/nxproxy.1
new file mode 100644
index 000000000..afb5f69d4
--- /dev/null
+++ b/nxproxy/man/nxproxy.1
@@ -0,0 +1,395 @@
+'\" -*- coding: utf-8 -*-
+.if \n(.g .ds T< \\FC
+.if \n(.g .ds T> \\F[\n[.fam]]
+.de URL
+\\$2 \(la\\$1\(ra\\$3
+..
+.if \n(.g .mso www.tmac
+.TH nxproxy 1 "April 2017" "Version 3.6.x" "NX Proxy"
+.SH NAME
+nxproxy \- NX Proxy Tool
+.SH SYNOPSIS
+'nh
+.fi
+.ad l
+\fBnxproxy\fR \fI[<options>] <host>:<port>\fR
+
+.SH DESCRIPTION
+\fBnxproxy\fR is a tool that allows one to tunnel X sessions through
+the NX compression library. \fBnxproxy\fR is a backend application
+utilized by various client application (Remmina, X2Go Client, PyHoca-Gui,
+Arctica Client, TheQVD Client, etc.).
+.PP
+.SH COMMAND LINE OPTIONS
+.TP 8
+.B -C
+Specify that nxproxy has to run on the 'X client' side, listening for
+connections and impersonating an X server.
+.TP 8
+.B -S
+Specify that nxproxy has to run in 'X server' mode, thus forwarding the
+connections to daemons running on the client.
+.TP 8
+.B -h
+Print this message.
+.TP 8
+.B -v
+Print version information.
+.TP 8
+.B <host>:<port>
+Put at the end, specifies the host and port of the listening proxy.
+
+.SH NX/NX DISPLAY OPTIONS
+Multiple nx/nx options can be specified in the DISPLAY environment or on
+the command line, by using the nx/nx,option=value notation.
+.TP 8
+.B link=<string>
+An indication of the link speed that is going to be used between the
+proxies. Usually the compression and the other link parameters depend on
+this setting. The value can be either 'modem', 'isdn', 'adsl', 'wan', 'lan', 'local'
+or a bandwidth specification, like for example '56k', '1m', '100m', etc.
+
+.TP 8
+.B type=<string>
+Type of session, for example 'windows', 'unix-kde'. 'unix-application',
+etc.
+
+.TP 8
+.B display=<string>
+Specify the real display where X connections have to be forwarded by the
+proxy running on the client.
+
+.TP 8
+.B listen=<int>
+Local port used for accepting the proxy connection.
+
+.TP 8
+.B loopback=<bool>
+Bind to the loopback device only.
+
+.TP 8
+.B accept=<string>
+Name or IP of host that can connect to the proxy.
+
+.TP 8
+.B connect=<string>
+Name or IP of host that the proxy will connect to.
+
+.TP 8
+.B port=<int>
+Remote port used for the connection.
+
+.TP 8
+.B retry=<int>
+Number of connection atempts.
+
+.TP 8
+.B root=<string>
+The root directory for the session. Usually is the C\-* or S\-* in the .nx
+directory in the user's home, with '*' being the virtual display.
+
+.TP 8
+.B session=<string>
+Name of the session file. The default is the name 'session' in the
+session directory.
+
+.TP 8
+.B errors=<string>
+Name of the log file used by the proxy. The default is the name 'errors'
+in the session directory.
+
+.TP 8
+.B stats=<string>
+Name of the file where are written the proxy statistics. The default is a
+file 'stats' in the session directory. The proxy replaces the data in the
+file whenever it receives a SIGUSR1 or SIGUSR2 signal:
+
+.I SIGUSR1:
+Gives total statistics, i.e. statistics collected since the beginning of
+the session.
+
+.I SIGUSR2:
+Gives partial statistics, i.e. statistics collected since the last time
+this signal was received.
+
+.TP 8
+.B cookie=<string>
+Use the provided cookie for authenticating to the remote proxy. The same
+cookie is used as the fake value used for the X authorization. The fake
+cookie is replaced on the X server side with the real cookie to be used
+for the display, so that the real cookie doesn't have to travel over the
+net. When not using a proxy cookie, any host will be able to connect to
+the proxy. See also the 'accept' parameter.
+
+.TP 8
+.B nodelay=<bool>
+A boolean indicating if TCP_NODELAY has to be set on the proxy link. Old
+Linux kernels had problems with handling TCP_NODELAY on PPP links.
+
+.TP 8
+.B policy=<bool>
+Let or not the agent decide when it is the best time to flush the proxy
+link. If set to 0, the proxy will flush any encoded data immediately. The
+option has only effect on the X client side proxy.
+
+.TP 8
+.B render=<bool>
+Enable or disable use of the RENDER extension.
+
+.TP 8
+.B taint=<bool>
+Try to suppress trivial sources of X roundtrips by generating the reply
+on the X client side.
+
+.TP 8
+.B delta=<bool>
+Enable X differential compression.
+
+.TP 8
+.B data=<int>
+Enable or disable the ZLIB data compression. It is possible to specify a
+value between 0 and 9. Usually the value is chosen automatically based on
+the requested link setting.
+
+.TP 8
+.B stream=<int>
+Enable or disable the ZLIB stream compression. The value, between 0 and
+9, is usually determined according to the requested link setting. Not
+fully implemented in nx-X11 Agent, yet.
+
+.TP 8
+.B limit=<int>
+Specify a bitrate limit allowed for this session.
+
+.TP 8
+.B memory=<int>
+Trigger memory optimizations used to keep small the size of X buffers.
+This is useful on embedded plat- forms, or where memory is scarce.
+
+.TP 8
+.B cache=<int>
+Size of the in-memory X message cache. Setting the value to 0 will
+disable the memory cache as well as the NX differential compression.
+
+.TP 8
+.B images=<int>
+Size of the persistent image cache.
+
+.TP 8
+.B shseg=<int>
+Enable the use of the MIT-SHM extension between the \fBnxproxy\fR and the
+real X server. A value greater than 1 is assumed to be the size of
+requested shared memory segment. By default, the size of the segment is
+determined based on the size of the in-memory cache.
+
+.TP 8
+.B load=<bool>
+Enable loading a persistent X message cache at the proxy startup.
+
+.TP 8
+.B save=<bool>
+Enable saving a persistent X message cache at the end of session.
+
+.TP 8
+.B cups=<int>
+Enable or disable forwarding of CUPS connections, by listening on the
+optional port 'n'.
+
+.TP 8
+.B aux=<int>
+Enable or disable forwarding of the auxiliary X channel used for
+controlling the keyboard. The 'keybd=<int>' form is accepted for backward
+compatibility.
+
+.TP 8
+.B smb=<int>
+Enable or disable forwarding of SMB connections. The 'samba=<int>' form is
+accepted for backward compatibility.
+
+.TP 8
+.B media=<int>
+Enable forwarding of audio connections.
+
+.TP 8
+.B http=<int>
+Enable forwarding of HTTP connections.
+
+.TP 8
+.B font=<int>
+Enable forwarding of reversed connections to a font
+server running on the NX server.
+
+.TP 8
+.B file=<int>
+Enable forwarding of file transfer connections.
+
+.TP 8
+.B mask=<int>
+Determine the distribution of channel ids between the proxies. By
+default, channels whose ids are multiple of 8 (starting from 0) are
+reserved for the NX client side. All the other channels can be allocated
+by the nx-X11 Agent side.
+
+.TP 8
+.B timeout=t
+Specify the keep-alive timeout used by proxies to determine if there is a
+network problem preventing communication with the remote peer. A value of
+0 disables the check.
+
+.TP 8
+.B cleanup=t
+Specify the number of seconds the proxy has to wait at session shutdown
+before closing all channels. The feature is used by the NX server to
+ensure that services are disconnected before shutting down the link.
+
+.TP 8
+.B pack=<string>
+Determine the method used to compress images.
+
+.TP 8
+.B product=<string>
+The product id of the client or server. The value is ignored by the
+proxy, but the client or server can provide it to facilitate the support.
+
+.TP 8
+.B core=<bool>
+Enable production of core dumps when aborting the proxy connection.
+
+.TP 8
+.B options=<string>
+Specify an additional file containing options that has to be merged with
+option read from the command line or the environment.
+
+.TP 8
+.B kill=<int>
+Add the given process to the list of daemons that must be terminated at
+session shutdown. Multiple 'kill=<int>' options can be specified. The proxy
+will send them a SIGTERM signal just before exiting.
+
+.TP 8
+.B strict=<bool>
+Optimize for responsiveness, rather than for the best use of all the
+available bandwidth.
+
+.TP 8
+.B encryption=<bool>
+Should be set to 1 if the proxy is running as part of a program providing
+encryption of the point to point communication.
+
+.TP 8
+.I These options are interpreted by the nx-NX Agent. They are ignored by the proxy.
+
+ rootless=<bool>
+ geometry=<string>
+ resize=<bool>
+ fullscreen=<bool>
+ keyboard=<string>
+ clipboard=<int>
+ streaming=<int>
+ backingstore=<int>
+ composite=<int>
+ xinerama=<int>
+ shmem=<bool>
+ shpix=<bool>
+ kbtype=<string>
+ client=<string>
+ shadow=<int>
+ shadowuid=<int>
+ shadowmode=<string>
+ defer=<int>
+ tile=<string>
+ menu=<int>
+ sleep=<int>
+
+.SH NX ENVIRONMENT VARIABLES
+
+The \fBnxproxy\fR application (and also \fBnxagent\fR when using nxcomp
+support) can be influenced by the following environment variables:
+
+
+.TP 8
+.B NX_ROOT
+The root NX directory is the place where the session directory and the
+cache files are created. This is usually overridden by passing the 'root='
+option. By default, the root NX directory is assumed to be the
+directory '.nx' in the user's home.
+
+.TP 8
+.B NX_SYSTEM
+The directory where NX programs and libraries reside. If not set, the
+value is assumed to be '/usr/NX'. Programs, libraries and data files are
+respectedly searched in the 'bin', 'lib' and 'share' subdirectories.
+
+.TP 8
+.B NX_HOME
+The NX user's home directory. If NX_ROOT is not set or invalid, the
+user's NX directory is created here.
+
+.TP 8
+.B NX_TEMP
+The directory where the X11 Unix Domain Sockets and all temporary files
+are to be created.
+
+.TP 8
+.B NX_CLIENT
+The full path to the <nxclient> executable. If the variable is not set,
+the <nxclient> executable will be run assuming that the program is in the
+system path. This can be useful on platforms like Windows and the MacOS X
+where <nxclient> is located in a different directory compared to the
+other programs, to make easier for the user to execute the program from
+the shell.
+
+.TP 8
+.B NX_SLAVE_CMD
+The full path to the slave channel handler. When the slave channel is
+enabled, the agent will listen on a port and forward the connection to
+the NX_SLAVE_CMD program. This can be used to implement agent/proxy
+communication for applications such as serial port and USB forwarding.
+
+.SH SHELL ENVIRONMENT VARIABLES
+
+.TP 8
+.B HOME
+The variable is checked in the case NX_HOME is not set, null or invalid.
+
+.TP 8
+.B TEMP
+The variable is checked whenever the NX_TEMP directory is not set, null
+or invalid.
+
+.TP 8
+.B PATH
+The path where all executables are searched, except <nxclient>. If
+NX_CLIENT is not set, also the client executable is searched in the
+system path.
+
+.TP 8
+.B LD_LIBRARY_PATH
+System-wide library search order. This should be set by the program
+invoking the proxy.
+
+.TP 8
+.B DISPLAY
+On the X server side, the DISPLAY variable indicates the location of the
+X11 server. When nxcomp is used as a transport library, the DISPLAY may
+represent a NX transport specification and options can passed in the form
+nx/nx,option=value...
+
+.TP 8
+.B XAUTHORITY
+This is the file containing the X11 authorization cookie. If not set, the
+file is assumed to be in the user's home (either NX_HOME or HOME).
+
+.SH AUTHOR
+The \fBnxproxy\fR application has originally been derived from a software
+project called DXCP. The company NoMachine turned DXCP into nxcomp with
+nxproxy as executable around nxcomp.
+.PP
+The current maintenance of \fBnxproxy\fR (major version 3) is coordinated
+between various projects, mainly by The Arctica Project, TheQVD (Qindel
+Group) and the X2Go Project.
+.PP
+This manual has been written by Mike Gabriel
+<mike.gabriel@das\-netzwerkteam.de> for the X2Go project
+(http://www.x2go.org) and later on improved for the Arctica Project
+(https://arctica-project.org).
diff --git a/nxproxy/mkinstalldirs b/nxproxy/mkinstalldirs
new file mode 100755
index 000000000..936cf3407
--- /dev/null
+++ b/nxproxy/mkinstalldirs
@@ -0,0 +1,34 @@
+#! /bin/sh
+# mkinstalldirs --- make directory hierarchy
+# Author: Noah Friedman <friedman@prep.ai.mit.edu>
+# Created: 1993-05-16
+# Last modified: 1995-03-05
+# Public domain
+
+errstatus=0
+
+for file in ${1+"$@"} ; do
+ set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
+ shift
+
+ pathcomp=
+ for d in ${1+"$@"} ; do
+ pathcomp="$pathcomp$d"
+ case "$pathcomp" in
+ -* ) pathcomp=./$pathcomp ;;
+ esac
+
+ if test ! -d "$pathcomp"; then
+ echo "mkdir $pathcomp" 1>&2
+ mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$?
+ fi
+
+ if test ! -d "$pathcomp"; then
+ errstatus=$lasterr
+ fi
+
+ pathcomp="$pathcomp/"
+ done
+done
+
+exit $errstatus