2.0.7 trouble with telnetd and rlogind (PATCH!)

ahu@bigtower.et.tudelft.nl
Tue, 16 Jul 1996 23:24:40 +0000 (GMT)


My RedHat 3.0.3 (2.0.7) installation refused to let users login, unless
somebody had already tried (and got stuck). I traced this back to
in.telnetd and found that it's probably kernel related.

A working login is looks like this:

read(5, "\nRed Hat Linux release 3.0.3 (P"..., 4096) = 62
read(5, "", 4096) = 0
close(5) = 0
select(16, [0], [0], [0], NULL) = 1 (out [0])
write(0, "\377\373\1\r\nRed Hat Linux rele"..., 68) = 68
select(16, [0 4], [], [0], NULL) = 1 (in [4])
read(4, "\0Contact?\r\n", 1024) = 11
select(16, [0], [0], [0], NULL) = 1 (out [0])
write(0, "Contact?\r\n", 10) = 10
select(16, [0 4], [], [0], NULL) = 1 (in [4])
read(4, "\1", 1024) = 1
select(16, [0 4], [], [0], NULL) = 1 (in [4])
read(4, "\0\r\n", 1024) = 3
select(16, [0], [0], [0], NULL) = 1 (out [0])
write(0, "\r\n", 2) = 2
select(16, [0 4], [], [0], NULL) = 1 (in [4])
read(4, "\0vvtp.tn.tudelft.nl login: ", 1024) = 27
select(16, [0], [0], [0], NULL) = 1 (out [0])
write(0, "vvtp.tn.tudelft.nl login: ", 26) = 26

The indented lines are due to my own patched login, used for testing. A
"stuck" login looks like this:

select(16, [0], [0], [0], NULL) = 1 (out [0])
write(0, "\377\373\1\r\nRed Hat Linux rele"..., 68) = 68
select(16, [0 4], [], [0], NULL) = 1 (in [0])
read(0, "\377\375\1", 1024) = 3
select(16, [0 4], [], [0], NULL) = 1 (in [0])
read(0, "s", 1024) = 1
select(16, [4], [4], [0], NULL) = 1 (out [4])
write(4, "s", 1) = 1
select(16, [0 4], [], [0], NULL) = 1 (in [0])
read(0, "df;kjsdfkj", 1024) = 10
select(16, [4], [4], [0], NULL) = 1 (out [4])
write(4, "df;kjsdfkj", 10) = 10
select(16, [0 4], [], [0], NULL) = 1 (in [0])
read(0, "\r\0", 1024) = 2
select(16, [4], [4], [0], NULL) = 1 (out [4])
write(4, "\r", 1) = 1
select(16, [0 4], [], [0], NULL) = 1 (in [0])

Filedescriptor 4 is connected to the login process, 0 is connected to the
user. As you can see, though login is trying to send data to telnetd, select
somehow doesn't pick up on it. I have verified that login is trying to send.
The strace of a working and a stuck login-session show no further
differences.

A session is always stuck if it tries to attach itself to ptyp0, as long as
you avoid that one, everything is fine:

This small patch fixes this 'till the kernel is patched:

--- sys_term.c Thu Jul 28 11:21:19 1994
+++ sys_term_207.c Wed Jul 17 01:13:41 1996
@@ -448,6 +448,7 @@
if (stat(line, &stb) < 0)
break;
for (i = 0; i < 16; i++) {
+ if(!i && c=='p')continue; /* FIX FOR LINUX 2.0.7 */
*p2 = "0123456789abcdef"[i];
p = open(line, 2);
if (p > 0) {