(long) telnet BUG (was Re: telnet and ctrl-c)

(long) telnet BUG (was Re: telnet and ctrl-c)

Post by John E. Dav » Fri, 17 Jan 1997 04:00:00



On 16 Jan 1997 07:25:44 GMT, Takis Skagos <ska...@mercury.cs.uregina.ca>
wrote:

>  I am having problems with CTRL-C and telneting from my Linux
>box (RedHat 4.0) to other hosts.  Most of the time, when I type
>the CTRL-C key sequence, it locks up the telnet session and I
>usually end up having to CTRL-] and closing it.  This is very,
>very annoying.

I have the same problem; however, it only manifests itself when I use
slirp.  Also, it does always not lock-up immediately after pressing
Ctrl-C, I sometimes have to press return a few times to see the
effect. Rlogin over the same ppp/slirp connection does not suffer this
problem.  This happens using the telnet program distributed with the
latest NetKit (0.9) as well as the telnet distributed with debian.  I
compiled both against libc 5.4.17 and Linux 2.0.27.

strace indicates that telnet does not really lock up (after all, it
responds to Ctrl-]).  Characters are still sent to the remote host and
the host will respond accordingly. For example, if I type
`pwd<RETURN>', I see nothing in the window running the locked telnet
but the strace window indicates that the remote host has responded
with my current working directory.  The upshot of this is that telnet
is not frozen, it simply refuses to display what it receives from the
remote connection.

One day last week when it locked up (it always does after pressing
Ctrl-C), I noticed the output of the telnet program appearing in
another xterm!!!  This indicates that somehow it was writing to a
different pty!

Here is an strace of a telnet session that I just ``locked up'' for
the purpose of this followup.  Notice that it is reading from stdin
(fileno=0), writing to stdout (fileno=1), sending data to the remote
using fileno=3, and receiving data using fileno=4.  The strace was
started after I logged in to the remote host and before I pressed
Ctrl-C.  Lines starting with `#' are my comments:

Script started on Thu Jan 16 12:48:55 1997
[mygir]
 [7m[12:48pm] [m /home/john>strace -p 9113
select(4, [0 3], [], [3], NULL)         = 1 (in [0])

# It is waiting for input, I press pwd RETURN
read(0, "p", 1009)                      = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "p", 1, 0)                      = 1
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "w", 1008)                      = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "w", 1, 0)                      = 1
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "d", 1007)                      = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "d", 1, 0)                      = 1
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "p", 745, 0)                    = 1
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "p", 1)                        = 1

# The host echos the `p' back and telnet writes it to stdout.

select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\r", 1006)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "w", 744, 0)                    = 1
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "w", 1)                        = 1
select(4, [0 3], [], [3], {0, 0})       = 1 (in [3], left {0, 0})
recv(3, "d", 743, 0)                    = 1
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "d", 1)                        = 1
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 742, 0)             = 4
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "/nfs/wiwaxia/h1/davis\r\n[aluche"..., 738, 0) = 72
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "/nfs/wiwaxia/h1/davis\r\n[aluche"..., 72) = 72

# The result of pwd has been received by telnet and echoed to stdout.
# So far, so good.
# Now, I press Ctrl-C:

select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\3", 1005)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\3", 1, 0)                     = 1

# Ctrl-C received and sent to remote host.

select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 2 (in [3]], except [3])
ioctl(1, TCFLSH, TCIFLUSH)              = 0
recv(3, "\377", 666, 0)                 = 1
select(4, [0 3], [], [], {0, 0})        = 0 (Timeout)
select(4, [0 3], [], [], NULL)          = 1 (in [3])
recv(3, "\362\r\0\r\n\33[K[aluche]\r\n\33"..., 665, 0) = 57
ioctl(1, TCFLSH, TCIFLUSH)              = 0

# Host has responded to Ctrl-C and stdout has been flushed.
# Notice that it all is still ok because writes to 1 still take place:

