version 1.187, 2003/03/05 22:33:43 |
version 1.188, 2003/04/08 20:21:28 |
|
|
Channel *c; |
Channel *c; |
|
|
if (id < 0 || id >= channels_alloc) { |
if (id < 0 || id >= channels_alloc) { |
log("channel_lookup: %d: bad id", id); |
logit("channel_lookup: %d: bad id", id); |
return NULL; |
return NULL; |
} |
} |
c = channels[id]; |
c = channels[id]; |
if (c == NULL) { |
if (c == NULL) { |
log("channel_lookup: %d: bad id: channel free", id); |
logit("channel_lookup: %d: bad id: channel free", id); |
return NULL; |
return NULL; |
} |
} |
return c; |
return c; |
|
|
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_send_open: %d: bad id", id); |
logit("channel_send_open: %d: bad id", id); |
return; |
return; |
} |
} |
debug2("channel %d: send open", id); |
debug2("channel %d: send open", id); |
|
|
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_request_start: %d: unknown channel id", id); |
logit("channel_request_start: %d: unknown channel id", id); |
return; |
return; |
} |
} |
debug("channel %d: request %s", id, service) ; |
debug("channel %d: request %s", id, service) ; |
|
|
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_register_comfirm: %d: bad id", id); |
logit("channel_register_comfirm: %d: bad id", id); |
return; |
return; |
} |
} |
c->confirm = fn; |
c->confirm = fn; |
|
|
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_register_cleanup: %d: bad id", id); |
logit("channel_register_cleanup: %d: bad id", id); |
return; |
return; |
} |
} |
c->detach_user = fn; |
c->detach_user = fn; |
|
|
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_cancel_cleanup: %d: bad id", id); |
logit("channel_cancel_cleanup: %d: bad id", id); |
return; |
return; |
} |
} |
c->detach_user = NULL; |
c->detach_user = NULL; |
|
|
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) { |
if (c == NULL) { |
log("channel_register_filter: %d: bad id", id); |
logit("channel_register_filter: %d: bad id", id); |
return; |
return; |
} |
} |
c->input_filter = fn; |
c->input_filter = fn; |
|
|
* We have received an X11 connection that has bad |
* We have received an X11 connection that has bad |
* authentication information. |
* authentication information. |
*/ |
*/ |
log("X11 connection rejected because of wrong authentication."); |
logit("X11 connection rejected because of wrong authentication."); |
buffer_clear(&c->input); |
buffer_clear(&c->input); |
buffer_clear(&c->output); |
buffer_clear(&c->output); |
channel_close_fd(&c->sock); |
channel_close_fd(&c->sock); |
|
|
c->type = SSH_CHANNEL_OPEN; |
c->type = SSH_CHANNEL_OPEN; |
channel_pre_open(c, readset, writeset); |
channel_pre_open(c, readset, writeset); |
} else if (ret == -1) { |
} else if (ret == -1) { |
log("X11 connection rejected because of wrong authentication."); |
logit("X11 connection rejected because of wrong authentication."); |
debug("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate); |
debug("X11 rejected %d i%d/o%d", c->self, c->istate, c->ostate); |
chan_read_failed(c); |
chan_read_failed(c); |
buffer_clear(&c->input); |
buffer_clear(&c->input); |
|
|
|
|
if (compat20) { |
if (compat20) { |
if (data_len > c->local_maxpacket) { |
if (data_len > c->local_maxpacket) { |
log("channel %d: rcvd big packet %d, maxpack %d", |
logit("channel %d: rcvd big packet %d, maxpack %d", |
c->self, data_len, c->local_maxpacket); |
c->self, data_len, c->local_maxpacket); |
} |
} |
if (data_len > c->local_window) { |
if (data_len > c->local_window) { |
log("channel %d: rcvd too much data %d, win %d", |
logit("channel %d: rcvd too much data %d, win %d", |
c->self, data_len, c->local_window); |
c->self, data_len, c->local_window); |
xfree(data); |
xfree(data); |
return; |
return; |
|
|
if (c == NULL) |
if (c == NULL) |
packet_disconnect("Received extended_data for bad channel %d.", id); |
packet_disconnect("Received extended_data for bad channel %d.", id); |
if (c->type != SSH_CHANNEL_OPEN) { |
if (c->type != SSH_CHANNEL_OPEN) { |
log("channel %d: ext data for non open", id); |
logit("channel %d: ext data for non open", id); |
return; |
return; |
} |
} |
if (c->flags & CHAN_EOF_RCVD) { |
if (c->flags & CHAN_EOF_RCVD) { |
|
|
if (c->efd == -1 || |
if (c->efd == -1 || |
c->extended_usage != CHAN_EXTENDED_WRITE || |
c->extended_usage != CHAN_EXTENDED_WRITE || |
tcode != SSH2_EXTENDED_DATA_STDERR) { |
tcode != SSH2_EXTENDED_DATA_STDERR) { |
log("channel %d: bad ext data", c->self); |
logit("channel %d: bad ext data", c->self); |
return; |
return; |
} |
} |
data = packet_get_string(&data_len); |
data = packet_get_string(&data_len); |
packet_check_eom(); |
packet_check_eom(); |
if (data_len > c->local_window) { |
if (data_len > c->local_window) { |
log("channel %d: rcvd too much extended_data %d, win %d", |
logit("channel %d: rcvd too much extended_data %d, win %d", |
c->self, data_len, c->local_window); |
c->self, data_len, c->local_window); |
xfree(data); |
xfree(data); |
return; |
return; |
|
|
msg = packet_get_string(NULL); |
msg = packet_get_string(NULL); |
lang = packet_get_string(NULL); |
lang = packet_get_string(NULL); |
} |
} |
log("channel %d: open failed: %s%s%s", id, |
logit("channel %d: open failed: %s%s%s", id, |
reason2txt(reason), msg ? ": ": "", msg ? msg : ""); |
reason2txt(reason), msg ? ": ": "", msg ? msg : ""); |
if (msg != NULL) |
if (msg != NULL) |
xfree(msg); |
xfree(msg); |
|
|
c = channel_lookup(id); |
c = channel_lookup(id); |
|
|
if (c == NULL || c->type != SSH_CHANNEL_OPEN) { |
if (c == NULL || c->type != SSH_CHANNEL_OPEN) { |
log("Received window adjust for " |
logit("Received window adjust for " |
"non-open channel %d.", id); |
"non-open channel %d.", id); |
return; |
return; |
} |
} |
|
|
success = 1; |
success = 1; |
break; |
break; |
case SSH_SMSG_FAILURE: |
case SSH_SMSG_FAILURE: |
log("Warning: Server denied remote port forwarding."); |
logit("Warning: Server denied remote port forwarding."); |
break; |
break; |
default: |
default: |
/* Unknown packet */ |
/* Unknown packet */ |
|
|
|
|
} |
} |
if (!permit) { |
if (!permit) { |
log("Received request to connect to host %.100s port %d, " |
logit("Received request to connect to host %.100s port %d, " |
"but the request was denied.", host, port); |
"but the request was denied.", host, port); |
return -1; |
return -1; |
} |
} |