summaryrefslogtreecommitdiffhomepage
path: root/cli-tcpfwd.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2005-12-04 16:13:11 +0000
committerMatt Johnston <matt@ucc.asn.au>2005-12-04 16:13:11 +0000
commita673d609639b180eee3a4ba49d7f07d0239ea666 (patch)
treecc1c3b4f3d9d52b79861942a360bca266e98bdcb /cli-tcpfwd.c
parent736f370dce614b717193f45d084e9e009de723ce (diff)
* add -g (dbclient) and -a (dropbear) options for allowing non-local
hosts to connect to forwarded ports. Rearranged various some of the tcp listening code. * changed to /* */ style brackets in svr-authpam.c --HG-- extra : convert_revision : c1e04e648867db464fe9818c4910e4320cd50c32
Diffstat (limited to 'cli-tcpfwd.c')
-rw-r--r--cli-tcpfwd.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c
index 6832cbf..d8f1da6 100644
--- a/cli-tcpfwd.c
+++ b/cli-tcpfwd.c
@@ -95,9 +95,17 @@ static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
remoteport));
tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener));
+
tcpinfo->sendaddr = m_strdup(remoteaddr);
tcpinfo->sendport = remoteport;
+
+ if (opts.listen_fwd_all) {
+ tcpinfo->listenaddr = m_strdup("");
+ } else {
+ tcpinfo->listenaddr = m_strdup("localhost");
+ }
tcpinfo->listenport = listenport;
+
tcpinfo->chantype = &cli_chan_tcplocal;
ret = listen_tcpfwd(tcpinfo);
@@ -113,13 +121,20 @@ static int cli_localtcp(unsigned int listenport, const char* remoteaddr,
#ifdef ENABLE_CLI_REMOTETCPFWD
static void send_msg_global_request_remotetcp(int port) {
+ char* listenspec = NULL;
TRACE(("enter send_msg_global_request_remotetcp"))
CHECKCLEARTOWRITE();
buf_putbyte(ses.writepayload, SSH_MSG_GLOBAL_REQUEST);
buf_putstring(ses.writepayload, "tcpip-forward", 13);
buf_putbyte(ses.writepayload, 0);
- buf_putstring(ses.writepayload, "0.0.0.0", 7); /* TODO: IPv6? */
+ if (opts.listen_fwd_all) {
+ listenspec = "";
+ } else {
+ listenspec = "localhost";
+ }
+ /* TODO: IPv6? */;
+ buf_putstring(ses.writepayload, listenspec, strlen(listenspec));
buf_putint(ses.writepayload, port);
encrypt_packet();