diff options
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/channels.c b/channels.c index a079fc24d..b7286940b 100644 --- a/channels.c +++ b/channels.c | |||
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: channels.c,v 1.90 2001/02/08 21:58:28 markus Exp $"); | 43 | RCSID("$OpenBSD: channels.c,v 1.91 2001/02/15 23:19:59 markus Exp $"); |
44 | 44 | ||
45 | #include <openssl/rsa.h> | 45 | #include <openssl/rsa.h> |
46 | #include <openssl/dsa.h> | 46 | #include <openssl/dsa.h> |
@@ -193,6 +193,18 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd, | |||
193 | c->efd = efd; | 193 | c->efd = efd; |
194 | c->extended_usage = extusage; | 194 | c->extended_usage = extusage; |
195 | 195 | ||
196 | /* XXX ugly hack: nonblock is only set by the server */ | ||
197 | if (nonblock && isatty(c->rfd)) { | ||
198 | debug("channel: %d: rfd %d isatty", c->self, c->rfd); | ||
199 | c->isatty = 1; | ||
200 | if (!isatty(c->wfd)) { | ||
201 | error("channel: %d: wfd %d is not a tty?", | ||
202 | c->self, c->wfd); | ||
203 | } | ||
204 | } else { | ||
205 | c->isatty = 0; | ||
206 | } | ||
207 | |||
196 | /* enable nonblocking mode */ | 208 | /* enable nonblocking mode */ |
197 | if (nonblock) { | 209 | if (nonblock) { |
198 | if (rfd != -1) | 210 | if (rfd != -1) |
@@ -776,6 +788,21 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) | |||
776 | } | 788 | } |
777 | return -1; | 789 | return -1; |
778 | } | 790 | } |
791 | if (compat20 && c->isatty) { | ||
792 | struct termios tio; | ||
793 | if (tcgetattr(c->wfd, &tio) == 0 && | ||
794 | !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { | ||
795 | /* | ||
796 | * Simulate echo to reduce the impact of | ||
797 | * traffic analysis. | ||
798 | */ | ||
799 | packet_start(SSH2_MSG_IGNORE); | ||
800 | memset(buffer_ptr(&c->output), 0, len); | ||
801 | packet_put_string(buffer_ptr(&c->output), len); | ||
802 | packet_send(); | ||
803 | debug("channel: %d simulate echo (%d)", c->self, len); | ||
804 | } | ||
805 | } | ||
779 | buffer_consume(&c->output, len); | 806 | buffer_consume(&c->output, len); |
780 | if (compat20 && len > 0) { | 807 | if (compat20 && len > 0) { |
781 | c->local_consumed += len; | 808 | c->local_consumed += len; |