comparison svr-tcpfwd.c @ 70:b0316ce64e4b

Merging in the changes from 0.41-0.43 main Dropbear tree
author Matt Johnston <matt@ucc.asn.au>
date Thu, 12 Aug 2004 16:41:58 +0000
parents efb5e0b335cf
children e3adf4cf5465
comparison
equal deleted inserted replaced
69:59d16db56e9f 70:b0316ce64e4b
206 unsigned char* orighost = NULL; 206 unsigned char* orighost = NULL;
207 unsigned int origport; 207 unsigned int origport;
208 char portstring[NI_MAXSERV]; 208 char portstring[NI_MAXSERV];
209 int sock; 209 int sock;
210 int len; 210 int len;
211 int ret = DROPBEAR_FAILURE; 211 int err = SSH_OPEN_ADMINISTRATIVELY_PROHIBITED;
212 212
213 if (opts.nolocaltcp) { 213 if (opts.nolocaltcp) {
214 TRACE(("leave newtcpdirect: local tcp forwarding disabled")); 214 TRACE(("leave newtcpdirect: local tcp forwarding disabled"));
215 goto out; 215 goto out;
216 } 216 }
238 } 238 }
239 239
240 snprintf(portstring, sizeof(portstring), "%d", destport); 240 snprintf(portstring, sizeof(portstring), "%d", destport);
241 sock = connect_remote(desthost, portstring, 1, NULL); 241 sock = connect_remote(desthost, portstring, 1, NULL);
242 if (sock < 0) { 242 if (sock < 0) {
243 err = SSH_OPEN_CONNECT_FAILED;
243 TRACE(("leave newtcpdirect: sock failed")); 244 TRACE(("leave newtcpdirect: sock failed"));
244 goto out; 245 goto out;
245 } 246 }
246 247
247 ses.maxfd = MAX(ses.maxfd, sock); 248 ses.maxfd = MAX(ses.maxfd, sock);
251 * We don't set outfd, that will get set after the connection's 252 * We don't set outfd, that will get set after the connection's
252 * progress succeeds */ 253 * progress succeeds */
253 channel->infd = sock; 254 channel->infd = sock;
254 channel->initconn = 1; 255 channel->initconn = 1;
255 256
256 ret = DROPBEAR_SUCCESS; 257 err = SSH_OPEN_IN_PROGRESS;
257 258
258 out: 259 out:
259 m_free(desthost); 260 m_free(desthost);
260 m_free(orighost); 261 m_free(orighost);
261 TRACE(("leave newtcpdirect: ret %d", ret)); 262 TRACE(("leave newtcpdirect: err %d", err));
262 return ret; 263 return err;
263 } 264 }
264 265
265 #endif 266 #endif