diff options
Diffstat (limited to 'nchan.c')
-rw-r--r-- | nchan.c | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: nchan.c,v 1.58 2008/05/08 12:02:23 djm Exp $ */ | 1 | /* $OpenBSD: nchan.c,v 1.59 2008/05/09 16:21:13 markus 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 | * |
@@ -78,6 +78,7 @@ static void chan_send_ieof1(Channel *); | |||
78 | static void chan_send_oclose1(Channel *); | 78 | static void chan_send_oclose1(Channel *); |
79 | static void chan_send_close2(Channel *); | 79 | static void chan_send_close2(Channel *); |
80 | static void chan_send_eof2(Channel *); | 80 | static void chan_send_eof2(Channel *); |
81 | static void chan_send_eow2(Channel *); | ||
81 | 82 | ||
82 | /* helper */ | 83 | /* helper */ |
83 | static void chan_shutdown_write(Channel *); | 84 | static void chan_shutdown_write(Channel *); |
@@ -306,6 +307,17 @@ chan_rcvd_close2(Channel *c) | |||
306 | break; | 307 | break; |
307 | } | 308 | } |
308 | } | 309 | } |
310 | void | ||
311 | chan_rcvd_eow(Channel *c) | ||
312 | { | ||
313 | debug2("channel %d: rcvd eow", c->self); | ||
314 | switch (c->istate) { | ||
315 | case CHAN_INPUT_OPEN: | ||
316 | chan_shutdown_read(c); | ||
317 | chan_set_istate(c, CHAN_INPUT_CLOSED); | ||
318 | break; | ||
319 | } | ||
320 | } | ||
309 | static void | 321 | static void |
310 | chan_rcvd_eof2(Channel *c) | 322 | chan_rcvd_eof2(Channel *c) |
311 | { | 323 | { |
@@ -322,6 +334,7 @@ chan_write_failed2(Channel *c) | |||
322 | case CHAN_OUTPUT_OPEN: | 334 | case CHAN_OUTPUT_OPEN: |
323 | case CHAN_OUTPUT_WAIT_DRAIN: | 335 | case CHAN_OUTPUT_WAIT_DRAIN: |
324 | chan_shutdown_write(c); | 336 | chan_shutdown_write(c); |
337 | chan_send_eow2(c); | ||
325 | chan_set_ostate(c, CHAN_OUTPUT_CLOSED); | 338 | chan_set_ostate(c, CHAN_OUTPUT_CLOSED); |
326 | break; | 339 | break; |
327 | default: | 340 | default: |
@@ -364,6 +377,21 @@ chan_send_close2(Channel *c) | |||
364 | c->flags |= CHAN_CLOSE_SENT; | 377 | c->flags |= CHAN_CLOSE_SENT; |
365 | } | 378 | } |
366 | } | 379 | } |
380 | static void | ||
381 | chan_send_eow2(Channel *c) | ||
382 | { | ||
383 | debug2("channel %d: send eow", c->self); | ||
384 | if (c->ostate == CHAN_OUTPUT_CLOSED) { | ||
385 | error("channel %d: must not sent eow on closed output", | ||
386 | c->self); | ||
387 | return; | ||
388 | } | ||
389 | packet_start(SSH2_MSG_CHANNEL_REQUEST); | ||
390 | packet_put_int(c->remote_id); | ||
391 | packet_put_cstring("eow@openssh.com"); | ||
392 | packet_put_char(0); | ||
393 | packet_send(); | ||
394 | } | ||
367 | 395 | ||
368 | /* shared */ | 396 | /* shared */ |
369 | 397 | ||