[comp.bugs.4bsd] 4.3BSD Telnetd incorrectly maps CR-LF sequences

robert@hslrswi.UUCP (01/29/87)

Index:
	/usr/src/etc/telnetd.c 4.3BSD

Description:
	The version of telnetd as delivered in 4.3BSD incorrectly maps
	CR-LF sequences received over the network on to LF's which are
	then handed on to the pty driver.

	This goes unnoticed most of the time because the tty driver
	accepts either CR or LF as end-of-line characters when in
	cooked mode.  However, it means that any program operating in
	cbreak mode, which is invoked over a telnet connection,
	mysteriously fails.  This includes tip, telnet itself and
	probably others.

	(Has no-one noticed this before now ?)

Fix:
	The fix is, fortunately, a one-liner. CR-LF sequences should
	be mapped on to CR's, not LF's. Apply the following patch
	(Note that the correct version is now between the #ifdef lines).


*** /usr/src/etc/telnetd.c	Thu Dec  4 10:16:23 1986
--- /usr/src/etc/telnetd.c.ucb	Tue May 13 07:21:51 1986
***************
*** 637,647 ****
  			if ((myopts[TELOPT_BINARY] == OPT_NO) && c == '\r') {
  				if ((ncc > 0) && ('\n' == *netip)) {
  					netip++; ncc--;
- #ifdef HASLER
- 					c = '\r';
- #else
  					c = '\n';
- #endif
  				} else {
  					state = TS_CR;
  				}
--- 637,643 ----


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    J. Robert Ward,						   ___________
    Hasler AG, Belpstrasse 23, CH-3000 Berne 14, Switzerland	   |    _    |
								   |  _| |_  |
Tel.:	    +41 31 632319					   | |_   _| |
X.400:	    robert@hslrswi.hasler				   |   |_|   |
Bitnet:	    robert%hslrswi.UUCP@cernvax.BITNET	   		   |_________|
Uucp:	    ... {seismo,ukc, ... }!mcvax!cernvax!hslrswi!robert
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~