summaryrefslogtreecommitdiff
path: root/src/tcpproxy.c
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2010-11-27 03:31:35 +0000
committerChristian Pointner <equinox@spreadspace.org>2010-11-27 03:31:35 +0000
commit4793dc0638330ef5296c126d136489228d9521b0 (patch)
tree25623cd2a2388ec9ad16ac04107f0aaef91daac9 /src/tcpproxy.c
parentadded tcp listener list (diff)
listening on tcp sockets works now
git-svn-id: https://svn.spreadspace.org/tcpproxy/trunk@8 e61f0598-a718-4e21-a8f0-0aadfa62ad6b
Diffstat (limited to 'src/tcpproxy.c')
-rw-r--r--src/tcpproxy.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/tcpproxy.c b/src/tcpproxy.c
index 45402c7..d55277e 100644
--- a/src/tcpproxy.c
+++ b/src/tcpproxy.c
@@ -123,9 +123,25 @@ int main(int argc, char* argv[])
log_printf(NOTICE, "just started...");
options_parse_post(&opt);
+ listeners_t listeners;
+ ret = listener_init(&listeners);
+ if(ret) {
+ options_clear(&opt);
+ log_close();
+ exit(-1);
+ }
+ ret = listener_add(&listeners, opt.local_addr_, opt.local_port_, opt.remote_addr_, opt.remote_port_);
+ if(ret) {
+ listener_clear(&listeners);
+ options_clear(&opt);
+ log_close();
+ exit(-1);
+ }
+
priv_info_t priv;
if(opt.username_)
if(priv_init(&priv, opt.username_, opt.groupname_)) {
+ listener_clear(&listeners);
options_clear(&opt);
log_close();
exit(-1);
@@ -141,12 +157,14 @@ int main(int argc, char* argv[])
if(opt.chroot_dir_)
if(do_chroot(opt.chroot_dir_)) {
+ listener_clear(&listeners);
options_clear(&opt);
log_close();
exit(-1);
}
if(opt.username_)
if(priv_drop(&priv)) {
+ listener_clear(&listeners);
options_clear(&opt);
log_close();
exit(-1);
@@ -166,6 +184,7 @@ int main(int argc, char* argv[])
ret = main_loop(&opt);
+ listener_clear(&listeners);
options_clear(&opt);
if(!ret)