summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-09-18 05:53:12 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-09-18 05:53:12 +0000
commit6d218f404f9f6e5167626851ffb73a82f7881461 (patch)
tree1618f0d6fc4012e74be7ebd6c32304d922d0901c
parent944c4f0bdaa12ac3c58b77ee866758958e708329 (diff)
- 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
-rw-r--r--ChangeLog6
-rw-r--r--channels.c11
-rw-r--r--serverloop.c12
3 files changed, 20 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index cb863a247..22888d587 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,6 +30,10 @@
30 [channels.c channels.h clientloop.c] 30 [channels.c channels.h clientloop.c]
31 try to fix agent-forwarding-backconnection-bug, as seen on HPUX, 31 try to fix agent-forwarding-backconnection-bug, as seen on HPUX,
32 for example; with Lutz.Jaenicke@aet.TU-Cottbus.DE, 32 for example; with Lutz.Jaenicke@aet.TU-Cottbus.DE,
33 - markus@cvs.openbsd.org 2001/09/17 21:04:02
34 [channels.c serverloop.c]
35 don't send fake dummy packets on CR (\r)
36 bugreport from yyua@cs.sfu.ca via solar@@openwall.com
33 37
3420010917 3820010917
35 - (djm) x11-ssh-askpass-1.2.4 in RPM spec, revert workarounds 39 - (djm) x11-ssh-askpass-1.2.4 in RPM spec, revert workarounds
@@ -6490,4 +6494,4 @@
6490 - Wrote replacements for strlcpy and mkdtemp 6494 - Wrote replacements for strlcpy and mkdtemp
6491 - Released 1.0pre1 6495 - Released 1.0pre1
6492 6496
6493$Id: ChangeLog,v 1.1537 2001/09/18 05:51:13 mouring Exp $ 6497$Id: ChangeLog,v 1.1538 2001/09/18 05:53:12 mouring Exp $
diff --git a/channels.c b/channels.c
index bf11716b8..65cf2ab9e 100644
--- a/channels.c
+++ b/channels.c
@@ -39,7 +39,7 @@
39 */ 39 */
40 40
41#include "includes.h" 41#include "includes.h"
42RCSID("$OpenBSD: channels.c,v 1.133 2001/09/17 20:52:47 markus Exp $"); 42RCSID("$OpenBSD: channels.c,v 1.134 2001/09/17 21:04:01 markus Exp $");
43 43
44#include "ssh.h" 44#include "ssh.h"
45#include "ssh1.h" 45#include "ssh1.h"
@@ -1292,14 +1292,17 @@ static int
1292channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset) 1292channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
1293{ 1293{
1294 struct termios tio; 1294 struct termios tio;
1295 u_char *data;
1296 u_int dlen;
1295 int len; 1297 int len;
1296 1298
1297 /* Send buffered output data to the socket. */ 1299 /* Send buffered output data to the socket. */
1298 if (c->wfd != -1 && 1300 if (c->wfd != -1 &&
1299 FD_ISSET(c->wfd, writeset) && 1301 FD_ISSET(c->wfd, writeset) &&
1300 buffer_len(&c->output) > 0) { 1302 buffer_len(&c->output) > 0) {
1301 len = write(c->wfd, buffer_ptr(&c->output), 1303 data = buffer_ptr(&c->output);
1302 buffer_len(&c->output)); 1304 dlen = buffer_len(&c->output);
1305 len = write(c->wfd, data, dlen);
1303 if (len < 0 && (errno == EINTR || errno == EAGAIN)) 1306 if (len < 0 && (errno == EINTR || errno == EAGAIN))
1304 return 1; 1307 return 1;
1305 if (len <= 0) { 1308 if (len <= 0) {
@@ -1316,7 +1319,7 @@ channel_handle_wfd(Channel *c, fd_set * readset, fd_set * writeset)
1316 } 1319 }
1317 return -1; 1320 return -1;
1318 } 1321 }
1319 if (compat20 && c->isatty) { 1322 if (compat20 && c->isatty && dlen >= 1 && data[0] != '\r') {
1320 if (tcgetattr(c->wfd, &tio) == 0 && 1323 if (tcgetattr(c->wfd, &tio) == 0 &&
1321 !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { 1324 !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
1322 /* 1325 /*
diff --git a/serverloop.c b/serverloop.c
index 0b44182ce..d6089d822 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -35,7 +35,7 @@
35 */ 35 */
36 36
37#include "includes.h" 37#include "includes.h"
38RCSID("$OpenBSD: serverloop.c,v 1.76 2001/07/17 21:04:58 markus Exp $"); 38RCSID("$OpenBSD: serverloop.c,v 1.77 2001/09/17 21:04:02 markus Exp $");
39 39
40#include "xmalloc.h" 40#include "xmalloc.h"
41#include "packet.h" 41#include "packet.h"
@@ -349,12 +349,15 @@ static void
349process_output(fd_set * writeset) 349process_output(fd_set * writeset)
350{ 350{
351 struct termios tio; 351 struct termios tio;
352 u_char *data;
353 u_int dlen;
352 int len; 354 int len;
353 355
354 /* Write buffered data to program stdin. */ 356 /* Write buffered data to program stdin. */
355 if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) { 357 if (!compat20 && fdin != -1 && FD_ISSET(fdin, writeset)) {
356 len = write(fdin, buffer_ptr(&stdin_buffer), 358 data = buffer_ptr(&stdin_buffer);
357 buffer_len(&stdin_buffer)); 359 dlen = buffer_len(&stdin_buffer);
360 len = write(fdin, data, dlen);
358 if (len < 0 && (errno == EINTR || errno == EAGAIN)) { 361 if (len < 0 && (errno == EINTR || errno == EAGAIN)) {
359 /* do nothing */ 362 /* do nothing */
360 } else if (len <= 0) { 363 } else if (len <= 0) {
@@ -369,7 +372,8 @@ process_output(fd_set * writeset)
369 fdin = -1; 372 fdin = -1;
370 } else { 373 } else {
371 /* Successful write. */ 374 /* Successful write. */
372 if (fdin_is_tty && tcgetattr(fdin, &tio) == 0 && 375 if (fdin_is_tty && dlen >= 1 && data[0] != '\r' &&
376 tcgetattr(fdin, &tio) == 0 &&
373 !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) { 377 !(tio.c_lflag & ECHO) && (tio.c_lflag & ICANON)) {
374 /* 378 /*
375 * Simulate echo to reduce the impact of 379 * Simulate echo to reduce the impact of