Mercurial > dropbear
comparison tcp-accept.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 | 58a74cb829b8 |
children | 1d86a58fb52d |
comparison
equal
deleted
inserted
replaced
1618:7bd7e95ad1f8 | 1620:572a7aefa188 |
---|---|
108 /* XXX debug? */ | 108 /* XXX debug? */ |
109 close(fd); | 109 close(fd); |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 int listen_tcpfwd(struct TCPListener* tcpinfo) { | 113 int listen_tcpfwd(struct TCPListener* tcpinfo, struct Listener **ret_listener) { |
114 | 114 |
115 char portstring[NI_MAXSERV]; | 115 char portstring[NI_MAXSERV]; |
116 int socks[DROPBEAR_MAX_SOCKS]; | 116 int socks[DROPBEAR_MAX_SOCKS]; |
117 struct Listener *listener = NULL; | |
118 int nsocks; | 117 int nsocks; |
118 struct Listener *listener; | |
119 char* errstring = NULL; | 119 char* errstring = NULL; |
120 | 120 |
121 TRACE(("enter listen_tcpfwd")) | 121 TRACE(("enter listen_tcpfwd")) |
122 | 122 |
123 /* first we try to bind, so don't need to do so much cleanup on failure */ | 123 /* first we try to bind, so don't need to do so much cleanup on failure */ |
140 if (listener == NULL) { | 140 if (listener == NULL) { |
141 TRACE(("leave listen_tcpfwd: listener failed")) | 141 TRACE(("leave listen_tcpfwd: listener failed")) |
142 return DROPBEAR_FAILURE; | 142 return DROPBEAR_FAILURE; |
143 } | 143 } |
144 | 144 |
145 if (ret_listener) { | |
146 *ret_listener = listener; | |
147 } | |
148 | |
145 TRACE(("leave listen_tcpfwd: success")) | 149 TRACE(("leave listen_tcpfwd: success")) |
146 return DROPBEAR_SUCCESS; | 150 return DROPBEAR_SUCCESS; |
147 } | 151 } |
148 | 152 |
149 #endif /* DROPBEAR_TCP_ACCEPT */ | 153 #endif /* DROPBEAR_TCP_ACCEPT */ |