Mercurial > dropbear
annotate cli-tcpfwd.c @ 63:dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
- still a checkpoint-ish commit
- sorted out listening on localhost only
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Wed, 11 Aug 2004 17:26:47 +0000 |
parents | 20563735e8b5 |
children | efb5e0b335cf |
rev | line source |
---|---|
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 | |
63
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
15 void setup_localtcp() { |
62 | 16 |
63
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
17 qv |
62 | 18 |
63
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
19 } |
62 | 20 |
63
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
21 static int cli_localtcp(unsigned int listenport, const char* remoteaddr, |
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
22 unsigned int remoteport) { |
62 | 23 |
24 struct TCPListener* tcpinfo = NULL; | |
25 | |
26 tcpinfo = (struct TCPListener*)m_malloc(sizeof(struct TCPListener*)); | |
63
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
27 tcpinfo->sendaddr = remoteaddr; |
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
28 tcpinfo->sendport = remoteport; |
dcc43965928f
- A nice cleaner structure for tcp (acceptor) forwarding.
Matt Johnston <matt@ucc.asn.au>
parents:
62
diff
changeset
|
29 tcpinfo->listenport = listenport; |
62 | 30 tcpinfo->chantype = &cli_chan_tcplocal; |
31 | |
32 ret = listen_tcpfwd(tcpinfo); | |
33 | |
34 if (ret == DROPBEAR_FAILURE) { | |
35 m_free(tcpinfo); | |
36 } | |
37 return ret; | |
38 } |