diff options
author | djm@openbsd.org <djm@openbsd.org> | 2017-09-12 06:35:31 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-09-12 17:37:03 +1000 |
commit | 9f53229c2ac97dbc6f5a03657de08a1150a9ac7e (patch) | |
tree | 4f74dc06676dc6dce2b2bc3aa6beb248a1d8def6 /serverloop.c | |
parent | dbee4119b502e3f8b6cd3282c69c537fd01d8e16 (diff) |
upstream commit
Make remote channel ID a u_int
Previously we tracked the remote channel IDs in an int, but this is
strictly incorrect: the wire protocol uses uint32 and there is nothing
in-principle stopping a SSH implementation from sending, say, 0xffff0000.
In practice everyone numbers their channels sequentially, so this has
never been a problem.
ok markus@
Upstream-ID: b9f4cd3dc53155b4a5c995c0adba7da760d03e73
Diffstat (limited to 'serverloop.c')
-rw-r--r-- | serverloop.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/serverloop.c b/serverloop.c index 567159410..ae75fc2ec 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.197 2017/09/12 06:32:07 djm Exp $ */ | 1 | /* $OpenBSD: serverloop.c,v 1.198 2017/09/12 06:35:32 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -619,6 +619,7 @@ server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh) | |||
619 | if (c != NULL) { | 619 | if (c != NULL) { |
620 | debug("server_input_channel_open: confirm %s", ctype); | 620 | debug("server_input_channel_open: confirm %s", ctype); |
621 | c->remote_id = rchan; | 621 | c->remote_id = rchan; |
622 | c->have_remote_id = 1; | ||
622 | c->remote_window = rwindow; | 623 | c->remote_window = rwindow; |
623 | c->remote_maxpacket = rmaxpack; | 624 | c->remote_maxpacket = rmaxpack; |
624 | if (c->type != SSH_CHANNEL_CONNECTING) { | 625 | if (c->type != SSH_CHANNEL_CONNECTING) { |
@@ -844,6 +845,9 @@ server_input_channel_req(int type, u_int32_t seq, struct ssh *ssh) | |||
844 | c->type == SSH_CHANNEL_OPEN) && strcmp(c->ctype, "session") == 0) | 845 | c->type == SSH_CHANNEL_OPEN) && strcmp(c->ctype, "session") == 0) |
845 | success = session_input_channel_req(ssh, c, rtype); | 846 | success = session_input_channel_req(ssh, c, rtype); |
846 | if (reply && !(c->flags & CHAN_CLOSE_SENT)) { | 847 | if (reply && !(c->flags & CHAN_CLOSE_SENT)) { |
848 | if (!c->have_remote_id) | ||
849 | fatal("%s: channel %d: no remote_id", | ||
850 | __func__, c->self); | ||
847 | packet_start(success ? | 851 | packet_start(success ? |
848 | SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE); | 852 | SSH2_MSG_CHANNEL_SUCCESS : SSH2_MSG_CHANNEL_FAILURE); |
849 | packet_put_int(c->remote_id); | 853 | packet_put_int(c->remote_id); |