version 1.362, 2017/05/30 08:49:58 |
version 1.363, 2017/05/30 14:23:52 |
|
|
* replaces local (proxy) channel ID with downstream channel ID. |
* replaces local (proxy) channel ID with downstream channel ID. |
*/ |
*/ |
int |
int |
channel_proxy_upstream(Channel *c, int type, u_int32_t seq, void *ctxt) |
channel_proxy_upstream(Channel *c, int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
struct ssh *ssh = active_state; |
|
struct sshbuf *b = NULL; |
struct sshbuf *b = NULL; |
Channel *downstream; |
Channel *downstream; |
const u_char *cp = NULL; |
const u_char *cp = NULL; |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_data(int type, u_int32_t seq, void *ctxt) |
channel_input_data(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
int id; |
int id; |
const u_char *data; |
const u_char *data; |
|
|
c = channel_lookup(id); |
c = channel_lookup(id); |
if (c == NULL) |
if (c == NULL) |
packet_disconnect("Received data for nonexistent channel %d.", id); |
packet_disconnect("Received data for nonexistent channel %d.", id); |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
|
|
/* Ignore any data for non-open channels (might happen on close) */ |
/* Ignore any data for non-open channels (might happen on close) */ |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_extended_data(int type, u_int32_t seq, void *ctxt) |
channel_input_extended_data(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
int id; |
int id; |
char *data; |
char *data; |
|
|
|
|
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 (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
if (c->type != SSH_CHANNEL_OPEN) { |
if (c->type != SSH_CHANNEL_OPEN) { |
logit("channel %d: ext data for non open", id); |
logit("channel %d: ext data for non open", id); |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_ieof(int type, u_int32_t seq, void *ctxt) |
channel_input_ieof(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
int id; |
int id; |
Channel *c; |
Channel *c; |
|
|
c = channel_lookup(id); |
c = channel_lookup(id); |
if (c == NULL) |
if (c == NULL) |
packet_disconnect("Received ieof for nonexistent channel %d.", id); |
packet_disconnect("Received ieof for nonexistent channel %d.", id); |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
chan_rcvd_ieof(c); |
chan_rcvd_ieof(c); |
|
|
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_oclose(int type, u_int32_t seq, void *ctxt) |
channel_input_oclose(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
int id = packet_get_int(); |
int id = packet_get_int(); |
Channel *c = channel_lookup(id); |
Channel *c = channel_lookup(id); |
|
|
if (c == NULL) |
if (c == NULL) |
packet_disconnect("Received oclose for nonexistent channel %d.", id); |
packet_disconnect("Received oclose for nonexistent channel %d.", id); |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
packet_check_eom(); |
packet_check_eom(); |
chan_rcvd_oclose(c); |
chan_rcvd_oclose(c); |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) |
channel_input_open_confirmation(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
int id, remote_id; |
int id, remote_id; |
Channel *c; |
Channel *c; |
|
|
if (c==NULL) |
if (c==NULL) |
packet_disconnect("Received open confirmation for " |
packet_disconnect("Received open confirmation for " |
"unknown channel %d.", id); |
"unknown channel %d.", id); |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
if (c->type != SSH_CHANNEL_OPENING) |
if (c->type != SSH_CHANNEL_OPENING) |
packet_disconnect("Received open confirmation for " |
packet_disconnect("Received open confirmation for " |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_open_failure(int type, u_int32_t seq, void *ctxt) |
channel_input_open_failure(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
int id, reason; |
int id, reason; |
char *msg = NULL, *lang = NULL; |
char *msg = NULL, *lang = NULL; |
|
|
if (c==NULL) |
if (c==NULL) |
packet_disconnect("Received open failure for " |
packet_disconnect("Received open failure for " |
"unknown channel %d.", id); |
"unknown channel %d.", id); |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
if (c->type != SSH_CHANNEL_OPENING) |
if (c->type != SSH_CHANNEL_OPENING) |
packet_disconnect("Received open failure for " |
packet_disconnect("Received open failure for " |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) |
channel_input_window_adjust(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
Channel *c; |
Channel *c; |
int id; |
int id; |
|
|
logit("Received window adjust for non-open channel %d.", id); |
logit("Received window adjust for non-open channel %d.", id); |
return 0; |
return 0; |
} |
} |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
adjust = packet_get_int(); |
adjust = packet_get_int(); |
packet_check_eom(); |
packet_check_eom(); |
|
|
|
|
/* ARGSUSED */ |
/* ARGSUSED */ |
int |
int |
channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) |
channel_input_status_confirm(int type, u_int32_t seq, struct ssh *ssh) |
{ |
{ |
Channel *c; |
Channel *c; |
struct channel_confirm *cc; |
struct channel_confirm *cc; |
|
|
logit("channel_input_status_confirm: %d: unknown", id); |
logit("channel_input_status_confirm: %d: unknown", id); |
return 0; |
return 0; |
} |
} |
if (channel_proxy_upstream(c, type, seq, ctxt)) |
if (channel_proxy_upstream(c, type, seq, ssh)) |
return 0; |
return 0; |
packet_check_eom(); |
packet_check_eom(); |
if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) |
if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) |