diff options
author | Matt Johnston <matt@ucc.asn.au> | 2006-03-10 06:31:29 +0000 |
---|---|---|
committer | Matt Johnston <matt@ucc.asn.au> | 2006-03-10 06:31:29 +0000 |
commit | 85491713ebc8d52c61e9d83c9dfa3c28acdfb4b1 (patch) | |
tree | 92fe73bc4b7e79d1524e3b69b240fa17ab024fe7 /cli-tcpfwd.c | |
parent | 90546d5218e58dfa543b547c2066987058627534 (diff) | |
parent | 60ae0d366440dd449f1bc4c392cfe84b7318b191 (diff) | |
download | dropbear-contrib-blacklist.tar.gz |
propagate from branch 'au.asn.ucc.matt.dropbear' (head 7ad1775ed65e75dbece27fe6b65bf1a234db386a)contrib-blacklist
to branch 'au.asn.ucc.matt.dropbear.contrib.blacklist' (head 1d86a4f0a401cc68c2670d821a2f6366c37af143)
Diffstat (limited to 'cli-tcpfwd.c')
-rw-r--r-- | cli-tcpfwd.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/cli-tcpfwd.c b/cli-tcpfwd.c index 300a2fa..c3bfd4d 100644 --- a/cli-tcpfwd.c +++ b/cli-tcpfwd.c @@ -95,10 +95,19 @@ 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; + tcpinfo->tcp_type = direct; ret = listen_tcpfwd(tcpinfo); @@ -113,13 +122,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(); @@ -186,11 +202,9 @@ static int newtcpforwarded(struct Channel * channel) { ses.maxfd = MAX(ses.maxfd, sock); - /* Note that infd is actually the "outgoing" direction on the - * tcp connection, vice versa for outfd. - * We don't set outfd, that will get set after the connection's + /* We don't set readfd, that will get set after the connection's * progress succeeds */ - channel->infd = sock; + channel->writefd = sock; channel->initconn = 1; err = SSH_OPEN_IN_PROGRESS; |