62
|
1 #include "includes.h" |
|
2 #include "options.h" |
|
3 #include "tcp-accept.h" |
|
4 #include "tcp-connect.h" |
|
5 #include "channel.h" |
|
6 |
|
7 static const struct ChanType cli_chan_tcplocal = { |
|
8 1, /* sepfds */ |
|
9 "direct-tcpip", |
|
10 NULL, |
|
11 NULL, |
|
12 NULL |
|
13 }; |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 static int cli_localtcp(char* port) { |
|
19 |
|
20 struct TCPListener* tcpinfo = NULL; |
|
21 |
|
22 tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener*)); |
|
23 tcpinfo->addr = NULL; |
|
24 tcpinfo->port = port; |
|
25 tcpinfo->chantype = &cli_chan_tcplocal; |
|
26 |
|
27 ret = listen_tcpfwd(tcpinfo); |
|
28 |
|
29 if (ret == DROPBEAR_FAILURE) { |
|
30 DROPBEAR_LOG(LOG_WARNING, "Failed to listen on port %s", port); |
|
31 m_free(tcpinfo); |
|
32 } |
|
33 return ret; |
|
34 } |