/*
* Find the channel associated with a message. If there's no channel,
* or it's not properly open, make a noise about it and return NULL.
+ * If the channel is shared, pass the message on to downstream and
+ * also return NULL (meaning the caller should ignore this message).
*/
static struct ssh_channel *ssh_channel_msg(Ssh ssh, struct Packet *pktin)
{
sfree(buf);
return NULL;
}
+ if (c->type == CHAN_SHARING) {
+ share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
+ pktin->body, pktin->length);
+ return NULL;
+ }
return c;
}
struct outstanding_channel_request *ocr;
if (!c) return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
ocr = c->v.v2.chanreq_head;
if (!ocr) {
ssh2_msg_unexpected(ssh, pktin);
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
if (!(c->closes & CLOSES_SENT_EOF)) {
c->v.v2.remwindow += ssh_pkt_getuint32(pktin);
ssh2_try_send_and_unthrottle(ssh, c);
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
if (pktin->type == SSH2_MSG_CHANNEL_EXTENDED_DATA &&
ssh_pkt_getuint32(pktin) != SSH2_EXTENDED_DATA_STDERR)
return; /* extended but not stderr */
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
ssh2_channel_got_eof(c);
}
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
/*
* When we receive CLOSE on a channel, we assume it comes with an
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
assert(c->halfopen); /* ssh_channel_msg will have enforced this */
c->remoteid = ssh_pkt_getuint32(pktin);
c->halfopen = FALSE;
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
assert(c->halfopen); /* ssh_channel_msg will have enforced this */
if (c->type == CHAN_SOCKDATA_DORMANT) {
c = ssh_channel_msg(ssh, pktin);
if (!c)
return;
- if (c->type == CHAN_SHARING) {
- share_got_pkt_from_server(c->u.sharing.ctx, pktin->type,
- pktin->body, pktin->length);
- return;
- }
ssh_pkt_getstring(pktin, &type, &typelen);
want_reply = ssh2_pkt_getbool(pktin);