comparison cli-tcpfwd.c @ 1829:a7cc3332d8ab

Replace ChanType.sepfds with Channel.bidir_fd This handles the case where a svrchansess has separate FDs for nopty, but a single FD for pty mode. The use of sepfds was also previously incorrect for X11 and agent forwarding
author Matt Johnston <matt@ucc.asn.au>
date Mon, 11 Oct 2021 15:42:14 +0800
parents 9026f976eee8
children 1d86a58fb52d
comparison
equal deleted inserted replaced
1828:3f0ac6bc58a1 1829:a7cc3332d8ab
33 33
34 #if DROPBEAR_CLI_REMOTETCPFWD 34 #if DROPBEAR_CLI_REMOTETCPFWD
35 static int newtcpforwarded(struct Channel * channel); 35 static int newtcpforwarded(struct Channel * channel);
36 36
37 const struct ChanType cli_chan_tcpremote = { 37 const struct ChanType cli_chan_tcpremote = {
38 1, /* sepfds */
39 "forwarded-tcpip", 38 "forwarded-tcpip",
40 newtcpforwarded, 39 newtcpforwarded,
41 NULL, 40 NULL,
42 NULL, 41 NULL,
43 NULL, 42 NULL,
49 static int cli_localtcp(const char* listenaddr, 48 static int cli_localtcp(const char* listenaddr,
50 unsigned int listenport, 49 unsigned int listenport,
51 const char* remoteaddr, 50 const char* remoteaddr,
52 unsigned int remoteport); 51 unsigned int remoteport);
53 static const struct ChanType cli_chan_tcplocal = { 52 static const struct ChanType cli_chan_tcplocal = {
54 1, /* sepfds */
55 "direct-tcpip", 53 "direct-tcpip",
56 tcp_prio_inithandler, 54 tcp_prio_inithandler,
57 NULL, 55 NULL,
58 NULL, 56 NULL,
59 NULL, 57 NULL,
273 origaddr, origport); 271 origaddr, origport);
274 goto out; 272 goto out;
275 } 273 }
276 274
277 channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE; 275 channel->prio = DROPBEAR_CHANNEL_PRIO_UNKNOWABLE;
278 276
279 snprintf(portstring, sizeof(portstring), "%u", fwd->connectport); 277 snprintf(portstring, sizeof(portstring), "%u", fwd->connectport);
280 channel->conn_pending = connect_remote(fwd->connectaddr, portstring, channel_connect_done, channel, NULL, NULL); 278 channel->conn_pending = connect_remote(fwd->connectaddr, portstring, channel_connect_done, channel, NULL, NULL);
281 279
282 err = SSH_OPEN_IN_PROGRESS; 280 err = SSH_OPEN_IN_PROGRESS;
283 281
284 out: 282 out:
285 m_free(origaddr); 283 m_free(origaddr);
286 TRACE(("leave newtcpdirect: err %d", err)) 284 TRACE(("leave newtcpdirect: err %d", err))