[3855] in linux-net channel archive

home help back first fref pref prev next nref lref last post

NetKit-B-0.07 telnetd bug

daemon@ATHENA.MIT.EDU (Jon Lewis)
Thu Jul 25 20:34:45 1996

Date: 	Thu, 25 Jul 1996 13:05:56 -0400 (EDT)
From: Jon Lewis <jlewis@inorganic5.fdt.net>
To: dholland@hcs.harvard.edu
cc: Linux Net Mailing List <linux-net@vger.rutgers.edu>

This is a somewhat annoying bug that I first found in the procps (0.99a 
and 1.01) mknewpty script.  According to 
/usr/src/linux/Documentation/devices.txt (kernel 2.0.4):

                Pseudo-tty's are named as follows:
                * Masters are "pty", slaves are "tty";
                * the fourth letter is one of pqrstuvwxyzabcde indicating
                  the 1st through 16th series of 16 pseudo-ttys each, and
                * the fifth letter is one of 0123456789abcdef indicating
                  the position within the series.

Procps and NetKit use the fourth letter is one of pqrstuvwxyzABCDE, which 
conflicts with Cyclades' use of /dev/ttyC[blah].  The fix is to simply 
make those 4th letter caps into lower case letters as they should have 
been.  Also...while upgrading boxes and renaming tty's, I ran into a 
problem where telnetd claimed there were no tty's left just because the 
first one it looked for didn't exist.  What do you think of the following 
change:

--- sys_term.c  Tue Jul 16 04:58:31 1996
+++ sys_term.c.new      Thu Jul 25 12:44:00 1996
@@ -449,10 +449,10 @@
        for (i = 0; i < 16; i++) {
                struct stat stb;

-               *p1 = "pqrstuvwxyzABCDE"[i];
+               *p1 = "abcdetuvwxyzpqrs"[i];
                *p2 = '0';
                if (stat(line, &stb) < 0)
-                       break;
+                       continue;
                for (j = 0; j < 16; j++) {
                        *p2 = "0123456789abcdef"[j];
                        p = open(line, 2);

I did this so that it would try all pty groups before giving up, and also
so that the new ones get used first...since I've not found the source for
libbsd and have been unable to make a rlogind that uses more than the
original 64 ptys.  This leaves the original 64 for rlogind unless they are
needed due to pty shortage.  I'm currently running telnetd on my systems
with the above changes and have not had problems yet (1.2.13, 2.0.3, 2.0.4).


------------------------------------------------------------------
 Jon Lewis                      |  Mime attachments are OK
 jlewis@inorganic5.fdt.net      |  But please ask before sending 
 http://inorganic5.fdt.net      |  unsolicited huge files.
________Finger jlewis@inorganic5.fdt.net for PGP public key_______


home help back first fref pref prev next nref lref last post