🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.bugs.4bsd.ucb-fixes
Article #45

V1.35 (fix for telnetd CR_NL mapping)

#45
From: Keith Bostic
Date: Thu, 17 Sep 1987 15:04
75 lines
3048 bytes
Subject: fix for telnetd CR-NL mapping
Index: etc/telnetd.c 4.3BSD

Description:
	In order to resolve certain compatibility problems when telnet
	sessions are nested, 4.3BSD telnetd has been changed to translate
	<CR><NL> to '\r' rather than '\n'.  This circumvents problems when
	using a telnet client that is incapable of sending <CR><NUL> to
	signify a carriage return, then using telnet or tip to connect to
	a system that differentiates between carriage return and line feed.
	(See previous discussions on the tcp-ip mailing list.)  This patch
	also fixes an error that mapped <CR><NUL> to '\r' in binary mode.
	It is recommended that all 4.3BSD sites change telnetd according
	to this patch.
Repeat-By:
	See above.
Fix:
	Apply following patch.

*** /nbsd/usr/src/etc/telnetd.c	Mon May 12 22:21:51 1986
--- telnetd.c	Wed Sep  2 23:22:30 1987
***************
*** 13,15 ****
  #ifndef lint
! static char sccsid[] = "@(#)telnetd.c	5.18 (Berkeley) 5/12/86";
  #endif not lint
--- 13,15 ----
  #ifndef lint
! static char sccsid[] = "@(#)telnetd.c	5.20 (Berkeley) 9/2/87";
  #endif not lint
***************
*** 573,575 ****
  			*nfrontp++ = c;
! 			if (c == '\r') {
  				if (pcc > 0 && ((*ptyip & 0377) == '\n')) {
--- 573,576 ----
  			*nfrontp++ = c;
! 			/* Don't do CR-NUL if we are in binary mode */
! 			if ((c == '\r') && (myopts[TELOPT_BINARY] == OPT_NO)) {
  				if (pcc > 0 && ((*ptyip & 0377) == '\n')) {
***************
*** 617,618 ****
--- 618,620 ----
  			state = TS_DATA;
+ 			/* Strip off \n or \0 after a \r */
  			if ((c == 0) || (c == '\n')) {
***************
*** 630,632 ****
  			/*
! 			 * We map \r\n ==> \n, since \r\n says
  			 * that we want to be in column 1 of the next
--- 632,638 ----
  			/*
! 			 * We now map \r\n ==> \r for pragmatic reasons.
! 			 * Many client implementations send \r\n when
! 			 * the user hits the CarriageReturn key.
! 			 *
! 			 * We USED to map \r\n ==> \n, since \r\n says
  			 * that we want to be in column 1 of the next
***************
*** 636,644 ****
  			 */
! 			if ((myopts[TELOPT_BINARY] == OPT_NO) && c == '\r') {
! 				if ((ncc > 0) && ('\n' == *netip)) {
! 					netip++; ncc--;
! 					c = '\n';
! 				} else {
! 					state = TS_CR;
! 				}
  			}
--- 642,645 ----
  			 */
! 			if ((c == '\r') && (hisopts[TELOPT_BINARY] == OPT_NO)) {
! 				state = TS_CR;
  			}
Technical Details
Message-ID: <8709171504.AA04398@okeeffe.Berkeley.EDU>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!cit-vax!ucla-cs!zen!ucbvax!OKEEFFE.BERKELEY.EDU!bostic

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!bloom-beacon!oberon!cit-vax!ucla-cs!zen!ucbvax!OKEEFFE.BERKELEY.EDU!bostic
From: bostic@OKEEFFE.BERKELEY.EDU (Keith Bostic)
Newsgroups: comp.bugs.4bsd.ucb-fixes
Subject: V1.35 (fix for telnetd CR_NL mapping)
Message-ID: <8709171504.AA04398@okeeffe.Berkeley.EDU>
Date: Thu, 17-Sep-87 11:04:59 EDT
Article-I.D.: okeeffe.8709171504.AA04398
Posted: Thu Sep 17 11:04:59 1987
Date-Received: Sat, 19-Sep-87 14:43:27 EDT
Sender: daemon@ucbvax.BERKELEY.EDU
Organization: The ARPA Internet
Lines: 75
Approved: ucb-fixes@okeeffe.berkeley.edu