From 920f423a59b568cf91128f8e1fa8374e521141ca Mon Sep 17 00:00:00 2001 From: Vadim Troshchinskiy Date: Tue, 13 Dec 2016 12:00:43 +0100 Subject: Make nxagent only bind to loopback when requested --- nxcomp/Loop.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp index c566aa2d1..86c951a06 100644 --- a/nxcomp/Loop.cpp +++ b/nxcomp/Loop.cpp @@ -6692,11 +6692,15 @@ int WaitForRemote(ChannelEndPoint &socketAddress) strcpy(hostLabel, "any host"); } - if (loopbackBind) + long bindPort; + if (socketAddress.getTCPHostAndPort(NULL, &bindPort)) { - long bindPort; - if (socketAddress.getTCPHostAndPort(NULL, &bindPort)) - socketAddress.setSpec("localhost", bindPort); + socketAddress.setSpec(loopbackBind ? "localhost" : "*", bindPort); + } + else + { + // This should never happen + cerr << "Error" << ": Unable to change bind host\n"; } } else if (socketAddress.isUnixSocket()) -- cgit v1.2.3