Package: inetutils-server Version: 1.9.1-2 or older Telnetd in inetutils-server package lacks handling of some of TIOCPKT control bytes. The most influential thing is a lack of handling of TIOCPKT_DATA. TIOCPKT_DATAs i.e. '\0's frequently appear in the stream of network side.
In most cases, '\0' is invisible on a terminal, therefore it is hardly noticed. However, sometimes multibyte characters are displayed incorrectly by interference of inserted '\0'. To reproduce this problem: 1) Install intetutils-server package. 2) Make a typescript file by: script -qc 'telnet localhost' 3) Do something to produce some text outputs. 4) Logout from the telnet session. 5) Look into the typescript file, then you will find many extra '\0's (^@) in it. To fix this problem, I have made following patch. In this patch, the first byte from read() is always treated as a TIOCPKT control byte. Therefore, it is simply read out instead of being peeked. This is based on description in man tty_ioctl, which says the first byte returned by read() is always a TIOCPKT control byte. --- telnetd.c.orig 2012-01-06 22:58:30.000000000 +0900 +++ telnetd.c 2015-02-20 19:18:55.808004100 +0900 @@ -601,11 +601,10 @@ telnetd_run (void) /* Something to read from the pty... */ if (pty_read () < 0) break; - c = pty_get_char (1); + c = pty_get_char (0); /* read TIOCPKT control byte */ #if defined TIOCPKT_IOCTL if (c & TIOCPKT_IOCTL) { - pty_get_char (0); copy_termbuf (); localstat (); } @@ -613,7 +612,6 @@ telnetd_run (void) if (c & TIOCPKT_FLUSHWRITE) { static char flushdata[] = { IAC, DM }; - pty_get_char (0); netclear (); /* clear buffer back */ net_output_datalen (flushdata, sizeof (flushdata)); set_neturg (); @@ -630,7 +628,6 @@ telnetd_run (void) IAC, SB, TELOPT_LFLOW, flowmode ? LFLOW_ON : LFLOW_OFF, IAC, SE); } - pty_get_char (0); } } -- Takashi Yano <takashi.y...@nifty.ne.jp>
cygcheck.out
Description: Binary data
-- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple