diff svr-tcpfwd.c @ 641:2b1bb792cd4d dropbear-tfm

- Update tfm changes to current default tip
author Matt Johnston <matt@ucc.asn.au>
date Mon, 21 Nov 2011 19:52:28 +0800
parents 79d48028457c
children c519b78b6d1a
line wrap: on
line diff
--- a/svr-tcpfwd.c	Mon Nov 21 19:19:57 2011 +0800
+++ b/svr-tcpfwd.c	Mon Nov 21 19:52:28 2011 +0800
@@ -206,11 +206,17 @@
 	tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener));
 	tcpinfo->sendaddr = NULL;
 	tcpinfo->sendport = 0;
-	tcpinfo->listenaddr = bindaddr;
 	tcpinfo->listenport = port;
 	tcpinfo->chantype = &svr_chan_tcpremote;
 	tcpinfo->tcp_type = forwarded;
 
+	if (!opts.listen_fwd_all || (strcmp(bindaddr, "localhost") == 0) ) {
+        // NULL means "localhost only"
+		m_free(bindaddr);
+		bindaddr = NULL;
+	}
+	tcpinfo->listenaddr = bindaddr;
+
 	ret = listen_tcpfwd(tcpinfo);
 
 out: