comparison svr-tcpfwd.c @ 1620:572a7aefa188 bugfix

FIx remote forward listeners
author Matt Johnston <matt@ucc.asn.au>
date Fri, 07 Sep 2018 23:02:20 +0800
parents 2c902644036d
children 79eef94ccea9
comparison
equal deleted inserted replaced
1618:7bd7e95ad1f8 1620:572a7aefa188
166 int ret = DROPBEAR_FAILURE; 166 int ret = DROPBEAR_FAILURE;
167 char * request_addr = NULL; 167 char * request_addr = NULL;
168 unsigned int addrlen; 168 unsigned int addrlen;
169 struct TCPListener *tcpinfo = NULL; 169 struct TCPListener *tcpinfo = NULL;
170 unsigned int port; 170 unsigned int port;
171 struct Listener *listener = NULL;
171 172
172 TRACE(("enter remotetcpreq")) 173 TRACE(("enter remotetcpreq"))
173 174
174 request_addr = buf_getstring(ses.payload, &addrlen); 175 request_addr = buf_getstring(ses.payload, &addrlen);
175 if (addrlen > MAX_IP_LEN) { 176 if (addrlen > MAX_IP_LEN) {
206 else 207 else
207 { 208 {
208 tcpinfo->listenaddr = m_strdup(request_addr); 209 tcpinfo->listenaddr = m_strdup(request_addr);
209 } 210 }
210 211
211 ret = listen_tcpfwd(tcpinfo); 212 ret = listen_tcpfwd(tcpinfo, &listener);
212 if (DROPBEAR_SUCCESS == ret) { 213 if (DROPBEAR_SUCCESS == ret) {
213 tcpinfo->listenport = get_sock_port(ses.listeners[0]->socks[0]); 214 tcpinfo->listenport = get_sock_port(listener->socks[0]);
214 *allocated_listen_port = tcpinfo->listenport; 215 *allocated_listen_port = tcpinfo->listenport;
215 } 216 }
216 217
217 out: 218 out:
218 if (ret == DROPBEAR_FAILURE) { 219 if (ret == DROPBEAR_FAILURE) {