aboutsummaryrefslogtreecommitdiff
path: root/nxcomp/Proxy.cpp
diff options
context:
space:
mode:
authorSalvador Fandino <sfandino@yahoo.com>2016-04-20 16:22:56 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-04-27 13:59:34 +0200
commit3713346f3959782c5e5d1ddd0252f25fb319d732 (patch)
treea5c9561b419cb278af6f5b27181a5b62496a8f50 /nxcomp/Proxy.cpp
parentb326eda7328e95200f7d70efde35ce51a14bab3d (diff)
downloadnx-libs-3713346f3959782c5e5d1ddd0252f25fb319d732.tar.gz
nx-libs-3713346f3959782c5e5d1ddd0252f25fb319d732.tar.bz2
nx-libs-3713346f3959782c5e5d1ddd0252f25fb319d732.zip
Provide support for channel endpoints being UNIX file sockets in addition to being TCP/IP sockets.
Diffstat (limited to 'nxcomp/Proxy.cpp')
-rw-r--r--nxcomp/Proxy.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/nxcomp/Proxy.cpp b/nxcomp/Proxy.cpp
index 7655ccb40..1693590db 100644
--- a/nxcomp/Proxy.cpp
+++ b/nxcomp/Proxy.cpp
@@ -65,6 +65,7 @@ struct sockaddr_un
#include "ClientChannel.h"
#include "ServerChannel.h"
#include "GenericChannel.h"
+#include "ChannelEndPoint.h"
//
// We need to adjust some values related
@@ -6053,8 +6054,36 @@ int Proxy::handleNewSlaveConnection(int clientFd)
return handleNewGenericConnection(clientFd, channel_slave, "slave");
}
+
+
int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
- const char *hostname, int port, const char *label)
+ ChannelEndPoint &endPoint, const char *label)
+{
+ char *unixPath, *host;
+ long port;
+
+ if (endPoint.getUnixPath(&unixPath)) {
+ return handleNewGenericConnectionFromProxyUnix(channelId, type, unixPath, label);
+ }
+
+ if (endPoint.getTCPHostAndPort(&host, &port)) {
+ return handleNewGenericConnectionFromProxyTCP(channelId, type, host, port, label);
+ }
+
+ #ifdef WARNING
+ *logofs << "Proxy: WARNING! Refusing attempted connection "
+ << "to " << label << " server.\n" << logofs_flush;
+ #endif
+
+ cerr << "Warning" << ": Refusing attempted connection "
+ << "to " << label << " server.\n";
+
+ return -1;
+}
+
+int Proxy::handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type,
+ const char *hostname, long port, const char *label)
+
{
if (port <= 0)
{
@@ -6173,8 +6202,8 @@ int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type typ
return 1;
}
-int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type,
- const char *hostname, const char *path, const char *label)
+int Proxy::handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type,
+ const char *path, const char *label)
{
if (path == NULL || *path == '\0' )
{