version 1.1, 2001/05/30 12:55:08 |
version 1.2, 2001/05/30 16:22:46 |
|
|
int gateway_ports, int remote_fwd) |
int gateway_ports, int remote_fwd) |
{ |
{ |
Channel *c; |
Channel *c; |
int success, sock, on = 1, ctype; |
int success, sock, on = 1, type; |
struct addrinfo hints, *ai, *aitop; |
struct addrinfo hints, *ai, *aitop; |
char ntop[NI_MAXHOST], strport[NI_MAXSERV]; |
char ntop[NI_MAXHOST], strport[NI_MAXSERV]; |
const char *host; |
const char *host; |
|
|
|
|
if (remote_fwd) { |
if (remote_fwd) { |
host = listen_address; |
host = listen_address; |
ctype = SSH_CHANNEL_RPORT_LISTENER; |
type = SSH_CHANNEL_RPORT_LISTENER; |
} else { |
} else { |
host = host_to_connect; |
host = host_to_connect; |
ctype =SSH_CHANNEL_PORT_LISTENER; |
type = SSH_CHANNEL_PORT_LISTENER; |
} |
} |
|
|
if (strlen(host) > SSH_CHANNEL_PATH_LEN - 1) { |
if (strlen(host) > SSH_CHANNEL_PATH_LEN - 1) { |
|
|
continue; |
continue; |
} |
} |
/* Allocate a channel number for the socket. */ |
/* Allocate a channel number for the socket. */ |
c = channel_new("port listener", ctype, sock, sock, -1, |
c = channel_new("port listener", type, sock, sock, -1, |
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
CHAN_TCP_WINDOW_DEFAULT, CHAN_TCP_PACKET_DEFAULT, |
0, xstrdup("port listener"), 1); |
0, xstrdup("port listener"), 1); |
if (c == NULL) { |
if (c == NULL) { |