4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
4807
4808
|
if (bufsize < OUR_V2_WINSIZE)
ssh2_set_window(c, OUR_V2_WINSIZE - bufsize);
}
} else if (pktin.type == SSH2_MSG_DISCONNECT) {
ssh_state = SSH_STATE_CLOSED;
logevent("Received disconnect message");
crReturnV;
} else if (pktin.type == SSH2_MSG_CHANNEL_REQUEST) {
continue; /* exit status et al; ignore (FIXME?) */
} else if (pktin.type == SSH2_MSG_CHANNEL_EOF) {
unsigned i = ssh2_pkt_getuint32();
struct ssh_channel *c;
c = find234(ssh_channels, &i, ssh_channelfind);
if (!c)
continue; /* nonexistent channel */
|
<
<
|
4793
4794
4795
4796
4797
4798
4799
4800
4801
4802
4803
4804
4805
4806
|
if (bufsize < OUR_V2_WINSIZE)
ssh2_set_window(c, OUR_V2_WINSIZE - bufsize);
}
} else if (pktin.type == SSH2_MSG_DISCONNECT) {
ssh_state = SSH_STATE_CLOSED;
logevent("Received disconnect message");
crReturnV;
} else if (pktin.type == SSH2_MSG_CHANNEL_EOF) {
unsigned i = ssh2_pkt_getuint32();
struct ssh_channel *c;
c = find234(ssh_channels, &i, ssh_channelfind);
if (!c)
continue; /* nonexistent channel */
|
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
|
logevent("Forwarded connection refused by server");
pfd_close(c->u.pfd.s);
del234(ssh_channels, c);
sfree(c);
} else if (pktin.type == SSH2_MSG_CHANNEL_OPEN) {
char *type;
int typelen;
char *error = NULL;
struct ssh_channel *c;
unsigned remid, winsize, pktsize;
ssh2_pkt_getstring(&type, &typelen);
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
4911
4912
4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
4928
4929
4930
4931
4932
4933
4934
4935
4936
4937
4938
4939
4940
4941
4942
4943
4944
4945
4946
4947
4948
4949
4950
4951
4952
4953
4954
4955
4956
4957
4958
4959
4960
4961
4962
4963
4964
|
logevent("Forwarded connection refused by server");
pfd_close(c->u.pfd.s);
del234(ssh_channels, c);
sfree(c);
} else if (pktin.type == SSH2_MSG_CHANNEL_REQUEST) {
unsigned localid;
char *type;
int typelen, want_reply;
struct ssh_channel *c;
localid = ssh2_pkt_getuint32();
ssh2_pkt_getstring(&type, &typelen);
want_reply = ssh2_pkt_getbool();
/*
* First, check that the channel exists. Otherwise,
* we can instantly disconnect with a rude message.
*/
c = find234(ssh_channels, &localid, ssh_channelfind);
if (!c) {
char buf[80];
sprintf(buf, "Received channel request for nonexistent"
" channel %d", localid);
logevent(buf);
ssh2_pkt_init(SSH2_MSG_DISCONNECT);
ssh2_pkt_adduint32(SSH2_DISCONNECT_BY_APPLICATION);
ssh2_pkt_addstring(buf);
ssh2_pkt_addstring("en"); /* language tag */
ssh2_pkt_send();
connection_fatal(buf);
ssh_state = SSH_STATE_CLOSED;
crReturnV;
}
/*
* We don't recognise any form of channel request,
* so we now either ignore the request or respond
* with CHANNEL_FAILURE, depending on want_reply.
*/
if (want_reply) {
ssh2_pkt_init(SSH2_MSG_CHANNEL_FAILURE);
ssh2_pkt_adduint32(c->remoteid);
ssh2_pkt_send();
}
} else if (pktin.type == SSH2_MSG_CHANNEL_OPEN) {
char *type;
int typelen;
char *error = NULL;
struct ssh_channel *c;
unsigned remid, winsize, pktsize;
ssh2_pkt_getstring(&type, &typelen);
|