version 1.183, 2002/09/17 07:47:02 |
version 1.183.2.1, 2003/04/01 00:12:13 |
|
|
#if 0 |
#if 0 |
if (!compat20 && |
if (!compat20 && |
buffer_len(&c->input) > packet_get_maxsize()) { |
buffer_len(&c->input) > packet_get_maxsize()) { |
debug("channel %d: big input buffer %d", |
debug2("channel %d: big input buffer %d", |
c->self, buffer_len(&c->input)); |
c->self, buffer_len(&c->input)); |
return 0; |
return 0; |
} |
} |
#endif |
#endif |
if (buffer_len(&c->output) > packet_get_maxsize()) { |
if (buffer_len(&c->output) > packet_get_maxsize()) { |
debug("channel %d: big output buffer %d > %d", |
debug2("channel %d: big output buffer %d > %d", |
c->self, buffer_len(&c->output), |
c->self, buffer_len(&c->output), |
packet_get_maxsize()); |
packet_get_maxsize()); |
return 0; |
return 0; |
|
|
log("channel_send_open: %d: bad id", id); |
log("channel_send_open: %d: bad id", id); |
return; |
return; |
} |
} |
debug("send channel open %d", id); |
debug2("channel %d: send open", id); |
packet_start(SSH2_MSG_CHANNEL_OPEN); |
packet_start(SSH2_MSG_CHANNEL_OPEN); |
packet_put_cstring(c->ctype); |
packet_put_cstring(c->ctype); |
packet_put_int(c->self); |
packet_put_int(c->self); |
|
|
} |
} |
|
|
void |
void |
channel_request_start(int local_id, char *service, int wantconfirm) |
channel_request_start(int id, char *service, int wantconfirm) |
{ |
{ |
Channel *c = channel_lookup(local_id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_request_start: %d: unknown channel id", local_id); |
log("channel_request_start: %d: unknown channel id", id); |
return; |
return; |
} |
} |
debug("channel request %d: %s", local_id, service) ; |
debug("channel %d: request %s", id, service) ; |
packet_start(SSH2_MSG_CHANNEL_REQUEST); |
packet_start(SSH2_MSG_CHANNEL_REQUEST); |
packet_put_int(c->remote_id); |
packet_put_int(c->remote_id); |
packet_put_cstring(service); |
packet_put_cstring(service); |
|
|
c->remote_id = remote_id; |
c->remote_id = remote_id; |
} |
} |
if (c == NULL) { |
if (c == NULL) { |
|
xfree(originator_string); |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_put_int(remote_id); |
packet_put_int(remote_id); |
packet_send(); |
packet_send(); |
|
|
} |
} |
sock = socket(ai->ai_family, SOCK_STREAM, 0); |
sock = socket(ai->ai_family, SOCK_STREAM, 0); |
if (sock < 0) { |
if (sock < 0) { |
error("socket: %.100s", strerror(errno)); |
if (ai->ai_next == NULL) |
|
error("socket: %.100s", strerror(errno)); |
|
else |
|
verbose("socket: %.100s", strerror(errno)); |
continue; |
continue; |
} |
} |
if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) |
if (fcntl(sock, F_SETFL, O_NONBLOCK) < 0) |
|
|
/* Send refusal to the remote host. */ |
/* Send refusal to the remote host. */ |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
packet_put_int(remote_id); |
packet_put_int(remote_id); |
|
xfree(remote_host); |
} else { |
} else { |
/* Send a confirmation to the remote host. */ |
/* Send a confirmation to the remote host. */ |
packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); |
packet_start(SSH_MSG_CHANNEL_OPEN_CONFIRMATION); |