Bugzilla – Attachment 53 Details for
Bug 179
sshd sends channel data after sending EOF
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
another patch
U3 (text/plain), 3.39 KB, created by
Markus Friedl
on 2002-03-24 02:57:10 AEDT
(
hide
)
Description:
another patch
Filename:
MIME Type:
Creator:
Markus Friedl
Created:
2002-03-24 02:57:10 AEDT
Size:
3.39 KB
patch
obsolete
>Index: channels.c >=================================================================== >RCS file: /home/markus/cvs/ssh/channels.c,v >retrieving revision 1.171 >diff -w -b -u -r1.171 channels.c >--- channels.c 4 Mar 2002 19:37:58 -0000 1.171 >+++ channels.c 23 Mar 2002 10:01:54 -0000 >@@ -711,7 +711,8 @@ > } > /** XXX check close conditions, too */ > if (compat20 && c->efd != -1) { >- if (c->extended_usage == CHAN_EXTENDED_WRITE && >+ if (c->ostate != CHAN_OUTPUT_CLOSED && >+ c->extended_usage == CHAN_EXTENDED_WRITE && > buffer_len(&c->extended) > 0) > FD_SET(c->efd, writeset); > else if (c->extended_usage == CHAN_EXTENDED_READ && >@@ -1562,6 +1563,10 @@ > channel_handler(channel_post, readset, writeset); > } > >+#define CHANNEL_EFD_ALIVE(c) \ >+ (compat20 && c->extended_usage == CHAN_EXTENDED_READ && \ >+ (c->efd != -1 || buffer_len(&c->extended) > 0)) >+ > > /* If there is data to send to the connection, enqueue some of it now. */ > >@@ -1634,6 +1639,10 @@ > * input-buffer is empty and read-socket shutdown: > * tell peer, that we will not send more data: send IEOF > */ >+ if (CHANNEL_EFD_ALIVE(c)) >+ debug2("channel %d: ibuf_empty delayed efd %d/(%d)", >+ c->self, c->efd, buffer_len(&c->extended)); >+ else > chan_ibuf_empty(c); > } > /* Send extended data, i.e. stderr */ >@@ -1725,6 +1734,14 @@ > if (c->type != SSH_CHANNEL_OPEN) { > log("channel %d: ext data for non open", id); > return; >+ } >+ if (c->ostate == CHAN_OUTPUT_CLOSED) { >+ if (c->flags & CHAN_WRITE_FAILED) { >+ debug3("channel %d: ignoring ext data", c->self); >+ return; >+ } >+ packet_disconnect( >+ "Received extended_data after EOF on channel %d.", id); > } > tcode = packet_get_int(); > if (c->efd == -1 || >Index: channels.h >=================================================================== >RCS file: /home/markus/cvs/ssh/channels.h,v >retrieving revision 1.65 >diff -w -b -u -r1.65 channels.h >--- channels.h 4 Mar 2002 17:27:39 -0000 1.65 >+++ channels.h 23 Mar 2002 09:51:48 -0000 >@@ -135,6 +135,7 @@ > > #define CHAN_CLOSE_SENT 0x01 > #define CHAN_CLOSE_RCVD 0x02 >+#define CHAN_WRITE_FAILED 0x04 > > /* channel management */ > >Index: nchan.c >=================================================================== >RCS file: /home/markus/cvs/ssh/nchan.c,v >retrieving revision 1.44 >diff -w -b -u -r1.44 nchan.c >--- nchan.c 21 Jan 2002 23:27:10 -0000 1.44 >+++ nchan.c 23 Mar 2002 09:52:18 -0000 >@@ -312,6 +312,7 @@ > switch (c->ostate) { > case CHAN_OUTPUT_OPEN: > case CHAN_OUTPUT_WAIT_DRAIN: >+ c->flags |= CHAN_WRITE_FAILED; > chan_shutdown_write(c); > chan_set_ostate(c, CHAN_OUTPUT_CLOSED); > break; >@@ -404,22 +405,6 @@ > debug("channel %d: is dead", c->self); > return 1; > } >- /* >- * we have to delay the close message if the efd (for stderr) is >- * still active >- */ >- if (((c->extended_usage != CHAN_EXTENDED_IGNORE) && >- buffer_len(&c->extended) > 0) >-#if 0 >- || ((c->extended_usage == CHAN_EXTENDED_READ) && >- c->efd != -1) >-#endif >- ) { >- debug2("channel %d: active efd: %d len %d type %s", >- c->self, c->efd, buffer_len(&c->extended), >- c->extended_usage==CHAN_EXTENDED_READ ? >- "read": "write"); >- } else { > if (!(c->flags & CHAN_CLOSE_SENT)) { > if (send) { > chan_send_close2(c); >@@ -436,7 +421,6 @@ > (c->flags & CHAN_CLOSE_RCVD)) { > debug("channel %d: is dead", c->self); > return 1; >- } > } > return 0; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 179
:
52
| 53