aboutsummaryrefslogtreecommitdiff
path: root/nxcomp
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2013-03-28 08:58:35 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2013-03-28 08:58:35 +0100
commitdb7feaf9883bb0dc419593588036405ef12ebca1 (patch)
tree1a911fe1a08aed78845e17b5350c9238452a12dd /nxcomp
parente77bf36d9afbc7e56522574b06217d57c11dd095 (diff)
downloadnx-libs-db7feaf9883bb0dc419593588036405ef12ebca1.tar.gz
nx-libs-db7feaf9883bb0dc419593588036405ef12ebca1.tar.bz2
nx-libs-db7feaf9883bb0dc419593588036405ef12ebca1.zip
Revert "release 3.5.0.19"
This reverts commit e77bf36d9afbc7e56522574b06217d57c11dd095.
Diffstat (limited to 'nxcomp')
-rw-r--r--nxcomp/Agent.h28
-rw-r--r--nxcomp/Auth.cpp17
-rw-r--r--nxcomp/Loop.cpp64
-rw-r--r--nxcomp/Makefile.in41
-rw-r--r--nxcomp/Message.cpp4
-rw-r--r--nxcomp/Misc.cpp18
-rw-r--r--nxcomp/Misc.h12
-rw-r--r--nxcomp/Pgn.cpp6
-rw-r--r--nxcomp/Proxy.cpp4
-rw-r--r--nxcomp/Split.cpp2
-rw-r--r--nxcomp/configure.in4
11 files changed, 53 insertions, 147 deletions
diff --git a/nxcomp/Agent.h b/nxcomp/Agent.h
index ded344d84..fac5acd43 100644
--- a/nxcomp/Agent.h
+++ b/nxcomp/Agent.h
@@ -149,38 +149,30 @@ class Agent
int remoteCanRead(const fd_set * const readSet)
{
- // OS X 10.5 requires the second argument to be non-const, so copy readSet.
- // It's safe though, as FD_ISSET does not operate on it.
- fd_set readWorkSet = *readSet;
-
#if defined(TEST) || defined(INFO)
*logofs << "Agent: remoteCanRead() is " <<
- (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0)
- << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet)
+ (FD_ISSET(remoteFd_, readSet) && transport_ -> dequeuable() != 0)
+ << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, readSet)
<< " and dequeuable " << transport_ -> dequeuable()
<< ".\n" << logofs_flush;
#endif
- return (FD_ISSET(remoteFd_, &readWorkSet) &&
+ return (FD_ISSET(remoteFd_, readSet) &&
transport_ -> dequeuable() != 0);
}
int remoteCanWrite(const fd_set * const writeSet)
{
- // OS X 10.5 requires the second argument to be non-const, so copy writeSet.
- // It's safe though, as FD_ISSET does not operate on it.
- fd_set writeWorkSet = *writeSet;
-
#if defined(TEST) || defined(INFO)
*logofs << "Agent: remoteCanWrite() is " <<
- (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ ->
+ (FD_ISSET(remoteFd_, writeSet) && transport_ ->
queuable() != 0 && canRead_ == 1) << " with FD_ISSET() "
- << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable "
+ << (int) FD_ISSET(remoteFd_, writeSet) << " queueable "
<< transport_ -> queuable() << " channel can read "
<< canRead_ << ".\n" << logofs_flush;
#endif
- return (FD_ISSET(remoteFd_, &writeWorkSet) &&
+ return (FD_ISSET(remoteFd_, writeSet) &&
transport_ -> queuable() != 0 &&
canRead_ == 1);
}
@@ -211,17 +203,13 @@ class Agent
int proxyCanRead(const fd_set * const readSet)
{
- // OS X 10.5 requires the second argument to be non-const, so copy readSet.
- // It's safe though, as FD_ISSET does not operate on it.
- fd_set readWorkSet = *readSet;
-
#if defined(TEST) || defined(INFO)
*logofs << "Agent: proxyCanRead() is "
- << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet)
+ << ((int) FD_ISSET(proxy -> getFd(), readSet)
<< ".\n" << logofs_flush;
#endif
- return (FD_ISSET(proxy -> getFd(), &readWorkSet));
+ return (FD_ISSET(proxy -> getFd(), readSet));
}
int enqueueData(const char *data, const int size) const
diff --git a/nxcomp/Auth.cpp b/nxcomp/Auth.cpp
index c52392a51..d8e999132 100644
--- a/nxcomp/Auth.cpp
+++ b/nxcomp/Auth.cpp
@@ -217,31 +217,22 @@ int Auth::getCookie()
//
// Use the nxauth command on Windows and the Mac, xauth
- // on all the other platforms. On Windows we assume that
- // the nxauth command is located under bin in the client
- // installation directory. On Mac OS X we assume that the
- // command is located directly in the client installation
- // directory, to make bundle shipping easier. On all the
+ // on all the other platforms. On Windows and on the Mac
+ // we assume that the nxauth command is located under
+ // bin in the client installation directory. On all the
// other platforms we use the default xauth command that
// is in our path.
//
char command[DEFAULT_STRING_LIMIT];
- #if defined(__CYGWIN32__)
+ #if defined(__CYGWIN32__) || defined(__APPLE__)
snprintf(command, DEFAULT_STRING_LIMIT - 1,
"%s/bin/nxauth", control -> SystemPath);
*(command + DEFAULT_STRING_LIMIT - 1) = '\0';
- #elif defined(__APPLE__)
-
- snprintf(command, DEFAULT_STRING_LIMIT - 1,
- "%s/nxauth", control -> SystemPath);
-
- *(command + DEFAULT_STRING_LIMIT - 1) = '\0';
-
#else
strcpy(command, "xauth");
diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp
index 8069af598..92b6fc28f 100644
--- a/nxcomp/Loop.cpp
+++ b/nxcomp/Loop.cpp
@@ -952,7 +952,6 @@ static char listenHost[DEFAULT_STRING_LENGTH] = { 0 };
static char displayHost[DEFAULT_STRING_LENGTH] = { 0 };
static char authCookie[DEFAULT_STRING_LENGTH] = { 0 };
-static int loopbackBind = DEFAULT_LOOPBACK_BIND;
static int proxyPort = DEFAULT_NX_PROXY_PORT;
static int xPort = DEFAULT_NX_X_PORT;
@@ -3960,14 +3959,7 @@ int SetupTcpSocket()
tcpAddr.sin_family = AF_INET;
tcpAddr.sin_port = htons(proxyPortTCP);
- if ( loopbackBind )
- {
- tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- }
- else
- {
- tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- }
+ tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(tcpFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
{
@@ -4520,14 +4512,7 @@ int ListenConnection(int port, const char *label)
tcpAddr.sin_family = AF_INET;
tcpAddr.sin_port = htons(portTCP);
- if ( loopbackBind )
- {
- tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- }
- else
- {
- tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- }
+ tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
if (bind(newFD, (sockaddr *) &tcpAddr, sizeof(tcpAddr)) == -1)
{
@@ -5899,10 +5884,21 @@ void InstallSignal(int signal, int action)
struct sigaction newAction;
- memset(&newAction, 0, sizeof(newAction));
-
newAction.sa_handler = HandleSignal;
+ //
+ // This field doesn't exist on most OSes except
+ // Linux. We keep setting the field to NULL to
+ // avoid side-effects in the case the field is
+ // a value return.
+ //
+
+ #if defined(__linux__)
+
+ newAction.sa_restorer = NULL;
+
+ #endif
+
sigemptyset(&(newAction.sa_mask));
if (signal == SIGCHLD)
@@ -6513,10 +6509,14 @@ void SetTimer(int value)
struct sigaction action;
- memset(&action, 0, sizeof(action));
-
action.sa_handler = HandleTimer;
+ #if defined(__linux__)
+
+ action.sa_restorer = NULL;
+
+ #endif
+
sigemptyset(&action.sa_mask);
action.sa_flags = 0;
@@ -6695,14 +6695,7 @@ int WaitForRemote(int portNum)
#ifdef __APPLE__
- if ( loopbackBind )
- {
- tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- }
- else
- {
- tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
- }
+ tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY);
#else
@@ -8381,10 +8374,6 @@ int ParseEnvironmentOptions(const char *env, int force)
listenPort = ValidateArg("local", name, value);
}
- else if (strcasecmp(name, "loopback") == 0)
- {
- loopbackBind = ValidateArg("local", name, value);
- }
else if (strcasecmp(name, "accept") == 0)
{
if (*connectHost != '\0')
@@ -13761,14 +13750,7 @@ int ParseListenOption(int &address)
}
else
{
- if ( loopbackBind )
- {
- address = htonl(INADDR_LOOPBACK);
- }
- else
- {
- address = htonl(INADDR_ANY);
- }
+ address = htonl(INADDR_ANY);
}
}
else
diff --git a/nxcomp/Makefile.in b/nxcomp/Makefile.in
index 5a8633281..434118b4e 100644
--- a/nxcomp/Makefile.in
+++ b/nxcomp/Makefile.in
@@ -64,15 +64,10 @@ exec_prefix = @exec_prefix@
bindir = @bindir@
man1dir = @mandir@/man1
VPATH = @srcdir@
-libdir = @libdir@
-includedir = @includedir@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
-INSTALL_LINK = cp -av
-DESTDIR =
-RM_FILE = rm -f
#
# This should be autodetected.
@@ -269,48 +264,16 @@ depend.status:
fi
touch depend.status
-install: install.bin install.lib install.man
+install: install.bin install.man
install.bin:
-install.lib: all
- ./mkinstalldirs $(DESTDIR)${libdir}/nx
- ./mkinstalldirs $(DESTDIR)${includedir}/nx
- $(INSTALL_DATA) $(LIBFULL) $(DESTDIR)${libdir}/nx
- $(INSTALL_LINK) libXcomp.so.3 $(DESTDIR)${libdir}/nx
- $(INSTALL_LINK) libXcomp.so $(DESTDIR)${libdir}/nx
- $(INSTALL_DATA) libXcomp.a $(DESTDIR)${libdir}/nx
- $(INSTALL_DATA) NX*.h $(DESTDIR)${includedir}/nx
- $(INSTALL_DATA) MD5.h $(DESTDIR)${includedir}/nx
- echo "Running ldconfig tool, this may take a while..." && ldconfig || true
-
install.man:
-uninstall: uninstall.bin uninstall.lib uninstall.man
-
-uninstall.bin:
-
-uninstall.lib:
- $(RM_FILE) $(DESTDIR)${libdir}/nx/$(LIBFULL)
- $(RM_FILE) $(DESTDIR)${libdir}/nx/libXcomp.so.3
- $(RM_FILE) $(DESTDIR)${libdir}/nx/libXcomp.so
- $(RM_FILE) $(DESTDIR)${libdir}/nx/libXcomp.a
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NXalert.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NX.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NXmitshm.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NXpack.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NXproto.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NXrender.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/NXvars.h
- $(RM_FILE) $(DESTDIR)${includedir}/nx/MD5.h
- echo "Running ldconfig tool, this may take a while..." && ldconfig || true
-
-uninstall.man:
-
clean:
-rm -f *~ *.o *.bak *.orig *.rej st?????? core core.* *.out.* \
@ALL@
distclean: clean
-rm -rf autom4te.cache config.status config.log \
- config.cache depend.status Makefile tags configure
+ config.cache depend.status Makefile tags
diff --git a/nxcomp/Message.cpp b/nxcomp/Message.cpp
index 188ed9a0e..72d4fff3d 100644
--- a/nxcomp/Message.cpp
+++ b/nxcomp/Message.cpp
@@ -15,9 +15,9 @@
/* */
/**************************************************************************/
-#include <cstdio>
+#include <stdio.h>
#include <unistd.h>
-#include <cstring>
+#include <string.h>
#include <algorithm>
diff --git a/nxcomp/Misc.cpp b/nxcomp/Misc.cpp
index 0095eaa74..2c72259e3 100644
--- a/nxcomp/Misc.cpp
+++ b/nxcomp/Misc.cpp
@@ -15,11 +15,11 @@
/* */
/**************************************************************************/
-#include <cstdio>
-#include <cctype>
-#include <cstdlib>
+#include <stdio.h>
+#include <ctype.h>
+#include <stdlib.h>
#include <unistd.h>
-#include <csignal>
+#include <signal.h>
#include <errno.h>
#include <string.h>
@@ -42,14 +42,6 @@
#undef DEBUG
//
-// By default nxproxy binds to all network interfaces, setting
-// DEFAULT_LOOPBACK_BIND to 1 enables binding to the loopback
-// device only.
-//
-
-const int DEFAULT_LOOPBACK_BIND = 0;
-
-//
// TCP port offset applied to any NX port specification.
//
@@ -145,8 +137,6 @@ static const char UsageInfo[] =
\n\
listen=n Local port used for accepting the proxy connection.\n\
\n\
- loopback=b Bind to the loopback device only.\n\
-\n\
accept=s Name or IP of host that can connect to the proxy.\n\
\n\
connect=s Name or IP of host that the proxy will connect to.\n\
diff --git a/nxcomp/Misc.h b/nxcomp/Misc.h
index 21a503082..200831757 100644
--- a/nxcomp/Misc.h
+++ b/nxcomp/Misc.h
@@ -21,8 +21,8 @@
#include <iostream>
#include <fstream>
-#include <cerrno>
-#include <cstring>
+#include <errno.h>
+#include <string.h>
#ifdef __sun
@@ -90,14 +90,6 @@ extern const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET;
extern const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET;
//
-// NX proxy binds to all network interfaces by default
-// With the -loopback parameter, you can switch
-// over to binding to the loopback device only.
-//
-
-extern const int DEFAULT_LOOPBACK_BIND;
-
-//
// Return strings containing various info.
//
diff --git a/nxcomp/Pgn.cpp b/nxcomp/Pgn.cpp
index af26724ef..a68373441 100644
--- a/nxcomp/Pgn.cpp
+++ b/nxcomp/Pgn.cpp
@@ -414,7 +414,7 @@ int DecompressPng16(unsigned char *compressedData, int compressedLen,
png_read_info(pngPtr, infoPtr);
- if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE)
+ if (infoPtr -> color_type == PNG_COLOR_TYPE_PALETTE)
{
png_set_expand(pngPtr);
}
@@ -565,7 +565,7 @@ int DecompressPng24(unsigned char *compressedData, int compressedLen,
png_read_info( pngPtr, infoPtr ) ;
- if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE)
+ if (infoPtr -> color_type == PNG_COLOR_TYPE_PALETTE)
{
png_set_expand(pngPtr);
}
@@ -709,7 +709,7 @@ int DecompressPng32(unsigned char *compressedData, int compressedLen,
png_read_info(pngPtr, infoPtr) ;
- if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE)
+ if (infoPtr -> color_type == PNG_COLOR_TYPE_PALETTE)
{
png_set_expand(pngPtr);
}
diff --git a/nxcomp/Proxy.cpp b/nxcomp/Proxy.cpp
index d6c67e0e8..3b4df7eb6 100644
--- a/nxcomp/Proxy.cpp
+++ b/nxcomp/Proxy.cpp
@@ -15,9 +15,9 @@
/* */
/**************************************************************************/
-#include <cstdio>
+#include <stdio.h>
#include <unistd.h>
-#include <cstdlib>
+#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
diff --git a/nxcomp/Split.cpp b/nxcomp/Split.cpp
index 35a4ed4a2..50627e793 100644
--- a/nxcomp/Split.cpp
+++ b/nxcomp/Split.cpp
@@ -16,7 +16,7 @@
/**************************************************************************/
#include <unistd.h>
-#include <cstring>
+#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <utime.h>
diff --git a/nxcomp/configure.in b/nxcomp/configure.in
index 6fa9757a7..e9ab81da8 100644
--- a/nxcomp/configure.in
+++ b/nxcomp/configure.in
@@ -7,8 +7,8 @@ AC_PREREQ(2.13)
dnl Set our default compilation flags.
-CXXFLAGS="$CXXFLAGS -O3 -fno-rtti -fno-exceptions"
-CFLAGS="$CFLAGS -O3"
+CXXFLAGS="-O3 -fno-rtti -fno-exceptions"
+CFLAGS="-O3"
dnl Reset default linking directives.