Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!ucla-cs!zen!ucbvax!UCBVAX.BERKELEY.EDU!karels%okeeffe From: karels%okeeffe@UCBVAX.BERKELEY.EDU.UUCP Newsgroups: comp.protocols.tcp-ip Subject: official Berkeley fix for telnetd CR-NL mapping Message-ID: <8709170404.AA01156@okeeffe.Berkeley.EDU> Date: Thu, 17-Sep-87 00:04:00 EDT Article-I.D.: okeeffe.8709170404.AA01156 Posted: Thu Sep 17 00:04:00 1987 Date-Received: Sat, 19-Sep-87 06:46:21 EDT Sender: daemon@ucbvax.BERKELEY.EDU Distribution: world Organization: The ARPA Internet Lines: 68 In order to resolve certain compatibility problems when telnet sessions are nested, 4.3BSD telnetd has been changed to translate to '\r' rather than 'n'. This circumvents problems when using a telnet client that is incapable of sending 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 to '\r' in binary mode. It is recommended that all 4.3BSD sites change telnetd according to this patch. Mike *** /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; }