Annotation of src/usr.bin/telnet/README, Revision 1.1
1.1 ! deraadt 1:
! 2:
! 3: This is a distribution of both client and server telnet. These programs
! 4: have been compiled on:
! 5: telnet telnetd
! 6: BSD 4.3 Reno X X
! 7: UNICOS 5.1 X X
! 8: UNICOS 6.0 X X
! 9: UNICOS 6.1 X X
! 10: UNICOS 7.0 X X
! 11: SunOs 3.5 X X (no linemode in server)
! 12: SunOs 4.1 X X (no linemode in server)
! 13: DYNIX V3.0.17.9 X X (no linemode in server)
! 14: Ultrix 3.1 X X (no linemode in server)
! 15: Ultrix 4.0 X X (no linemode in server)
! 16:
! 17: In addition, previous versions have been compiled on the following
! 18: machines, but were not available for testing this version.
! 19: telnet telnetd
! 20: SunOs 4.0.3c X X (no linemode in server)
! 21: BSD 4.3 X X (no linemode in server)
! 22: DYNIX V3.0.12 X X (no linemode in server)
! 23:
! 24: Februrary 22, 1991:
! 25:
! 26: Features:
! 27:
! 28: This version of telnet/telnetd has support for both
! 29: the AUTHENTICATION and ENCRYPTION options. The
! 30: AUTHENTICATION option is fairly well defined, and
! 31: an option number has been assigned to it. The
! 32: ENCRYPTION option is still in a state of flux; an
! 33: option number has NOT been assigned to it yet.
! 34: The code is provided in this release for experimental
! 35: and testing purposes.
! 36:
! 37: The telnet "send" command can now be used to send
! 38: do/dont/will/wont commands, with any telnet option
! 39: name. The rules for when do/dont/will/wont are sent
! 40: are still followed, so just because the user requests
! 41: that one of these be sent doesn't mean that it will
! 42: be sent...
! 43:
! 44: The telnet "getstatus" command no longer requires
! 45: that option printing be enabled to see the response
! 46: to the "DO STATUS" command.
! 47:
! 48: A -n flag has been added to telnetd to disable
! 49: keepalives.
! 50:
! 51: A new telnet command, "auth" has been added (if
! 52: AUTHENTICATE is defined). It has four sub-commands,
! 53: "status", "debug", "disable", "enable" and "help".
! 54:
! 55: A new telnet command, "encrypt" has been added (if
! 56: ENCRYPT is defined). It has many sub-commands:
! 57: "enable", "type", "start", "stop", "input",
! 58: "-input", "output", "-output", "status", "auto",
! 59: "verbose", "debug", and "help".
! 60:
! 61: An "rlogin" interface has been added. If the program
! 62: is named "rlogin", or the "-r" flag is given, then
! 63: an rlogin type of interface will be used.
! 64: ~. Terminates the session
! 65: ~<susp> Suspend the session
! 66: ~^] Escape to telnet command mode
! 67: ~~ Pass through the ~.
! 68: BUG: If you type the rlogin escape character
! 69: in the middle of a line while in rlogin
! 70: mode, you cannot erase it or any characters
! 71: before it. Hopefully this can be fixed
! 72: in a future release...
! 73:
! 74: General changes:
! 75:
! 76: A "libtelnet.a" has now been created. This libraray
! 77: contains code that is common to both telnet and
! 78: telnetd. This is also where library routines that
! 79: are needed, but are not in the standard C library,
! 80: are placed.
! 81:
! 82: The makefiles have been re-done. All of the site
! 83: specific configuration information has now been put
! 84: into a single "Config.generic" file, in the top level
! 85: directory. Changing this one file will take care of
! 86: all three subdirectories. Also, to add a new/local
! 87: definition, a "Config.local" file may be created
! 88: at the top level; if that file exists, the subdirectories
! 89: will use that file instead of "Config.generic".
! 90:
! 91: Many 1-2 line functions in commands.c have been
! 92: removed, and just inserted in-line, or replaced
! 93: with a macro.
! 94:
! 95: Bug Fixes:
! 96:
! 97: The non-termio code in both telnet and telnetd was
! 98: setting/clearing CTLECH in the sg_flags word. This
! 99: was incorrect, and has been changed to set/clear the
! 100: LCTLECH bit in the local mode word.
! 101:
! 102: The SRCRT #define has been removed. If IP_OPTIONS
! 103: and IPPROTO_IP are defined on the system, then the
! 104: source route code is automatically enabled.
! 105:
! 106: The NO_GETTYTAB #define has been removed; there
! 107: is a compatability routine that can be built into
! 108: libtelnet to achive the same results.
! 109:
! 110: The server, telnetd, has been switched to use getopt()
! 111: for parsing the argument list.
! 112:
! 113: The code for getting the input/output speeds via
! 114: cfgetispeed()/cfgetospeed() was still not quite
! 115: right in telnet. Posix says if the ispeed is 0,
! 116: then it is really equal to the ospeed.
! 117:
! 118: The suboption processing code in telnet now has
! 119: explicit checks to make sure that we received
! 120: the entire suboption (telnetd was already doing this).
! 121:
! 122: The telnet code for processing the terminal type
! 123: could cause a core dump if an existing connection
! 124: was closed, and a new connection opened without
! 125: exiting telnet.
! 126:
! 127: Telnetd was doing a TCSADRAIN when setting the new
! 128: terminal settings; This is not good, because it means
! 129: that the tcsetattr() will hang waiting for output to
! 130: drain, and telnetd is the only one that will drain
! 131: the output... The fix is to use TCSANOW which does
! 132: not wait.
! 133:
! 134: Telnetd was improperly setting/clearing the ISTRIP
! 135: flag in the c_lflag field, it should be using the
! 136: c_iflag field.
! 137:
! 138: When the child process of telnetd was opening the
! 139: slave side of the pty, it was re-setting the EXTPROC
! 140: bit too early, and some of the other initialization
! 141: code was wiping it out. This would cause telnetd
! 142: to go out of linemode and into single character mode.
! 143:
! 144: One instance of leaving linemode in telnetd forgot
! 145: to send a WILL ECHO to the client, the net result
! 146: would be that the user would see double character
! 147: echo.
! 148:
! 149: If the MODE was being changed several times very
! 150: quickly, telnetd could get out of sync with the
! 151: state changes and the returning acks; and wind up
! 152: being left in the wrong state.
! 153:
! 154: September 14, 1990:
! 155:
! 156: Switch the client to use getopt() for parsing the
! 157: argument list. The 4.3Reno getopt.c is included for
! 158: systems that don't have getopt().
! 159:
! 160: Use the posix _POSIX_VDISABLE value for what value
! 161: to use when disabling special characters. If this
! 162: is undefined, it defaults to 0x3ff.
! 163:
! 164: For non-termio systems, TIOCSETP was being used to
! 165: change the state of the terminal. This causes the
! 166: input queue to be flushed, which we don't want. This
! 167: is now changed to TIOCSETN.
! 168:
! 169: Take out the "#ifdef notdef" around the code in the
! 170: server that generates a "sync" when the pty oputput
! 171: is flushed. The potential problem is that some older
! 172: telnet clients may go into an infinate loop when they
! 173: receive a "sync", if so, the server can be compiled
! 174: with "NO_URGENT" defined.
! 175:
! 176: Fix the client where it was setting/clearing the OPOST
! 177: bit in the c_lflag field, not the c_oflag field.
! 178:
! 179: Fix the client where it was setting/clearing the ISTRIP
! 180: bit in the c_lflag field, not the c_iflag field. (On
! 181: 4.3Reno, this is the ECHOPRT bit in the c_lflag field.)
! 182: The client also had its interpretation of WILL BINARY
! 183: and DO BINARY reversed.
! 184:
! 185: Fix a bug in client that would cause a core dump when
! 186: attempting to remove the last environment variable.
! 187:
! 188: In the client, there were a few places were switch()
! 189: was being passed a character, and if it was a negative
! 190: value, it could get sign extended, and not match
! 191: the 8 bit case statements. The fix is to and the
! 192: switch value with 0xff.
! 193:
! 194: Add a couple more printoption() calls in the client, I
! 195: don't think there are any more places were a telnet
! 196: command can be received and not printed out when
! 197: "options" is on.
! 198:
! 199: A new flag has been added to the client, "-a". Currently,
! 200: this just causes the USER name to be sent across, in
! 201: the future this may be used to signify that automatic
! 202: authentication is requested.
! 203:
! 204: The USER variable is now only sent by the client if
! 205: the "-a" or "-l user" options are explicity used, or
! 206: if the user explicitly asks for the "USER" environment
! 207: variable to be exported. In the server, if it receives
! 208: the "USER" environment variable, it won't print out the
! 209: banner message, so that only "Password:" will be printed.
! 210: This makes the symantics more like rlogin, and should be
! 211: more familiar to the user. (People are not used to
! 212: getting a banner message, and then getting just a
! 213: "Password:" prompt.)
! 214:
! 215: Re-vamp the code for starting up the child login
! 216: process. The code was getting ugly, and it was
! 217: hard to tell what was really going on. What we
! 218: do now is after the fork(), in the child:
! 219: 1) make sure we have no controlling tty
! 220: 2) open and initialize the tty
! 221: 3) do a setsid()/setpgrp()
! 222: 4) makes the tty our controlling tty.
! 223: On some systems, #2 makes the tty our controlling
! 224: tty, and #4 is a no-op. The parent process does
! 225: a gets rid of any controlling tty after the child
! 226: is fork()ed.
! 227:
! 228: Use the strdup() library routine in telnet, instead
! 229: of the local savestr() routine. If you don't have
! 230: strdup(), you need to define NO_STRDUP.
! 231:
! 232: Add support for ^T (SIGINFO/VSTATUS), found in the
! 233: 4.3Reno distribution. This maps to the AYT character.
! 234: You need a 4-line bugfix in the kernel to get this
! 235: to work properly:
! 236:
! 237: > *** tty_pty.c.ORG Tue Sep 11 09:41:53 1990
! 238: > --- tty_pty.c Tue Sep 11 17:48:03 1990
! 239: > ***************
! 240: > *** 609,613 ****
! 241: > if ((tp->t_lflag&NOFLSH) == 0)
! 242: > ttyflush(tp, FREAD|FWRITE);
! 243: > ! pgsignal(tp->t_pgrp, *(unsigned int *)data);
! 244: > return(0);
! 245: > }
! 246: > --- 609,616 ----
! 247: > if ((tp->t_lflag&NOFLSH) == 0)
! 248: > ttyflush(tp, FREAD|FWRITE);
! 249: > ! pgsignal(tp->t_pgrp, *(unsigned int *)data, 1);
! 250: > ! if ((*(unsigned int *)data == SIGINFO) &&
! 251: > ! ((tp->t_lflag&NOKERNINFO) == 0))
! 252: > ! ttyinfo(tp);
! 253: > return(0);
! 254: > }
! 255:
! 256: The client is now smarter when setting the telnet escape
! 257: character; it only sets it to one of VEOL and VEOL2 if
! 258: one of them is undefined, and the other one is not already
! 259: defined to the telnet escape character.
! 260:
! 261: Handle TERMIOS systems that have seperate input and output
! 262: line speed settings imbedded in the flags.
! 263:
! 264: Many other minor bug fixes.
! 265:
! 266: June 20, 1990:
! 267: Re-organize makefiles and source tree. The telnet/Source
! 268: directory is now gone, and all the source that was in
! 269: telnet/Source is now just in the telnet directory.
! 270:
! 271: Seperate makefile for each system are now gone. There
! 272: are two makefiles, Makefile and Makefile.generic.
! 273: The "Makefile" has the definitions for the various
! 274: system, and "Makefile.generic" does all the work.
! 275: There is a variable called "WHAT" that is used to
! 276: specify what to make. For example, in the telnet
! 277: directory, you might say:
! 278: make 4.4bsd WHAT=clean
! 279: to clean out the directory.
! 280:
! 281: Add support for the ENVIRON and XDISPLOC options.
! 282: In order for the server to work, login has to have
! 283: the "-p" option to preserve environment variables.
! 284:
! 285: Add the SOFT_TAB and LIT_ECHO modes in the LINEMODE support.
! 286:
! 287: Add the "-l user" option to command line and open command
! 288: (This is passed through the ENVIRON option).
! 289:
! 290: Add the "-e" command line option, for setting the escape
! 291: character.
! 292:
! 293: Add the "-D", diagnostic, option to the server. This allows
! 294: the server to print out debug information, which is very
! 295: useful when trying to debug a telnet that doesn't have any
! 296: debugging ability.
! 297:
! 298: Turn off the literal next character when not in LINEMODE.
! 299:
! 300: Don't recognize ^Y locally, just pass it through.
! 301:
! 302: Make minor modifications for Sun4.0 and Sun4.1
! 303:
! 304: Add support for both FORW1 and FORW2 characters. The
! 305: telnet escpape character is set to whichever of the
! 306: two is not being used. If both are in use, the escape
! 307: character is not set, so when in linemode the user will
! 308: have to follow the escape character with a <CR> or <EOF)
! 309: to get it passed through.
! 310:
! 311: Commands can now be put in single and double quotes, and
! 312: a backslash is now an escape character. This is needed
! 313: for allowing arbitrary strings to be assigned to environment
! 314: variables.
! 315:
! 316: Switch telnetd to use macros like telnet for keeping
! 317: track of the state of all the options.
! 318:
! 319: Fix telnetd's processing of options so that we always do
! 320: the right processing of the LINEMODE option, regardless
! 321: of who initiates the request to turn it on. Also, make
! 322: sure that if the other side went "WILL ECHO" in response
! 323: to our "DO ECHO", that we send a "DONT ECHO" to get the
! 324: option turned back off!
! 325:
! 326: Fix the TERMIOS setting of the terminal speed to handle both
! 327: BSD's seperate fields, and the SYSV method of CBAUD bits.
! 328:
! 329: Change how we deal with the other side refusing to enable
! 330: an option. The sequence used to be: send DO option; receive
! 331: WONT option; send DONT option. Now, the sequence is: send
! 332: DO option; receive WONT option. Both should be valid
! 333: according to the spec, but there has been at least one
! 334: client implementation of telnet identified that can get
! 335: really confused by this. (The exact sequence, from a trace
! 336: on the server side, is (numbers are number of responses that
! 337: we expect to get after that line...):
! 338:
! 339: send WILL ECHO 1 (initial request)
! 340: send WONT ECHO 2 (server is changing state)
! 341: recv DO ECHO 1 (first reply, ok. expect DONT ECHO next)
! 342: send WILL ECHO 2 (server changes state again)
! 343: recv DONT ECHO 1 (second reply, ok. expect DO ECHO next)
! 344: recv DONT ECHO 0 (third reply, wrong answer. got DONT!!!)
! 345: *** send WONT ECHO (send WONT to acknowledge the DONT)
! 346: send WILL ECHO 1 (ask again to enable option)
! 347: recv DO ECHO 0
! 348:
! 349: recv DONT ECHO 0
! 350: send WONT ECHO 1
! 351: recv DONT ECHO 0
! 352: recv DO ECHO 1
! 353: send WILL ECHO 0
! 354: (and the last 5 lines loop forever)
! 355:
! 356: The line with the "***" is last of the WILL/DONT/WONT sequence.
! 357: The change to the server to not generate that makes this same
! 358: example become:
! 359:
! 360: send will ECHO 1
! 361: send wont ECHO 2
! 362: recv do ECHO 1
! 363: send will ECHO 2
! 364: recv dont ECHO 1
! 365: recv dont ECHO 0
! 366: recv do ECHO 1
! 367: send will ECHO 0
! 368:
! 369: There is other option negotiation going on, and not sending
! 370: the third part changes some of the timings, but this specific
! 371: example no longer gets stuck in a loop. The "telnet.state"
! 372: file has been modified to reflect this change to the algorithm.
! 373:
! 374: A bunch of miscellaneous bug fixes and changes to make
! 375: lint happier.
! 376:
! 377: This version of telnet also has some KERBEROS stuff in
! 378: it. This has not been tested, it uses an un-authorized
! 379: telnet option number, and uses an out-of-date version
! 380: of the (still being defined) AUTHENTICATION option.
! 381: There is no support for this code, do not enable it.
! 382:
! 383:
! 384: March 1, 1990:
! 385: CHANGES/BUGFIXES SINCE LAST RELEASE:
! 386: Some support for IP TOS has been added. Requires that the
! 387: kernel support the IP_TOS socket option (currently this
! 388: is only in UNICOS 6.0).
! 389:
! 390: Both telnet and telnetd now use the cc_t typedef. typedefs are
! 391: included for systems that don't have it (in termios.h).
! 392:
! 393: SLC_SUSP was not supported properly before. It is now.
! 394:
! 395: IAC EOF was not translated properly in telnetd for SYSV_TERMIO
! 396: when not in linemode. It now saves a copy of the VEOF character,
! 397: so that when ICANON is turned off and we can't trust it anymore
! 398: (because it is now the VMIN character) we use the saved value.
! 399:
! 400: There were two missing "break" commands in the linemode
! 401: processing code in telnetd.
! 402:
! 403: Telnetd wasn't setting the kernel window size information
! 404: properly. It was using the rows for both rows and columns...
! 405:
! 406: Questions/comments go to
! 407: David Borman
! 408: Cray Research, Inc.
! 409: 655F Lone Oak Drive
! 410: Eagan, MN 55123
! 411: dab@cray.com.
! 412:
! 413: README: You are reading it.
! 414:
! 415: Config.generic:
! 416: This file contains all the OS specific definitions. It
! 417: has pre-definitions for many common system types, and is
! 418: in standard makefile fromat. See the comments at the top
! 419: of the file for more information.
! 420:
! 421: Config.local:
! 422: This is not part of the distribution, but if this file exists,
! 423: it is used instead of "Config.generic". This allows site
! 424: specific configuration without having to modify the distributed
! 425: "Config.generic" file.
! 426:
! 427: kern.diff:
! 428: This file contains the diffs for the changes needed for the
! 429: kernel to support LINEMODE is the server. These changes are
! 430: for a 4.3BSD system. You may need to make some changes for
! 431: your particular system.
! 432:
! 433: There is a new bit in the terminal state word, TS_EXTPROC.
! 434: When this bit is set, several aspects of the terminal driver
! 435: are disabled. Input line editing, character echo, and
! 436: mapping of signals are all disabled. This allows the telnetd
! 437: to turn of these functions when in linemode, but still keep
! 438: track of what state the user wants the terminal to be in.
! 439:
! 440: New ioctl()s:
! 441:
! 442: TIOCEXT Turn on/off the TS_EXTPROC bit
! 443: TIOCGSTATE Get t_state of tty to look at TS_EXTPROC bit
! 444: TIOCSIG Generate a signal to processes in the
! 445: current process group of the pty.
! 446:
! 447: There is a new mode for packet driver, the TIOCPKT_IOCTL bit.
! 448: When packet mode is turned on in the pty, and the TS_EXTPROC
! 449: bit is set, then whenever the state of the pty is changed, the
! 450: next read on the master side of the pty will have the TIOCPKT_IOCTL
! 451: bit set, and the data will contain the following:
! 452: struct xx {
! 453: struct sgttyb a;
! 454: struct tchars b;
! 455: struct ltchars c;
! 456: int t_state;
! 457: int t_flags;
! 458: }
! 459: This allows the process on the server side of the pty to know
! 460: when the state of the terminal has changed, and what the new
! 461: state is.
! 462:
! 463: However, if you define USE_TERMIO or SYSV_TERMIO, the code will
! 464: expect that the structure returned in the TIOCPKT_IOCTL is
! 465: the termio/termios structure.
! 466:
! 467: stty.diff:
! 468: This file contains the changes needed for the stty(1) program
! 469: to report on the current status of the TS_EXTPROC bit. It also
! 470: allows the user to turn on/off the TS_EXTPROC bit. This is useful
! 471: because it allows the user to say "stty -extproc", and the
! 472: LINEMODE option will be automatically disabled, and saying "stty
! 473: extproc" will re-enable the LINEMODE option.
! 474:
! 475: telnet.state:
! 476: Both the client and server have code in them to deal
! 477: with option negotiation loops. The algorithm that is
! 478: used is described in this file.
! 479:
! 480: tmac.doc:
! 481: Macros for use in formatting the man pages on non-4.3Reno
! 482: systems.
! 483:
! 484: telnet:
! 485: This directory contains the client code. No kernel changes are
! 486: needed to use this code.
! 487:
! 488: telnetd:
! 489: This directory contains the server code. If LINEMODE or KLUDGELINEMODE
! 490: are defined, then the kernel modifications listed above are needed.
! 491:
! 492: libtelnet:
! 493: This directory contains code that is common to both the client
! 494: and the server.
! 495:
! 496: arpa:
! 497: This directory has a new <arpa/telnet.h>
! 498:
! 499:
! 500: The following TELNET options are supported:
! 501:
! 502: LINEMODE:
! 503: The LINEMODE option is supported as per RFC1116. The
! 504: FORWARDMASK option is not currently supported.
! 505:
! 506: BINARY: The client has the ability to turn on/off the BINARY
! 507: option in each direction. Turning on BINARY from
! 508: server to client causes the LITOUT bit to get set in
! 509: the terminal driver on both ends, turning on BINARY
! 510: from the client to the server causes the PASS8 bit
! 511: to get set in the terminal driver on both ends.
! 512:
! 513: TERMINAL-TYPE:
! 514: This is supported as per RFC1091. On the server side,
! 515: when a terminal type is received, termcap/terminfo
! 516: is consulted to determine if it is a known terminal
! 517: type. It keeps requesting terminal types until it
! 518: gets one that it recongnizes, or hits the end of the
! 519: list. The server side looks up the entry in the
! 520: termcap/terminfo data base, and generates a list of
! 521: names which it then passes one at a time to each
! 522: request for a terminal type, duplicating the last
! 523: entry in the list before cycling back to the beginning.
! 524:
! 525: NAWS: The Negotiate about Window Size, as per RFC 1073.
! 526:
! 527: TERMINAL-SPEED:
! 528: Implemented as per RFC 1079
! 529:
! 530: TOGGLE-FLOW-CONTROL:
! 531: Implemented as per RFC 1080
! 532:
! 533: TIMING-MARK:
! 534: As per RFC 860
! 535:
! 536: SGA: As per RFC 858
! 537:
! 538: ECHO: As per RFC 857
! 539:
! 540: STATUS:
! 541: The server will send its current status upon
! 542: request. It does not ask for the clients status.
! 543: The client will request the servers current status
! 544: from the "send getstatus" command.
! 545:
! 546: ENVIRON:
! 547: This option is currently being defined by the IETF
! 548: Telnet Working Group, and an RFC has not yet been
! 549: issued, but should be in the near future...
! 550:
! 551: X-DISPLAY-LOCATION:
! 552: This functionality can be done through the ENVIRON
! 553: option, it is added here for completeness.
! 554:
! 555: AUTHENTICATION:
! 556: This option is currently being defined by the IETF
! 557: Telnet Working Group, and an RFC has not yet been
! 558: issued. The basic framework is pretty much decided,
! 559: but the definitions for the specific authentication
! 560: schemes is still in a state of flux.
! 561:
! 562: ENCRYPT:
! 563: This option is currently being defined by the IETF
! 564: Telnet Working Group, and an RFC has not yet been
! 565: issued. The draft RFC is still in a state of flux,
! 566: so this code may change in the future.