1 # $FreeBSD: src/usr.bin/telnet/README,v 1.1.1.2.6.1 2001/03/04 09:10:39 kris Exp $
3 This is a distribution of both client and server telnet. These programs
12 Solaris 2.4 x x (no linemode in server)
13 SunOs 4.1.4 X X (no linemode in server)
14 Ultrix 4.3 X X (no linemode in server)
15 Ultrix 4.1 X X (no linemode in server)
17 In addition, previous versions have been compiled on the following
18 machines, but were not available for testing this version.
24 SunOs 4.0.3c X X (no linemode in server)
25 4.3 BSD X X (no linemode in server)
26 DYNIX V3.0.12 X X (no linemode in server)
27 Ultrix 3.1 X X (no linemode in server)
28 Ultrix 4.0 X X (no linemode in server)
29 SunOs 3.5 X X (no linemode in server)
30 SunOs 4.1.3 X X (no linemode in server)
31 Solaris 2.2 x x (no linemode in server)
32 Solaris 2.3 x x (no linemode in server)
35 DYNIX V3.0.17.9 X X (no linemode in server)
36 HP-UX 8.0 x x (no linemode in server)
38 This code should work, but there are no guarantees.
42 This release represents what is on the 4.4BSD-Lite2 release, which
43 should be the final BSD release. I will continue to support of
44 telnet, The code (without encryption) is available via anonymous ftp
45 from ftp.cray.com, in src/telnet/telnet.YY.MM.DD.NE.tar.Z, where
46 YY.MM.DD is replaced with the year, month and day of the release.
47 If you can't find it at one of these places, at some point in the
48 near future information about the latest releases should be available
51 In addition, the version with the encryption code is available via
52 ftp from net-dist.mit.edu, in the directory /pub/telnet. There
53 is a README file there that gives further information on how
54 to get the distribution.
56 Questions, comments, bug reports and bug fixes can be sent to
57 one of these addresses:
62 This release is mainly bug fixes and code cleanup.
64 Replace all calls to bcopy()/bzero() with calls to
65 memmove()/memset() and all calls to index()/rindex()
66 with calls to strchr()/strrchr().
68 Add some missing diagnostics for option tracing
71 Add support for BSDI 2.0 and Solaris 2.4.
73 Add support for UNICOS 8.0
75 Get rid of expanded tabs and trailing white spaces.
78 Fix for telnet going into an endless spin
79 when the session dies abnormally.
82 Changes to allow telnet to compile
86 makeutx() doesn't expand utmpx,
87 use pututxline() instead.
90 Add a sleep(1) before execing login
91 to avoid race condition that can eat
93 Use terminal speed directly if it is
97 Fix to realloc() call. Fix for execing
98 login on solaris with no user name.
102 This is a list of some of the changes since the last tar release
103 of telnet/telnetd. There are probably other changes that aren't
104 listed here, but this should hit a lot of the main ones.
107 Changed #define for AUTHENTICATE to AUTHENTICATION
108 Changed #define for ENCRYPT to ENCRYPTION
109 Changed #define for DES_ENCRYPT to DES_ENCRYPTION
111 Added support for SPX authentication: -DSPX
113 Added support for Kerberos Version 5 authentication: -DKRB5
115 Added support for ANSI C function prototypes
117 Added support for the NEW-ENVIRON option (RFC-1572)
118 including support for USERVAR.
120 Made support for the old Environment Option (RFC-1408)
121 conditional on -DOLD_ENVIRON
123 Added #define ENV_HACK - support for RFC 1571
125 The encryption code is removed from the public distributions.
126 Domestic 4.4 BSD distributions contain the encryption code.
128 ENV_HACK: Code to deal with systems that only implement
129 the old ENVIRON option, and have reversed definitions
130 of ENV_VAR and ENV_VAL. Also fixes ENV processing in
131 client to handle things besides just the default set...
133 NO_BSD_SETJMP: UNICOS configuration for
134 UNICOS 6.1/6.0/5.1/5.0 systems.
136 STREAMSPTY: Use /dev/ptmx to get a clean pty. This
137 is for SVr4 derivatives (Like Solaris)
139 UTMPX: For systems that have /etc/utmpx. This is for
140 SVr4 derivatives (Like Solaris)
142 Definitions for BSDI 1.0
144 Definitions for 4.3 Reno and 4.4 BSD.
146 Definitions for UNICOS 8.0 and UNICOS 7.C
148 Definitions for Solaris 2.0
150 Definitions for HP-UX 8.0
152 Latest Copyright notices from Berkeley.
154 FLOW-CONTROL: support for RFC-XXXx
159 Fix the "send" command to not send garbage...
161 Fix status message for "skiprc"
163 Make sure to send NAWS after telnet has been suspended
164 or an external command has been run, if the window size
171 Support flowcontrol option in non-linemode servers.
173 -k Server supports Kludge Linemode, but will default to
174 either single character mode or real Linemode support.
175 The user will have to explicitly ask to switch into
176 kludge linemode. ("stty extproc", or escape back to
177 to telnet and say "mode line".)
179 -u Specify the length of the hostname field in the utmp
180 file. Hostname longer than this length will be put
181 into the utmp file in dotted decimal notation, rather
182 than putting in a truncated hostname.
184 -U Registered hosts only. If a reverse hostname lookup
185 fails, the connection will be refused.
188 Allows forwarding of credentials for KRB5.
194 This version of telnet/telnetd has support for both
195 the AUTHENTICATION and ENCRYPTION options. The
196 AUTHENTICATION option is fairly well defined, and
197 an option number has been assigned to it. The
198 ENCRYPTION option is still in a state of flux; an
199 option number has been assigned to, but it is still
200 subject to change. The code is provided in this release
201 for experimental and testing purposes.
203 The telnet "send" command can now be used to send
204 do/dont/will/wont commands, with any telnet option
205 name. The rules for when do/dont/will/wont are sent
206 are still followed, so just because the user requests
207 that one of these be sent doesn't mean that it will
210 The telnet "getstatus" command no longer requires
211 that option printing be enabled to see the response
212 to the "DO STATUS" command.
214 A -n flag has been added to telnetd to disable
217 A new telnet command, "auth" has been added (if
218 AUTHENTICATE is defined). It has four sub-commands,
219 "status", "disable", "enable" and "help".
221 A new telnet command, "encrypt" has been added (if
222 ENCRYPT is defined). It has many sub-commands:
223 "enable", "type", "start", "stop", "input",
224 "-input", "output", "-output", "status", and "help".
226 The LOGOUT option is now supported by both telnet
227 and telnetd, a new command, "logout", was added
230 Several new toggle options were added:
231 "autoencrypt", "autodecrypt", "autologin", "authdebug",
232 "encdebug", "skiprc", "verbose_encrypt"
234 An "rlogin" interface has been added. If the program
235 is named "rlogin", or the "-r" flag is given, then
236 an rlogin type of interface will be used.
237 ~. Terminates the session
238 ~<susp> Suspend the session
239 ~^] Escape to telnet command mode
240 ~~ Pass through the ~.
241 BUG: If you type the rlogin escape character
242 in the middle of a line while in rlogin
243 mode, you cannot erase it or any characters
244 before it. Hopefully this can be fixed
245 in a future release...
249 A "libtelnet.a" has now been created. This libraray
250 contains code that is common to both telnet and
251 telnetd. This is also where library routines that
252 are needed, but are not in the standard C library,
255 The makefiles have been re-done. All of the site
256 specific configuration information has now been put
257 into a single "Config.generic" file, in the top level
258 directory. Changing this one file will take care of
259 all three subdirectories. Also, to add a new/local
260 definition, a "Config.local" file may be created
261 at the top level; if that file exists, the subdirectories
262 will use that file instead of "Config.generic".
264 Many 1-2 line functions in commands.c have been
265 removed, and just inserted in-line, or replaced
270 The non-termio code in both telnet and telnetd was
271 setting/clearing CTLECH in the sg_flags word. This
272 was incorrect, and has been changed to set/clear the
273 LCTLECH bit in the local mode word.
275 The SRCRT #define has been removed. If IP_OPTIONS
276 and IPPROTO_IP are defined on the system, then the
277 source route code is automatically enabled.
279 The NO_GETTYTAB #define has been removed; there
280 is a compatibility routine that can be built into
281 libtelnet to achive the same results.
283 The server, telnetd, has been switched to use getopt()
284 for parsing the argument list.
286 The code for getting the input/output speeds via
287 cfgetispeed()/cfgetospeed() was still not quite
288 right in telnet. Posix says if the ispeed is 0,
289 then it is really equal to the ospeed.
291 The suboption processing code in telnet now has
292 explicit checks to make sure that we received
293 the entire suboption (telnetd was already doing this).
295 The telnet code for processing the terminal type
296 could cause a core dump if an existing connection
297 was closed, and a new connection opened without
300 Telnetd was doing a TCSADRAIN when setting the new
301 terminal settings; This is not good, because it means
302 that the tcsetattr() will hang waiting for output to
303 drain, and telnetd is the only one that will drain
304 the output... The fix is to use TCSANOW which does
307 Telnetd was improperly setting/clearing the ISTRIP
308 flag in the c_lflag field, it should be using the
311 When the child process of telnetd was opening the
312 slave side of the pty, it was re-setting the EXTPROC
313 bit too early, and some of the other initialization
314 code was wiping it out. This would cause telnetd
315 to go out of linemode and into single character mode.
317 One instance of leaving linemode in telnetd forgot
318 to send a WILL ECHO to the client, the net result
319 would be that the user would see double character
322 If the MODE was being changed several times very
323 quickly, telnetd could get out of sync with the
324 state changes and the returning acks; and wind up
325 being left in the wrong state.
329 Switch the client to use getopt() for parsing the
330 argument list. The 4.3Reno getopt.c is included for
331 systems that don't have getopt().
333 Use the posix _POSIX_VDISABLE value for what value
334 to use when disabling special characters. If this
335 is undefined, it defaults to 0x3ff.
337 For non-termio systems, TIOCSETP was being used to
338 change the state of the terminal. This causes the
339 input queue to be flushed, which we don't want. This
340 is now changed to TIOCSETN.
342 Take out the "#ifdef notdef" around the code in the
343 server that generates a "sync" when the pty oputput
344 is flushed. The potential problem is that some older
345 telnet clients may go into an infinate loop when they
346 receive a "sync", if so, the server can be compiled
347 with "NO_URGENT" defined.
349 Fix the client where it was setting/clearing the OPOST
350 bit in the c_lflag field, not the c_oflag field.
352 Fix the client where it was setting/clearing the ISTRIP
353 bit in the c_lflag field, not the c_iflag field. (On
354 4.3Reno, this is the ECHOPRT bit in the c_lflag field.)
355 The client also had its interpretation of WILL BINARY
356 and DO BINARY reversed.
358 Fix a bug in client that would cause a core dump when
359 attempting to remove the last environment variable.
361 In the client, there were a few places were switch()
362 was being passed a character, and if it was a negative
363 value, it could get sign extended, and not match
364 the 8 bit case statements. The fix is to and the
365 switch value with 0xff.
367 Add a couple more printoption() calls in the client, I
368 don't think there are any more places were a telnet
369 command can be received and not printed out when
372 A new flag has been added to the client, "-a". Currently,
373 this just causes the USER name to be sent across, in
374 the future this may be used to signify that automatic
375 authentication is requested.
377 The USER variable is now only sent by the client if
378 the "-a" or "-l user" options are explicity used, or
379 if the user explicitly asks for the "USER" environment
380 variable to be exported. In the server, if it receives
381 the "USER" environment variable, it won't print out the
382 banner message, so that only "Password:" will be printed.
383 This makes the symantics more like rlogin, and should be
384 more familiar to the user. (People are not used to
385 getting a banner message, and then getting just a
388 Re-vamp the code for starting up the child login
389 process. The code was getting ugly, and it was
390 hard to tell what was really going on. What we
391 do now is after the fork(), in the child:
392 1) make sure we have no controlling tty
393 2) open and initialize the tty
394 3) do a setsid()/setpgrp()
395 4) makes the tty our controlling tty.
396 On some systems, #2 makes the tty our controlling
397 tty, and #4 is a no-op. The parent process does
398 a gets rid of any controlling tty after the child
401 Use the strdup() library routine in telnet, instead
402 of the local savestr() routine. If you don't have
403 strdup(), you need to define NO_STRDUP.
405 Add support for ^T (SIGINFO/VSTATUS), found in the
406 4.3Reno distribution. This maps to the AYT character.
407 You need a 4-line bugfix in the kernel to get this
410 > *** tty_pty.c.ORG Tue Sep 11 09:41:53 1990
411 > --- tty_pty.c Tue Sep 11 17:48:03 1990
414 > if ((tp->t_lflag&NOFLSH) == 0)
415 > ttyflush(tp, FREAD|FWRITE);
416 > ! pgsignal(tp->t_pgrp, *(unsigned int *)data);
420 > if ((tp->t_lflag&NOFLSH) == 0)
421 > ttyflush(tp, FREAD|FWRITE);
422 > ! pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
423 > ! if ((*(unsigned int *)data == SIGINFO) &&
424 > ! ((tp->t_lflag&NOKERNINFO) == 0))
429 The client is now smarter when setting the telnet escape
430 character; it only sets it to one of VEOL and VEOL2 if
431 one of them is undefined, and the other one is not already
432 defined to the telnet escape character.
434 Handle TERMIOS systems that have separate input and output
435 line speed settings imbedded in the flags.
437 Many other minor bug fixes.
440 Re-organize makefiles and source tree. The telnet/Source
441 directory is now gone, and all the source that was in
442 telnet/Source is now just in the telnet directory.
444 Separate makefile for each system are now gone. There
445 are two makefiles, Makefile and Makefile.generic.
446 The "Makefile" has the definitions for the various
447 system, and "Makefile.generic" does all the work.
448 There is a variable called "WHAT" that is used to
449 specify what to make. For example, in the telnet
450 directory, you might say:
451 make 4.4bsd WHAT=clean
452 to clean out the directory.
454 Add support for the ENVIRON and XDISPLOC options.
455 In order for the server to work, login has to have
456 the "-p" option to preserve environment variables.
458 Add the SOFT_TAB and LIT_ECHO modes in the LINEMODE support.
460 Add the "-l user" option to command line and open command
461 (This is passed through the ENVIRON option).
463 Add the "-e" command line option, for setting the escape
466 Add the "-D", diagnostic, option to the server. This allows
467 the server to print out debug information, which is very
468 useful when trying to debug a telnet that doesn't have any
471 Turn off the literal next character when not in LINEMODE.
473 Don't recognize ^Y locally, just pass it through.
475 Make minor modifications for Sun4.0 and Sun4.1
477 Add support for both FORW1 and FORW2 characters. The
478 telnet escpape character is set to whichever of the
479 two is not being used. If both are in use, the escape
480 character is not set, so when in linemode the user will
481 have to follow the escape character with a <CR> or <EOF)
482 to get it passed through.
484 Commands can now be put in single and double quotes, and
485 a backslash is now an escape character. This is needed
486 for allowing arbitrary strings to be assigned to environment
489 Switch telnetd to use macros like telnet for keeping
490 track of the state of all the options.
492 Fix telnetd's processing of options so that we always do
493 the right processing of the LINEMODE option, regardless
494 of who initiates the request to turn it on. Also, make
495 sure that if the other side went "WILL ECHO" in response
496 to our "DO ECHO", that we send a "DONT ECHO" to get the
497 option turned back off!
499 Fix the TERMIOS setting of the terminal speed to handle both
500 BSD's separate fields, and the SYSV method of CBAUD bits.
502 Change how we deal with the other side refusing to enable
503 an option. The sequence used to be: send DO option; receive
504 WONT option; send DONT option. Now, the sequence is: send
505 DO option; receive WONT option. Both should be valid
506 according to the spec, but there has been at least one
507 client implementation of telnet identified that can get
508 really confused by this. (The exact sequence, from a trace
509 on the server side, is (numbers are number of responses that
510 we expect to get after that line...):
512 send WILL ECHO 1 (initial request)
513 send WONT ECHO 2 (server is changing state)
514 recv DO ECHO 1 (first reply, ok. expect DONT ECHO next)
515 send WILL ECHO 2 (server changes state again)
516 recv DONT ECHO 1 (second reply, ok. expect DO ECHO next)
517 recv DONT ECHO 0 (third reply, wrong answer. got DONT!!!)
518 *** send WONT ECHO (send WONT to acknowledge the DONT)
519 send WILL ECHO 1 (ask again to enable option)
527 (and the last 5 lines loop forever)
529 The line with the "***" is last of the WILL/DONT/WONT sequence.
530 The change to the server to not generate that makes this same
542 There is other option negotiation going on, and not sending
543 the third part changes some of the timings, but this specific
544 example no longer gets stuck in a loop. The "telnet.state"
545 file has been modified to reflect this change to the algorithm.
547 A bunch of miscellaneous bug fixes and changes to make
550 This version of telnet also has some KERBEROS stuff in
551 it. This has not been tested, it uses an un-authorized
552 telnet option number, and uses an out-of-date version
553 of the (still being defined) AUTHENTICATION option.
554 There is no support for this code, do not enable it.
558 CHANGES/BUGFIXES SINCE LAST RELEASE:
559 Some support for IP TOS has been added. Requires that the
560 kernel support the IP_TOS socket option (currently this
561 is only in UNICOS 6.0).
563 Both telnet and telnetd now use the cc_t typedef. typedefs are
564 included for systems that don't have it (in termios.h).
566 SLC_SUSP was not supported properly before. It is now.
568 IAC EOF was not translated properly in telnetd for SYSV_TERMIO
569 when not in linemode. It now saves a copy of the VEOF character,
570 so that when ICANON is turned off and we can't trust it anymore
571 (because it is now the VMIN character) we use the saved value.
573 There were two missing "break" commands in the linemode
574 processing code in telnetd.
576 Telnetd wasn't setting the kernel window size information
577 properly. It was using the rows for both rows and columns...
579 Questions/comments go to
586 README: You are reading it.
589 This file contains all the OS specific definitions. It
590 has pre-definitions for many common system types, and is
591 in standard makefile fromat. See the comments at the top
592 of the file for more information.
595 This is not part of the distribution, but if this file exists,
596 it is used instead of "Config.generic". This allows site
597 specific configuration without having to modify the distributed
598 "Config.generic" file.
601 This file contains the diffs for the changes needed for the
602 kernel to support LINEMODE is the server. These changes are
603 for a 4.3BSD system. You may need to make some changes for
604 your particular system.
606 There is a new bit in the terminal state word, TS_EXTPROC.
607 When this bit is set, several aspects of the terminal driver
608 are disabled. Input line editing, character echo, and
609 mapping of signals are all disabled. This allows the telnetd
610 to turn of these functions when in linemode, but still keep
611 track of what state the user wants the terminal to be in.
615 TIOCEXT Turn on/off the TS_EXTPROC bit
616 TIOCGSTATE Get t_state of tty to look at TS_EXTPROC bit
617 TIOCSIG Generate a signal to processes in the
618 current process group of the pty.
620 There is a new mode for packet driver, the TIOCPKT_IOCTL bit.
621 When packet mode is turned on in the pty, and the TS_EXTPROC
622 bit is set, then whenever the state of the pty is changed, the
623 next read on the master side of the pty will have the TIOCPKT_IOCTL
624 bit set, and the data will contain the following:
632 This allows the process on the server side of the pty to know
633 when the state of the terminal has changed, and what the new
636 However, if you define USE_TERMIO or SYSV_TERMIO, the code will
637 expect that the structure returned in the TIOCPKT_IOCTL is
638 the termio/termios structure.
641 This file contains the changes needed for the stty(1) program
642 to report on the current status of the TS_EXTPROC bit. It also
643 allows the user to turn on/off the TS_EXTPROC bit. This is useful
644 because it allows the user to say "stty -extproc", and the
645 LINEMODE option will be automatically disabled, and saying "stty
646 extproc" will re-enable the LINEMODE option.
649 Both the client and server have code in them to deal
650 with option negotiation loops. The algorithm that is
651 used is described in this file.
654 This directory contains the client code. No kernel changes are
655 needed to use this code.
658 This directory contains the server code. If LINEMODE or KLUDGELINEMODE
659 are defined, then the kernel modifications listed above are needed.
662 This directory contains code that is common to both the client
666 This directory has a new <arpa/telnet.h>
668 libtelnet/Makefile.4.4:
670 telnetd/Makefile.4.4:
671 These are the makefiles that can be used on a 4.3Reno
672 system when this software is installed in /usr/src/lib/libtelnet,
673 /usr/src/libexec/telnetd, and /usr/src/usr.bin/telnet.
676 The following TELNET options are supported:
679 The LINEMODE option is supported as per RFC1116. The
680 FORWARDMASK option is not currently supported.
682 BINARY: The client has the ability to turn on/off the BINARY
683 option in each direction. Turning on BINARY from
684 server to client causes the LITOUT bit to get set in
685 the terminal driver on both ends, turning on BINARY
686 from the client to the server causes the PASS8 bit
687 to get set in the terminal driver on both ends.
690 This is supported as per RFC1091. On the server side,
691 when a terminal type is received, termcap/terminfo
692 is consulted to determine if it is a known terminal
693 type. It keeps requesting terminal types until it
694 gets one that it recongnizes, or hits the end of the
695 list. The server side looks up the entry in the
696 termcap/terminfo data base, and generates a list of
697 names which it then passes one at a time to each
698 request for a terminal type, duplicating the last
699 entry in the list before cycling back to the beginning.
701 NAWS: The Negotiate about Window Size, as per RFC 1073.
704 Implemented as per RFC 1079
707 Implemented as per RFC 1080
716 LOGOUT: As per RFC 727
719 The server will send its current status upon
720 request. It does not ask for the clients status.
721 The client will request the servers current status
722 from the "send getstatus" command.
725 This option is currently being defined by the IETF
726 Telnet Working Group, and an RFC has not yet been
727 issued, but should be in the near future...
730 This functionality can be done through the ENVIRON
731 option, it is added here for completeness.
734 This option is currently being defined by the IETF
735 Telnet Working Group, and an RFC has not yet been
736 issued. The basic framework is pretty much decided,
737 but the definitions for the specific authentication
738 schemes is still in a state of flux.
741 This option is currently being defined by the IETF
742 Telnet Working Group, and an RFC has not yet been
743 issued. The draft RFC is still in a state of flux,
744 so this code may change in the future.