From 41ea54b0217175a4b78980671f4c6818eb66b166 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 26 Apr 2017 13:26:47 +0200 Subject: nxproxy: Switch to autoreconf. This also solves the last remnant of overlinking as described in GH issue #133. Fixes ArcticaProject/nx-libs#133. --- nxproxy/src/Main.c | 120 ++++++++++++++++++++++++++++++++++++++++++++++++ nxproxy/src/Makefile.am | 17 +++++++ 2 files changed, 137 insertions(+) create mode 100644 nxproxy/src/Main.c create mode 100644 nxproxy/src/Makefile.am (limited to 'nxproxy/src') diff --git a/nxproxy/src/Main.c b/nxproxy/src/Main.c new file mode 100644 index 000000000..d9fb1ef4f --- /dev/null +++ b/nxproxy/src/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 +#include +#include +#include +#include +#include + +#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/src/Makefile.am b/nxproxy/src/Makefile.am new file mode 100644 index 000000000..5ec1f9401 --- /dev/null +++ b/nxproxy/src/Makefile.am @@ -0,0 +1,17 @@ +NULL = + +nxexecdir = $(libexecdir) + +nxexec_PROGRAMS = nxproxy + +nxproxy_SOURCES = \ + Main.c \ + $(NULL) + +nxproxy_LDADD = \ + -L$(top_srcdir)/../nxcomp/ -lXcomp \ + $(NULL) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/../nxcomp/ \ + $(NULL) -- cgit v1.2.3 From f76c82403888bb498973ec974dbfd20e4edb02fe Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 30 Jun 2017 20:13:51 +0200 Subject: nxcomp: Switch to autoreconf. --- nxproxy/src/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'nxproxy/src') diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index 5ec1f9401..60ace92ce 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -9,9 +9,9 @@ nxproxy_SOURCES = \ $(NULL) nxproxy_LDADD = \ - -L$(top_srcdir)/../nxcomp/ -lXcomp \ + -L$(top_srcdir)/../nxcomp/src/.libs -lXcomp \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/../nxcomp/ \ + -I$(top_srcdir)/../nxcomp/include/ \ $(NULL) -- cgit v1.2.3 From 430ae6eb6c4659f3bd907ceb84b7b7bcaf65071b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 2 Aug 2017 18:19:19 -0400 Subject: nxproxy/src/Makefile.am: Actually define nxproxy_CFLAGS, so the various compiler warning flags get enabled at build time of nxproxy. --- nxproxy/src/Makefile.am | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'nxproxy/src') diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index 60ace92ce..c09febcf6 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -12,6 +12,10 @@ nxproxy_LDADD = \ -L$(top_srcdir)/../nxcomp/src/.libs -lXcomp \ $(NULL) +nxproxy_CFLAGS = \ + $(BASE_CFLAGS) \ + $(NULL) + AM_CPPFLAGS = \ -I$(top_srcdir)/../nxcomp/include/ \ $(NULL) -- cgit v1.2.3 From 03ebe6f258ef29fc2bb6dc10fb9b829213dfd780 Mon Sep 17 00:00:00 2001 From: Simon Matter Date: Fri, 29 Sep 2017 12:31:01 +0200 Subject: nxproxy/src/Main.c: Silence compiler warning. Fixes ArcticaProject/nx-libs#506. --- nxproxy/src/Main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nxproxy/src') diff --git a/nxproxy/src/Main.c b/nxproxy/src/Main.c index d9fb1ef4f..dc4e0fd68 100644 --- a/nxproxy/src/Main.c +++ b/nxproxy/src/Main.c @@ -41,6 +41,7 @@ int main(int argc, const char **argv) char *options = NULL; + unsigned long int nx_commfd; char *nx_commfd_str = NULL; options = getenv("NX_DISPLAY"); @@ -48,7 +49,7 @@ int main(int argc, const char **argv) if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL) { errno = 0; - unsigned long int nx_commfd = strtoul(nx_commfd_str, NULL, 10); + nx_commfd = strtoul(nx_commfd_str, NULL, 10); if ((errno) && (0 == nx_commfd)) { -- cgit v1.2.3 From 1c6c9c04b56656d9ab3f486738a4950e71f29b74 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Fri, 27 Oct 2017 14:14:24 +0200 Subject: nxproxy: use ax_pthread.m4. Works around libtool bug related to using both -nostdlib and -pthread (with the former dropping latter usage.) --- nxproxy/src/Makefile.am | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'nxproxy/src') diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index c09febcf6..7e55900d3 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -9,11 +9,17 @@ nxproxy_SOURCES = \ $(NULL) nxproxy_LDADD = \ + @PTHREAD_LIBS@ \ -L$(top_srcdir)/../nxcomp/src/.libs -lXcomp \ $(NULL) +nxproxy_LDFLAGS = \ + $(PTHREAD_LDFLAGS) \ + $(NULL) + nxproxy_CFLAGS = \ $(BASE_CFLAGS) \ + $(PTHREAD_CFLAGS) \ $(NULL) AM_CPPFLAGS = \ -- cgit v1.2.3 From ca43087812afa2817ddc086591b60d593aacc954 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Nov 2017 13:28:17 +0100 Subject: Drop bin wrappers for nxagent and nxproxy, directly install nxproxy and nxagent to BINDIR. Fixes ArcticaProject/nx-libs#546. --- nxproxy/src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'nxproxy/src') diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index 7e55900d3..4fd2eefd6 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -1,6 +1,6 @@ NULL = -nxexecdir = $(libexecdir) +nxexecdir = $(bindir) nxexec_PROGRAMS = nxproxy -- cgit v1.2.3