select(4, NULL, NULL, [3], {0, 0})      = 0 (Timeout)
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n\33[K[aluche]\r\n\33[7m[12"..., 55) = 55

# I press return a few times and then Ctrl-C again until I see the
# ``lockup'':

select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\r", 1004)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 608, 0)             = 4
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 604, 0) = 49
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 49) = 49
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\r", 1003)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 555, 0)             = 4
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 551, 0) = 49
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 49) = 49
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\r", 1002)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 502, 0)             = 4
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 498, 0) = 49
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 49) = 49
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\r", 1001)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 449, 0)             = 4
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 445, 0) = 49
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 49) = 49
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\r", 1000)                     = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 396, 0)             = 4
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 392, 0) = 49
select(4, [0 3], [1], [3], {0, 0})      = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[12:49pm]\33[m"..., 49) = 49
select(4, [0 3], [], [3], {0, 0})       = 0 (Timeout)
select(4, [0 3], [], [3], NULL)         = 1 (in [0])
read(0, "\3", 999)                      = 1
select(4, [0 3], [3], [3], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\3", 1, 0)                     = 1
select(4, [0 3], ...

read more »

 
 
 

(long) telnet BUG (was Re: telnet and ctrl-c)

Post by Frank da Cr » Fri, 17 Jan 1997 04:00:00





: >  I am having problems with CTRL-C and telneting from my Linux
: >box (RedHat 4.0) to other hosts.  Most of the time, when I type
: >the CTRL-C key sequence, it locks up the telnet session and I
: >usually end up having to CTRL-] and closing it.  This is very,
: >very annoying.
: ...
: Incidently, the telnet distributed with NetKit 0.9 is different from
: the debian one; however, they both share alot of common code.
: Unfortunately, the NetKit one is more broken because it will close the
: connection if I cat a file containing 40 or more lines.
:
: I would really like to see this fixed.  Excluding the message I am
: following up to, I have seen only one other report of this problem.
: Unfortunately, I have not located a solution.
:
Try using C-Kermit as your Telnet client -- I'd be surprised if it does
anything like this (and if it does, I can fix it):

  http://www.columbia.edu/kermit/ck60.html

- Frank

 
 
 

(long) telnet BUG (was Re: telnet and ctrl-c)

Post by John E. Dav » Fri, 17 Jan 1997 04:00:00


In a previous article, I posted the strace for the NetKit 0.9 telnet.
The debian telnet also manifests the bug but the strace is different.
Here is the strace for the debian telnet:

Script started on Thu Jan 16 13:42:12 1997
[mygir]
 [7m[1:42pm] [m /home/john>ps -auxww | rgrep telnet
john      9186  0.0  2.0  1008   472  p1 S   13:41   0:00 /tmp/telnet aluche.mit.edu
john      9192  0.0  1.0   848   236  p4 S   13:42   0:00 rgrep telnet
[mygir]
 [7m[1:42pm] [m /home/john>strace -p 9186
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "p", 1024)                      = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "p", 1, 0)                      = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "w", 1024)                      = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "w", 1, 0)                      = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "d", 1024)                      = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "d", 1, 0)                      = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "p", 1024, 0)                   = 1
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "p", 1)                        = 1
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\r", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "wd", 1024, 0)                  = 2
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "wd", 2)                       = 2
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "\r\0\r\n", 1024, 0)            = 4
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "/nfs/wiwaxia/h1/davis\r\n[aluche"..., 1024, 0) = 71
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "/nfs/wiwaxia/h1/davis\r\n[aluche"..., 71) = 71
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\3", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\3", 1, 0)                     = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 2 (in [3]], except [3])
recv(3, "\377", 1024, 0)                = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "\362\r\0\r\n\33[K[aluche]\r\n\33"..., 1024, 0) = 56
select(4, NULL, NULL, [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n\33[K[aluche]\r\n\33[7m[1:"..., 54) = 54
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\r", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "\r\0\r\n", 1024, 0)            = 4
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 1024, 0) = 48
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 48) = 48
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\r", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "\r\0\r\n", 1024, 0)            = 4
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 1024, 0) = 48
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 48) = 48
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\3", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\3", 1, 0)                     = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 2 (in [3]], except [3])
recv(3, "\377", 1024, 0)                = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "\362\r\0\r\n\33[K[aluche]\r\n\33"..., 1024, 0) = 56
select(4, NULL, NULL, [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n\33[K[aluche]\r\n\33[7m[1:"..., 54) = 54
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\r", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "\r\0\r\n", 1024, 0)            = 4
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n", 3)                   = 3
select(16, [0 3], [], [3], NULL)        = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 1024, 0) = 48
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 48) = 48
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\3", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\3", 1, 0)                     = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\3", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\3", 1, 0)                     = 1
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 2 (in [3]], except [3])
recv(3, "\377", 1024, 0)                = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "\362\r\0\r\n\33[K[aluche]\r\n\33"..., 1024, 0) = 56
select(4, NULL, NULL, [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n\33[K[aluche]\r\n\33[7m[1:"..., 54) = 54
select(16, [0 3], [], [3], NULL)        = 1 (in [0])
read(0, "\r", 1024)                     = 1
select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [], [3], NULL)        = 2 (in [3]], except [3])
recv(3, "\377", 1024, 0)                = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "\362\r\0\r\n\33[K[aluche]\r\n\33"..., 1024, 0) = 56
select(4, NULL, NULL, [3], {0, 0})      = 0 (Timeout)
select(16, [0 3], [1], [3], {0, 0})     = 1 (out [1], left {0, 0})
write(1, "\r\r\n\33[K[aluche]\r\n\33[7m[1:"..., 54) = 54
select(16, [0 3], [], [3], NULL)        = 1 (except [3])
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 1024, 0)            = 4
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 1024, 0) = 48
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [0])
read(0, "\r", 1024)                     = 1
select(16, [0 3], [3], [], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "\r\0", 2, 0)                   = 2
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "\r\0\r\n", 1024, 0)            = 4
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "[aluche]\r\n\33[7m[1:42pm]\33[m "..., 1024, 0) = 48
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [0])
read(0, "l", 1024)                      = 1
select(16, [0 3], [3], [], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "l", 1, 0)                      = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [0])
read(0, "o", 1024)                      = 1
select(16, [0 3], [3], [], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "o", 1, 0)                      = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "l", 1024, 0)                   = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [0])
read(0, "c", 1024)                      = 1
select(16, [0 3], [3], [], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "c", 1, 0)                      = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [0])
read(0, "k", 1024)                      = 1
select(16, [0 3], [3], [], {0, 0})      = 1 (out [3], left {0, 0})
send(3, "k", 1, 0)                      = 1
select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
select(16, [0 3], [], [], NULL)         = 1 (in [3])
recv(3, "o", 1024, 0)                   = 1
select(16, [0 3], [], [], {0, ...

read more »

 
 
 

(long) telnet BUG (was Re: telnet and ctrl-c)

Post by John E. Dav » Sat, 18 Jan 1997 04:00:00




Quote:>Try using C-Kermit as your Telnet client -- I'd be surprised if it does
>anything like this (and if it does, I can fix it):

I tried it but I was unable to reproduce the problem with the telnet
built-in to kermit.  Actually, I though of simply using kermit's
telnet but I thought that it would simply run /bin/telnet.  It's
interesting that it does not.

--John

 
 
 

(long) telnet BUG (was Re: telnet and ctrl-c)

Post by John E. Dav » Sat, 18 Jan 1997 04:00:00




Quote:>In a previous article, I posted the strace for the NetKit 0.9 telnet.
>The debian telnet also manifests the bug but the strace is different.
>Here is the strace for the debian telnet:

I did some more checking.  The problem appears to be in telnet's
handling of the special telnet characters \377 (IAC) followed by \362
(DM) which telnetd sends after receiving a Ctrl-C.  It is possible
that the bug is with telnetd rather than telnet.  I am using the
telnetd that I compiled from the latest NetKit (0.9):

Quote:>read(0, "\3", 1024)                     = 1
>select(16, [0 3], [3], [3], {0, 0})     = 1 (out [3], left {0, 0})
>send(3, "\3", 1, 0)                     = 1
>select(16, [0 3], [], [3], {0, 0})      = 0 (Timeout)
>select(16, [0 3], [], [3], NULL)        = 2 (in [3]], except [3])
>recv(3, "\377", 1024, 0)                = 1
>select(16, [0 3], [], [], {0, 0})       = 0 (Timeout)
>select(16, [0 3], [], [], NULL)         = 1 (in [3])
>recv(3, "\362\r\0\r\n\33[K[aluche]\r\n\33"..., 1024, 0) = 56

I noticed that the telnetd distributed with SunOS does not send
\377\362 upon the receiving Ctrl-C and telnet does not lockup when
connected to a SunOS machine.

According to RFC 854:

      To counter this problem, the TELNET "Synch" mechanism is
      introduced.  A Synch signal consists of a TCP Urgent
      notification, coupled with the TELNET command DATA MARK.  The
      Urgent notification, which is not subject to the flow control
      pertaining to the TELNET connection, is used to invoke special
      handling of the data stream by the process which receives it.
      In this mode, the data stream is immediately scanned for
      ``interesting'' signals as defined below, discarding intervening
      data.  The TELNET command DATA MARK (DM) is the synchronizing
      mark in the data stream which indicates that any special signal
      has already occurred and the recipient can return to normal
      processing of the data stream.

It looks like telnet is not properly handling this condition or that
the Linux telnetd (distributed as part of NetKit 0.9) is defective.

--John

 
 
 

1. telnet and ctrl-c

Hi,

  I am having problems with CTRL-C and telneting from my Linux
box (RedHat 4.0) to other hosts.  Most of the time, when I type
the CTRL-C key sequence, it locks up the telnet session and I
usually end up having to CTRL-] and closing it.  This is very,
very annoying.

  Any help and/or information would be greatly appreciated.

  Thanks!

--
Takis
--

|o|(306)585-4974  |http://www.cs.uregina.ca/~skagos|FAX: (306) 585-4745   |o|
|o|---------------*--------------------------------*----------------------|o|
|o|                            TANSTAAFL                                  |o|

2. Had enough of Linux.

3. telnet, ctrl-c

4. VisualAge Vac C++ version 5.0

5. telnet and ctrl-c

6. VSIG

7. telnet and CTRL-C -- locks up ... :(

8. CDrom Problem

9. Ctrl-C giving problems with telnet and rlogin

10. telnet 0 vs telnet `hostname` vs telnet 127.0.0.1

11. telnet programming: CAI IP does NOT stop telnet???

12. Solved: can't telnet-in before telnet-out

13. Telnet refuses to send (both telnet and kermit)