Mercurial > dropbear
changeset 1621:8cdabd7d34aa
merge remote forward fix
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 07 Sep 2018 23:02:53 +0800 |
parents | a3bb8f8949de (current diff) 572a7aefa188 (diff) |
children | e11ed628708b |
files | |
diffstat | 4 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/cli-tcpfwd.c Sun Aug 26 22:26:42 2018 +0800 +++ b/cli-tcpfwd.c Fri Sep 07 23:02:53 2018 +0800 @@ -135,7 +135,7 @@ tcpinfo->chantype = &cli_chan_tcplocal; tcpinfo->tcp_type = direct; - ret = listen_tcpfwd(tcpinfo); + ret = listen_tcpfwd(tcpinfo, NULL); if (ret == DROPBEAR_FAILURE) { m_free(tcpinfo);
--- a/svr-tcpfwd.c Sun Aug 26 22:26:42 2018 +0800 +++ b/svr-tcpfwd.c Fri Sep 07 23:02:53 2018 +0800 @@ -168,6 +168,7 @@ unsigned int addrlen; struct TCPListener *tcpinfo = NULL; unsigned int port; + struct Listener *listener = NULL; TRACE(("enter remotetcpreq")) @@ -208,9 +209,9 @@ tcpinfo->listenaddr = m_strdup(request_addr); } - ret = listen_tcpfwd(tcpinfo); + ret = listen_tcpfwd(tcpinfo, &listener); if (DROPBEAR_SUCCESS == ret) { - tcpinfo->listenport = get_sock_port(ses.listeners[0]->socks[0]); + tcpinfo->listenport = get_sock_port(listener->socks[0]); *allocated_listen_port = tcpinfo->listenport; }
--- a/tcp-accept.c Sun Aug 26 22:26:42 2018 +0800 +++ b/tcp-accept.c Fri Sep 07 23:02:53 2018 +0800 @@ -110,12 +110,12 @@ } } -int listen_tcpfwd(struct TCPListener* tcpinfo) { +int listen_tcpfwd(struct TCPListener* tcpinfo, struct Listener **ret_listener) { char portstring[NI_MAXSERV]; int socks[DROPBEAR_MAX_SOCKS]; - struct Listener *listener = NULL; int nsocks; + struct Listener *listener; char* errstring = NULL; TRACE(("enter listen_tcpfwd")) @@ -142,6 +142,10 @@ return DROPBEAR_FAILURE; } + if (ret_listener) { + *ret_listener = listener; + } + TRACE(("leave listen_tcpfwd: success")) return DROPBEAR_SUCCESS; }
--- a/tcpfwd.h Sun Aug 26 22:26:42 2018 +0800 +++ b/tcpfwd.h Fri Sep 07 23:02:53 2018 +0800 @@ -26,6 +26,7 @@ #include "channel.h" #include "list.h" +#include "listener.h" struct TCPListener { @@ -69,7 +70,7 @@ void cli_recv_msg_request_failure(void); /* Common */ -int listen_tcpfwd(struct TCPListener* tcpinfo); +int listen_tcpfwd(struct TCPListener* tcpinfo, struct Listener **ret_listener); int tcp_prio_inithandler(struct Channel* chan); /* A random identifier */