summaryrefslogtreecommitdiffstats
path: root/channels.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2001-02-16 12:34:57 +1100
committerDamien Miller <djm@mindrot.org>2001-02-16 12:34:57 +1100
commit79438cc03040e22a053f2cb02e42483272b458df (patch)
treecbc85e2742e20db8ed40835b087523f78eb4e9a8 /channels.c
parent217f567187a9b1d32019666151d702c87332c72b (diff)
- (djm) OpenBSD CVS:
- markus@cvs.openbsd.org 2001/02/15 16:19:59 [channels.c channels.h serverloop.c sshconnect.c sshconnect.h] [sshconnect1.c sshconnect2.c] genericize password padding function for SSH1 and SSH2. add stylized echo to 2, too. - (djm) Add roundup() macro to defines.h
Diffstat (limited to 'channels.c')
-rw-r--r--channels.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/channels.c b/channels.c
index a079fc24..b7286940 100644
--- a/channels.c
+++ b/channels.c
@@ -40,7 +40,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: channels.c,v 1.90 2001/02/08 21:58:28 markus Exp $");
+RCSID("$OpenBSD: channels.c,v 1.91 2001/02/15 23:19:59 markus Exp $");
#include <openssl/rsa.h>
#include <openssl/dsa.h>
@@ -193,6 +193,18 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd,
c->efd = efd;
c->extended_usage = extusage;
+ /* XXX ugly hack: nonblock is only set by the server */
+ if (nonblock && isatty(c->rfd)) {
+ debug("channel: %d: rfd %d isatty", c->self, c->rfd);
+ c->isatty = 1;
+ if (!isatty(c->wfd)) {
+ error("channel: %d: wfd %d is not a tty?",
+ c->self, c->wfd);
+ }
+ } else {
+ c->isatty = 0;
+ }
+
/* enable nonblocking mode */
if (nonblock) {
if (rfd != -1)
@@ -776,6 +788,21 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
}
return -1;
}
+ if (compat20 && c->isatty) {
+ struct termios tio;
+ if (tcgetattr(c->wfd, &tio) == 0 &&
+ !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
+ /*
+ * Simulate echo to reduce the impact of
+ * traffic analysis.
+ */
+ packet_start(SSH2_MSG_IGNORE);
+ memset(buffer_ptr(&c->output), 0, len);
+ packet_put_string(buffer_ptr(&c->output), len);
+ packet_send();
+ debug("channel: %d simulate echo (%d)", c->self, len);
+ }
+ }
buffer_consume(&c->output, len);
if (compat20 && len > 0) {
c->local_consumed += len;