At the moment, the only thing here is telnetd.90.06.28.patch. It's
public domain.

telnetd.90.06.28.patch is a safe patch to the telnetd source in
telnet.90.06.28 on ucbarpa.berkeley.edu (128.32.130.11). ``Safe'' means
that every file compiles exactly the same if USEPTY is not defined;
you can apply the patch without any worry of messing up your source.

What follows is an outline of how to apply the patch and enable it. A
patched telnetd uses pty to manage sessions, so that users can easily
disconnect and reconnect login sessions. You *must* have compiled file
descriptor passing into pty for this to work; telnetd needs to get the
pseudo-terminal descriptors from pty. Given fd passing, though, the
patched telnetd gives you the *full* efficiency of the unpatched
version, even for reconnected sessions!


Here's what to do. If you have the tiocsti utility installed, try
``make > /dev/null'' in this directory; or just read through these
instructions. The usual warning: Like all software, this comes with
all warranties disclaimed, to the extent permitted by applicable law.


1. Get the new telnetd:

  % ftp -n 128.32.130.11 < TELNET.FTP

2. Unpack it:

  % uncompress < telnet.90.06.28.tar.Z | tar xf -

3. Apply these patches, and check that they're safe:

  % cd telnet.90.06.28/telnetd
  % patch < ../../telnetd.90.06.28.patch
  % unifdef -UUSEPTY sys_term.c | cmp - sys_term.c.orig
  % unifdef -UUSEPTY telnetd.c | cmp - telnetd.c.orig
  % unifdef -UUSEPTY pathnames.h | cmp - pathnames.h.orig
  % cd ../..

4. Check the pty pathname and fix it if necessary:

  % grep PATH_PTY telnet.90.06.28/telnetd/pathnames.h

5. Add sock.o and sock.h symlinks:

  % ( cd telnet.90.06.28/telnetd; ln -s ../../../sock.{o,h} . )

6. When you want to compile the patched version: Add sock.o to OBJS
   and -DUSEPTY to CCOPTS in Makefile.generic. Change whatever else
   necessary to get telnetd to compile.

7. Compile! On a Sun 4 under SunOS 4.0.3, for example, you just
   ``make sun4.0'' in the telnetd directory.

8. If you actually survive telnetd's incompatibilities and get it to
   compile, keep reading.


The reason this telnetd is so big is that it supports Linemode, a bold
attempt to cut the Internet load from all the fast typists in the world
by a third or even a half.

If you're bored, compile the telnet client as well.


Anyway, the telnetd you just compiled supports pty. You probably don't
want to replace your original telnetd, because if something goes wrong
then you need to log in again. Also, your telnetd may have special
features for your machine. Instead, take the gradual upgrade path: Put
telnetd into /usr/local/telnetd.pty, add a new ``tpt'' port to
/etc/services, and add this line to /etc/inetd.conf:

tpt	stream	tcp	nowait	root	/usr/local/telnetd.pty	telnetd

(On older machines, ``root'' wouldn't be there; imitate the telnet line
to figure out the right format. If you have the better interface of
attachport, use it instead.) kill -HUP the inetd process so that it will
reread inetd.conf.


Now try connecting to the tpt port rather than 23 (instead of telnet X,
do telnet X tpt). You should end up talking to the new telnetd, a clean
login, and (best of all) a pty session. (The most common problem: Lines
don't appear until after you press return. This means that your old
telnet doesn't support Linemode; type ``^]mo ch'' to fix it. Also send
complaints about the incompatibilities to dab@cray.com.) If the
connection hangs for more than a second or produces weird results,
you're probably out of luck; pty's author would appreciate hearing about
your experiences.

If all goes well (whew!) you can log in normally, just as if you're
connected to the old telnetd. Once you're in a shell, try using the pty
utilities, as if you were under sess. You should find that the commands
fail unless you're root, because that session was started by root rather
than you. (This points out a failure in the telnetd-login-utmp model.)
To gain control of the session, type ``sessuser'' and pray. If nothing
goes wrong, you can then disconnect the session, set up a reconnect to
another one, use sessname and sesslist, etc. Yahoo! Tell your users!
Replace your old telnetd with the new one! Add sessuser to the default
.cshrc! And please send a note to brnstnd@nyu.edu about your success.


Note that many popular versions of login use an annoying heuristic to
save a few microseconds in updating /etc/utmp. The result is, first,
that there's a race condition that can break down /etc/utmp on heavily
loaded machines; and second, that login and pty have different views of
/etc/utmp. For this reason, pty is invoked with -xR to search for ptys
in order. You may even want to make -xR default (by setting flagxrandom
to 0 in pty's globals.c). Sigh.
