version 1.210.2.1, 2005/03/10 16:28:27 |
version 1.210.2.2, 2005/06/05 02:22:39 |
|
|
|
|
/* -- channel core */ |
/* -- channel core */ |
|
|
|
#define CHAN_RBUF 16*1024 |
|
|
/* |
/* |
* Pointer to an array containing all allocated channels. The array is |
* Pointer to an array containing all allocated channels. The array is |
* dynamically extended as needed. |
* dynamically extended as needed. |
|
|
{ |
{ |
u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); |
u_int limit = compat20 ? c->remote_window : packet_get_maxsize(); |
|
|
|
/* check buffer limits */ |
|
limit = MIN(limit, (BUFFER_MAX_LEN - BUFFER_MAX_CHUNK - CHAN_RBUF)); |
|
|
if (c->istate == CHAN_INPUT_OPEN && |
if (c->istate == CHAN_INPUT_OPEN && |
limit > 0 && |
limit > 0 && |
buffer_len(&c->input) < limit) |
buffer_len(&c->input) < limit) |
|
|
debug2("channel %d: only socks5 connect supported", c->self); |
debug2("channel %d: only socks5 connect supported", c->self); |
return -1; |
return -1; |
} |
} |
switch(s5_req.atyp){ |
switch (s5_req.atyp){ |
case SSH_SOCKS5_IPV4: |
case SSH_SOCKS5_IPV4: |
addrlen = 4; |
addrlen = 4; |
af = AF_INET; |
af = AF_INET; |
|
|
static int |
static int |
channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) |
channel_handle_rfd(Channel *c, fd_set * readset, fd_set * writeset) |
{ |
{ |
char buf[16*1024]; |
char buf[CHAN_RBUF]; |
int len; |
int len; |
|
|
if (c->rfd != -1 && |
if (c->rfd != -1 && |
|
|
static int |
static int |
channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) |
channel_handle_efd(Channel *c, fd_set * readset, fd_set * writeset) |
{ |
{ |
char buf[16*1024]; |
char buf[CHAN_RBUF]; |
int len; |
int len; |
|
|
/** XXX handle drain efd, too */ |
/** XXX handle drain efd, too */ |
|
|
|
|
/* |
/* |
* Determine whether or not a port forward listens to loopback, |
* Determine whether or not a port forward listens to loopback, |
* specified address or wildcard. On the client, a specified bind |
* specified address or wildcard. On the client, a specified bind |
* address will always override gateway_ports. On the server, a |
* address will always override gateway_ports. On the server, a |
* gateway_ports of 1 (``yes'') will override the client's |
* gateway_ports of 1 (``yes'') will override the client's |
* specification and force a wildcard bind, whereas a value of 2 |
* specification and force a wildcard bind, whereas a value of 2 |
* (``clientspecified'') will bind to whatever address the client |
* (``clientspecified'') will bind to whatever address the client |
* asked for. |
* asked for. |
* |
* |
* Special-case listen_addrs are: |
* Special-case listen_addrs are: |
|
|
u_int i; |
u_int i; |
int found = 0; |
int found = 0; |
|
|
for(i = 0; i < channels_alloc; i++) { |
for (i = 0; i < channels_alloc; i++) { |
Channel *c = channels[i]; |
Channel *c = channels[i]; |
|
|
if (c != NULL && c->type == SSH_CHANNEL_RPORT_LISTENER && |
if (c != NULL && c->type == SSH_CHANNEL_RPORT_LISTENER && |
|
|
struct winsize ws; |
struct winsize ws; |
|
|
for (i = 0; i < channels_alloc; i++) { |
for (i = 0; i < channels_alloc; i++) { |
if (channels[i] == NULL || !channels[i]->client_tty || |
if (channels[i] == NULL || !channels[i]->client_tty || |
channels[i]->type != SSH_CHANNEL_OPEN) |
channels[i]->type != SSH_CHANNEL_OPEN) |
continue; |
continue; |
if (ioctl(channels[i]->rfd, TIOCGWINSZ, &ws) < 0) |
if (ioctl(channels[i]->rfd, TIOCGWINSZ, &ws) < 0) |