aboutsummaryrefslogtreecommitdiff
path: root/crypto/openssh/serverloop.c
diff options
context:
space:
mode:
authorBrian Feldman <green@FreeBSD.org>2001-03-22 00:28:35 +0000
committerBrian Feldman <green@FreeBSD.org>2001-03-22 00:28:35 +0000
commitfffb11d2b5d6ef798dda78162642581e71a779c0 (patch)
tree5f064440d8f6a65c67ae6d3b1e15d0068e34341d /crypto/openssh/serverloop.c
parentc07932d5002d0d988c3c3cb0cac40f1475164550 (diff)
Notes
Diffstat (limited to 'crypto/openssh/serverloop.c')
-rw-r--r--crypto/openssh/serverloop.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/crypto/openssh/serverloop.c b/crypto/openssh/serverloop.c
index f63131d2b7b3..5372ab39abf9 100644
--- a/crypto/openssh/serverloop.c
+++ b/crypto/openssh/serverloop.c
@@ -35,6 +35,7 @@
*/
#include "includes.h"
+RCSID("$FreeBSD$");
RCSID("$OpenBSD: serverloop.c,v 1.34 2000/10/27 07:32:18 markus Exp $");
#include "xmalloc.h"
@@ -67,6 +68,7 @@ static long fdout_bytes = 0; /* Number of stdout bytes read from program. */
static int stdin_eof = 0; /* EOF message received from client. */
static int fdout_eof = 0; /* EOF encountered reading from fdout. */
static int fderr_eof = 0; /* EOF encountered readung from fderr. */
+static int fdin_is_tty = 0; /* fdin points to a tty. */
static int connection_in; /* Connection to client (input). */
static int connection_out; /* Connection to client (output). */
static unsigned int buffer_high;/* "Soft" max buffer size. */
@@ -322,6 +324,7 @@ process_input(fd_set * readset)
void
process_output(fd_set * writeset)
{
+ struct termios tio;
int len;
/* Write buffered data to program stdin. */
@@ -341,7 +344,19 @@ process_output(fd_set * writeset)
#endif
fdin = -1;
} else {
- /* Successful write. Consume the data from the buffer. */
+ /* Successful write. */
+ if (fdin_is_tty && tcgetattr(fdin, &tio) == 0 &&
+ !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
+ /*
+ * Simulate echo to reduce the impact of
+ * traffic analysis
+ */
+ packet_start(SSH_MSG_IGNORE);
+ memset(buffer_ptr(&stdin_buffer), 0, len);
+ packet_put_string(buffer_ptr(&stdin_buffer), len);
+ packet_send();
+ }
+ /* Consume the data from the buffer. */
buffer_consume(&stdin_buffer, len);
/* Update the count of bytes written to the program. */
stdin_bytes += len;
@@ -425,6 +440,9 @@ server_loop(pid_t pid, int fdin_arg, int fdout_arg, int fderr_arg)
if (fderr != -1)
set_nonblock(fderr);
+ if (!(datafellows & SSH_BUG_IGNOREMSG) && isatty(fdin))
+ fdin_is_tty = 1;
+
connection_in = packet_get_connection_in();
connection_out = packet_get_connection_out();