diff options
Diffstat (limited to 'nchan.c')
-rw-r--r-- | nchan.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: nchan.c,v 1.66 2017/09/12 06:32:07 djm Exp $ */ | 1 | /* $OpenBSD: nchan.c,v 1.67 2017/09/12 06:35:32 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -183,6 +183,9 @@ chan_send_eof2(struct ssh *ssh, Channel *c) | |||
183 | debug2("channel %d: send eof", c->self); | 183 | debug2("channel %d: send eof", c->self); |
184 | switch (c->istate) { | 184 | switch (c->istate) { |
185 | case CHAN_INPUT_WAIT_DRAIN: | 185 | case CHAN_INPUT_WAIT_DRAIN: |
186 | if (!c->have_remote_id) | ||
187 | fatal("%s: channel %d: no remote_id", | ||
188 | __func__, c->self); | ||
186 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_EOF)) != 0 || | 189 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_EOF)) != 0 || |
187 | (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || | 190 | (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || |
188 | (r = sshpkt_send(ssh)) != 0) | 191 | (r = sshpkt_send(ssh)) != 0) |
@@ -209,6 +212,9 @@ chan_send_close2(struct ssh *ssh, Channel *c) | |||
209 | } else if (c->flags & CHAN_CLOSE_SENT) { | 212 | } else if (c->flags & CHAN_CLOSE_SENT) { |
210 | error("channel %d: already sent close", c->self); | 213 | error("channel %d: already sent close", c->self); |
211 | } else { | 214 | } else { |
215 | if (!c->have_remote_id) | ||
216 | fatal("%s: channel %d: no remote_id", | ||
217 | __func__, c->self); | ||
212 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_CLOSE)) != 0 || | 218 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_CLOSE)) != 0 || |
213 | (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || | 219 | (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || |
214 | (r = sshpkt_send(ssh)) != 0) | 220 | (r = sshpkt_send(ssh)) != 0) |
@@ -230,6 +236,8 @@ chan_send_eow2(struct ssh *ssh, Channel *c) | |||
230 | } | 236 | } |
231 | if (!(datafellows & SSH_NEW_OPENSSH)) | 237 | if (!(datafellows & SSH_NEW_OPENSSH)) |
232 | return; | 238 | return; |
239 | if (!c->have_remote_id) | ||
240 | fatal("%s: channel %d: no remote_id", __func__, c->self); | ||
233 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_REQUEST)) != 0 || | 241 | if ((r = sshpkt_start(ssh, SSH2_MSG_CHANNEL_REQUEST)) != 0 || |
234 | (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || | 242 | (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || |
235 | (r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0 || | 243 | (r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0 || |