https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196902
Bug ID: 196902 Summary: [PATCH] telnet: bad terminal setup in character + local echo mode Product: Base System Version: 11.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: freebsd-bugs@FreeBSD.org Reporter: sbra...@suse.cz Created attachment 151861 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=151861&action=edit Proposed fix If the telnet client switches to the character + local echo mode (a non-standard combination) and it runs in a smart terminal capable of doing echo, telnet client configures the terminal to perform the echo. Telnet client itself does no echo. There is a problem that telnet uses an incorrect combination of flags, which causes End Of Line being displayed as "^M" instead of performing CR+LF. How to reproduce: 1. Run telnet client in a smart virtual terminal capable of local echo (for example "xterm" or "gnome-terminal") 2. Connect to a telnetd capable and properly implementing WONT ECHO. 3. Login to a shell that is capable to work in no echo mode: - For example "bash --noediting" or call "set +o vi ; set +o emacs" before changing telnet mode. - You can also reproduce it with "cat" in place of login shell. 4. Set the mode to the local echo using "send dont echo". Now your telnet session should be in the character local echo mode. (Character mode is the default and we did not change it before switching to the local echo mode.) Without the fix: telnet> send dont echo linux> #hello^Mlinux> With the fix: telnet> send dont echo linux> #hello linux> Note: Characters "^M" are generated by mis-configured terminal on the client side. They are not passed to the telnet session. Telnet session correctly gets EOL (LF or CRLF). Technical details: Current implementation uses following set of flags: onlcr -icrnl echo In CRLF mode it first correctly sets onlcr icrnl echo but later in the code it changes flags to onlcr -icrnl echo The -icrnl causes echoing of control characters as "^{letter}", including LF displayed as "^M". According to Werner Fink <wer...@suse.com>, this is a correct behavior of terminal, just the combination of flags used is incorrect. However the problem was discovered on the Linux system, I believe, that the problem is system independent, and affects all systems. Attached patch seems to fix this issue without breaking any other telnet modes. As FreeBSD seems to inherit the original BSD code, I am sending this report here as well. This problem probably exists from the very first implementation of character echo mode in the BSD telnet (1987), and affects probably all implementations derived from it: - NetBSD telnet (the original code) Reported there as http://gnats.netbsd.org/49392 - OpenBSD telnet (branched 1995 from NetBSD) Reported as http://lists.openbsd.org/cgi-bin/mj_wwwusr?list=bugs&brief=on&func=archive-get-part&extra=201501/57 (browsing archives needs registration) - netkit-telnet (now in Debian, branched between 1990 and 1993) - telnet-bsd (Linux port from 1999 created by Thorsten Kukuk <ku...@suse.de>) - FreeBSD telnet (significantly rewritten, branched between 1993 and 1997) -- You are receiving this mail because: You are the assignee for the bug. _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"