summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh/common
diff options
context:
space:
mode:
authorAdam Stevko <adam.stevko@gmail.com>2014-06-22 02:26:52 +0200
committerRichard Lowe <richlowe@richlowe.net>2014-11-28 20:55:32 -0500
commit371387fa64d65a99a72f1ff81d0efd2220534d0b (patch)
tree27b902dad4deb197b870d6fa6e868605f6fe5a22 /usr/src/cmd/ssh/libssh/common
parentb808966a943db6fb9a110438cce8184c87e1f62b (diff)
downloadillumos-joyent-371387fa64d65a99a72f1ff81d0efd2220534d0b.tar.gz
4937 SunSSH should support EOW extension
Reviewed by: Dan McDonald <danmcd@omniti.com> Reviewed by: Robert Mustacchi <rm@joyent.com> Approved by: Richard Lowe <richlowe@richlowe.net>
Diffstat (limited to 'usr/src/cmd/ssh/libssh/common')
-rw-r--r--usr/src/cmd/ssh/libssh/common/nchan.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/usr/src/cmd/ssh/libssh/common/nchan.c b/usr/src/cmd/ssh/libssh/common/nchan.c
index 97c51fcda8..82a371af5b 100644
--- a/usr/src/cmd/ssh/libssh/common/nchan.c
+++ b/usr/src/cmd/ssh/libssh/common/nchan.c
@@ -25,8 +25,6 @@
#include "includes.h"
RCSID("$OpenBSD: nchan.c,v 1.47 2002/06/19 00:27:55 deraadt Exp $");
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include "ssh1.h"
#include "ssh2.h"
#include "buffer.h"
@@ -72,6 +70,7 @@ static void chan_send_ieof1(Channel *);
static void chan_send_oclose1(Channel *);
static void chan_send_close2(Channel *);
static void chan_send_eof2(Channel *);
+static void chan_send_eow2(Channel *);
/* helper */
static void chan_shutdown_write(Channel *);
@@ -300,6 +299,17 @@ chan_rcvd_close2(Channel *c)
break;
}
}
+void
+chan_rcvd_eow(Channel *c)
+{
+ debug2("channel %d: rcvd eow", c->self);
+ switch (c->istate) {
+ case CHAN_INPUT_OPEN:
+ chan_shutdown_read(c);
+ chan_set_istate(c, CHAN_INPUT_CLOSED);
+ break;
+ }
+}
static void
chan_rcvd_eof2(Channel *c)
{
@@ -316,6 +326,8 @@ chan_write_failed2(Channel *c)
case CHAN_OUTPUT_OPEN:
case CHAN_OUTPUT_WAIT_DRAIN:
chan_shutdown_write(c);
+ if (strcmp(c->ctype, "session") == 0)
+ chan_send_eow2(c);
chan_set_ostate(c, CHAN_OUTPUT_CLOSED);
break;
default:
@@ -358,6 +370,21 @@ chan_send_close2(Channel *c)
c->flags |= CHAN_CLOSE_SENT;
}
}
+static void
+chan_send_eow2(Channel *c)
+{
+ debug2("channel %d: send eow", c->self);
+ if (c->ostate == CHAN_OUTPUT_CLOSED) {
+ error("channel %d: must not sent eow on closed output",
+ c->self);
+ return;
+ }
+ packet_start(SSH2_MSG_CHANNEL_REQUEST);
+ packet_put_int(c->remote_id);
+ packet_put_cstring("eow@openssh.com");
+ packet_put_char(0);
+ packet_send();
+}
/* shared */