[channels.c serverloop.c]
     don't send fake dummy packets on CR (\r)
     bugreport from yyua@cs.sfu.ca via solar@@openwall.com
This commit is contained in:
Ben Lindstrom 2001-09-18 05:53:12 +00:00
parent 944c4f0bda
commit 6d218f404f
3 changed files with 20 additions and 9 deletions

View File

@ -30,6 +30,10 @@
[channels.c channels.h clientloop.c] [channels.c channels.h clientloop.c]
try to fix agent-forwarding-backconnection-bug, as seen on HPUX, try to fix agent-forwarding-backconnection-bug, as seen on HPUX,
for example; with Lutz.Jaenicke@aet.TU-Cottbus.DE, for example; with Lutz.Jaenicke@aet.TU-Cottbus.DE,
- markus@cvs.openbsd.org 2001/09/17 21:04:02
[channels.c serverloop.c]
don't send fake dummy packets on CR (\r)
bugreport from yyua@cs.sfu.ca via solar@@openwall.com
20010917 20010917
- (djm) x11-ssh-askpass-1.2.4 in RPM spec, revert workarounds - (djm) x11-ssh-askpass-1.2.4 in RPM spec, revert workarounds
@ -6490,4 +6494,4 @@
- Wrote replacements for strlcpy and mkdtemp - Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1 - Released 1.0pre1
$Id: ChangeLog,v 1.1537 2001/09/18 05:51:13 mouring Exp $ $Id: ChangeLog,v 1.1538 2001/09/18 05:53:12 mouring Exp $

View File

@ -39,7 +39,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: channels.c,v 1.133 2001/09/17 20:52:47 markus Exp $"); RCSID("$OpenBSD: channels.c,v 1.134 2001/09/17 21:04:01 markus Exp $");
#include "ssh.h" #include "ssh.h"
#include "ssh1.h" #include "ssh1.h"
@ -1292,14 +1292,17 @@ static int
channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
{ {
struct termios tio; struct termios tio;
u_char *data;
u_int dlen;
int len; int len;
/* Send buffered output data to the socket. */ /* Send buffered output data to the socket. */
if (c->wfd != -1 && if (c->wfd != -1 &&
FD_ISSET(c->wfd, writeset) && FD_ISSET(c->wfd, writeset) &&
buffer_len(&c->output) > 0) { buffer_len(&c->output) > 0) {
len = write(c->wfd, buffer_ptr(&c->output), data = buffer_ptr(&c->output);
buffer_len(&c->output)); dlen = buffer_len(&c->output);
len = write(c->wfd, data, dlen);
if (len < 0 && (errno == EINTR || errno == EAGAIN)) if (len < 0 && (errno == EINTR || errno == EAGAIN))
return 1; return 1;
if (len <= 0) { if (len <= 0) {
@ -1316,7 +1319,7 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
} }
return -1; return -1;
} }
if (compat20 && c->isatty) { if (compat20 && c->isatty && dlen >= 1 && data[0] != '\r') {
if (tcgetattr(c->wfd, &tio) == 0 && if (tcgetattr(c->wfd, &tio) == 0 &&
!(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
/* /*

View File

@ -35,7 +35,7 @@
*/ */
#include "includes.h" #include "includes.h"
RCSID("$OpenBSD: serverloop.c,v 1.76 2001/07/17 21:04:58 markus Exp $"); RCSID("$OpenBSD: serverloop.c,v 1.77 2001/09/17 21:04:02 markus Exp $");
#include "xmalloc.h" #include "xmalloc.h"
#include "packet.h" #include "packet.h"
@ -349,12 +349,15 @@ static void
process_output(fd_set * writeset) process_output(fd_set * writeset)
{ {
struct termios tio; struct termios tio;
u_char *data;
u_int dlen;
int len; int len;
/* Write buffered data to program stdin. */ /* Write buffered data to program stdin. */
if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) { if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
len = write(fdin, buffer_ptr(&stdin_buffer), data = buffer_ptr(&stdin_buffer);
buffer_len(&stdin_buffer)); dlen = buffer_len(&stdin_buffer);
len = write(fdin, data, dlen);
if (len < 0 && (errno == EINTR || errno == EAGAIN)) { if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
/* do nothing */ /* do nothing */
} else if (len <= 0) { } else if (len <= 0) {
@ -369,7 +372,8 @@ process_output(fd_set * writeset)
fdin = -1; fdin = -1;
} else { } else {
/* Successful write. */ /* Successful write. */
if (fdin_is_tty && tcgetattr(fdin, &tio) == 0 && if (fdin_is_tty && dlen >= 1 && data[0] != '\r' &&
tcgetattr(fdin, &tio) == 0 &&
!(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
/* /*
* Simulate echo to reduce the impact of * Simulate echo to reduce the impact of