1 2 3This is a distribution of both client and server telnet. These programs 4have been compiled on: 5 telnet telnetd 6 BSD 4.4 X X 7 UNICOS 5.1 X X 8 UNICOS 6.0 X X 9 SunOs 3.5 X X (no linemode in server) 10 SunOs 4.0.3c X X (no linemode in server) 11 SunOs 4.1 X X (no linemode in server) 12 DYNIX V3.0.17.9 X X (no linemode in server) 13 Ultrix 3.1 X X (no linemode in server) 14 Ultrix 4.0 X (server compiles, but doesn't 15 work with /bin/csh) 16 17In addition, previous versions have been compiled on the following 18machines, but were not available for testing this version. 19 telnet telnetd 20 BSD 4.3 X X (no linemode in server) 21 DYNIX V3.0.12 X X (no linemode in server) 22 23September 14, 1990: 24 25 Switch the client to use getopt() for parsing the 26 argument list. The 4.3Reno getopt.c is included for 27 systems that don't have getopt(). 28 29 Use the posix _POSIX_VDISABLE value for what value 30 to use when disabling special characters. If this 31 is undefined, it defaults to 0x3ff. 32 33 For non-termio systems, TIOCSETP was being used to 34 change the state of the terminal. This causes the 35 input queue to be flushed, which we don't want. This 36 is now changed to TIOCSETN. 37 38 Take out the "#ifdef notdef" around the code in the 39 server that generates a "sync" when the pty oputput 40 is flushed. The potential problem is that some older 41 telnet clients may go into an infinate loop when they 42 receive a "sync", if so, the server can be compiled 43 with "NO_URGENT" defined. 44 45 Fix the client where it was setting/clearing the OPOST 46 bit in the c_lflag field, not the c_oflag field. 47 48 Fix the client where it was setting/clearing the ISTRIP 49 bit in the c_lflag field, not the c_iflag field. (On 50 4.3Reno, this is the ECHOPRT bit in the c_lflag field.) 51 The client also had its interpretation of WILL BINARY 52 and DO BINARY reversed. 53 54 Fix a bug in client that would cause a core dump when 55 attempting to remove the last environment variable. 56 57 In the client, there were a few places were switch() 58 was being passed a character, and if it was a negative 59 value, it could get sign extended, and not match 60 the 8 bit case statements. The fix is to and the 61 switch value with 0xff. 62 63 Add a couple more printoption() calls in the client, I 64 don't think there are any more places were a telnet 65 command can be received and not printed out when 66 "options" is on. 67 68 A new flag has been added to the client, "-a". Currently, 69 this just causes the USER name to be sent across, in 70 the future this may be used to signify that automatic 71 authentication is requested. 72 73 The USER variable is now only sent by the client if 74 the "-a" or "-l user" options are explicity used, or 75 if the user explicitly asks for the "USER" environment 76 variable to be exported. In the server, if it receives 77 the "USER" environment variable, it won't print out the 78 banner message, so that only "Password:" will be printed. 79 This makes the symantics more like rlogin, and should be 80 more familiar to the user. (People are not used to 81 getting a banner message, and then getting just a 82 "Password:" prompt.) 83 84 Re-vamp the code for starting up the child login 85 process. The code was getting ugly, and it was 86 hard to tell what was really going on. What we 87 do now is after the fork(), in the child: 88 1) make sure we have no controlling tty 89 2) open and initialize the tty 90 3) do a setsid()/setpgrp() 91 4) makes the tty our controlling tty. 92 On some systems, #2 makes the tty our controlling 93 tty, and #4 is a no-op. The parent process does 94 a gets rid of any controlling tty after the child 95 is fork()ed. 96 97 Use the strdup() library routine in telnet, instead 98 of the local savestr() routine. If you don't have 99 strdup(), you need to define NO_STRDUP. 100 101 Add support for ^T (SIGINFO/VSTATUS), found in the 102 4.3Reno distribution. This maps to the AYT character. 103 You need a 4-line bugfix in the kernel to get this 104 to work properly: 105 106 > *** tty_pty.c.ORG Tue Sep 11 09:41:53 1990 107 > --- tty_pty.c Tue Sep 11 17:48:03 1990 108 > *************** 109 > *** 609,613 **** 110 > if ((tp->t_lflag&NOFLSH) == 0) 111 > ttyflush(tp, FREAD|FWRITE); 112 > ! pgsignal(tp->t_pgrp, *(unsigned int *)data); 113 > return(0); 114 > } 115 > --- 609,616 ---- 116 > if ((tp->t_lflag&NOFLSH) == 0) 117 > ttyflush(tp, FREAD|FWRITE); 118 > ! pgsignal(tp->t_pgrp, *(unsigned int *)data, 1); 119 > ! if ((*(unsigned int *)data == SIGINFO) && 120 > ! ((tp->t_lflag&NOKERNINFO) == 0)) 121 > ! ttyinfo(tp); 122 > return(0); 123 > } 124 125 The client is now smarter when setting the telnet escape 126 character; it only sets it to one of VEOL and VEOL2 if 127 one of them is undefined, and the other one is not already 128 defined to the telnet escape character. 129 130 Handle TERMIOS systems that have seperate input and output 131 line speed settings imbedded in the flags. 132 133 Many other minor bug fixes. 134 135June 20, 1990: 136 Re-organize makefiles and source tree. The telnet/Source 137 directory is now gone, and all the source that was in 138 telnet/Source is now just in the telnet directory. 139 140 Seperate makefile for each system are now gone. There 141 are two makefiles, Makefile and Makefile.generic. 142 The "Makefile" has the definitions for the various 143 system, and "Makefile.generic" does all the work. 144 There is a variable called "WHAT" that is used to 145 specify what to make. For example, in the telnet 146 directory, you might say: 147 make 4.4bsd WHAT=clean 148 to clean out the directory. 149 150 Add support for the ENVIRON and XDISPLOC options. 151 In order for the server to work, login has to have 152 the "-p" option to preserve environment variables. 153 154 Add the SOFT_TAB and LIT_ECHO modes in the LINEMODE support. 155 156 Add the "-l user" option to command line and open command 157 (This is passed through the ENVIRON option). 158 159 Add the "-e" command line option, for setting the escape 160 character. 161 162 Add the "-D", diagnostic, option to the server. This allows 163 the server to print out debug information, which is very 164 useful when trying to debug a telnet that doesn't have any 165 debugging ability. 166 167 Turn off the literal next character when not in LINEMODE. 168 169 Don't recognize ^Y locally, just pass it through. 170 171 Make minor modifications for Sun4.0 and Sun4.1 172 173 Add support for both FORW1 and FORW2 characters. The 174 telnet escpape character is set to whichever of the 175 two is not being used. If both are in use, the escape 176 character is not set, so when in linemode the user will 177 have to follow the escape character with a <CR> or <EOF) 178 to get it passed through. 179 180 Commands can now be put in single and double quotes, and 181 a backslash is now an escape character. This is needed 182 for allowing arbitrary strings to be assigned to environment 183 variables. 184 185 Switch telnetd to use macros like telnet for keeping 186 track of the state of all the options. 187 188 Fix telnetd's processing of options so that we always do 189 the right processing of the LINEMODE option, regardless 190 of who initiates the request to turn it on. Also, make 191 sure that if the other side went "WILL ECHO" in response 192 to our "DO ECHO", that we send a "DONT ECHO" to get the 193 option turned back off! 194 195 Fix the TERMIOS setting of the terminal speed to handle both 196 BSD's seperate fields, and the SYSV method of CBAUD bits. 197 198 Change how we deal with the other side refusing to enable 199 an option. The sequence used to be: send DO option; receive 200 WONT option; send DONT option. Now, the sequence is: send 201 DO option; receive WONT option. Both should be valid 202 according to the spec, but there has been at least one 203 client implementation of telnet identified that can get 204 really confused by this. (The exact sequence, from a trace 205 on the server side, is (numbers are number of responses that 206 we expect to get after that line...): 207 208 send WILL ECHO 1 (initial request) 209 send WONT ECHO 2 (server is changing state) 210 recv DO ECHO 1 (first reply, ok. expect DONT ECHO next) 211 send WILL ECHO 2 (server changes state again) 212 recv DONT ECHO 1 (second reply, ok. expect DO ECHO next) 213 recv DONT ECHO 0 (third reply, wrong answer. got DONT!!!) 214 *** send WONT ECHO (send WONT to acknowledge the DONT) 215 send WILL ECHO 1 (ask again to enable option) 216 recv DO ECHO 0 217 218 recv DONT ECHO 0 219 send WONT ECHO 1 220 recv DONT ECHO 0 221 recv DO ECHO 1 222 send WILL ECHO 0 223 (and the last 5 lines loop forever) 224 225 The line with the "***" is last of the WILL/DONT/WONT sequence. 226 The change to the server to not generate that makes this same 227 example become: 228 229 send will ECHO 1 230 send wont ECHO 2 231 recv do ECHO 1 232 send will ECHO 2 233 recv dont ECHO 1 234 recv dont ECHO 0 235 recv do ECHO 1 236 send will ECHO 0 237 238 There is other option negotiation going on, and not sending 239 the third part changes some of the timings, but this specific 240 example no longer gets stuck in a loop. The "telnet.state" 241 file has been modified to reflect this change to the algorithm. 242 243 A bunch of miscellaneous bug fixes and changes to make 244 lint happier. 245 246 This version of telnet also has some KERBEROS stuff in 247 it. This has not been tested, it uses an un-authorized 248 telnet option number, and uses an out-of-date version 249 of the (still being defined) AUTHENTICATION option. 250 There is no support for this code, do not enable it. 251 252 253March 1, 1990: 254CHANGES/BUGFIXES SINCE LAST RELEASE: 255 Some support for IP TOS has been added. Requires that the 256 kernel support the IP_TOS socket option (currently this 257 is only in UNICOS 6.0). 258 259 Both telnet and telnetd now use the cc_t typedef. typedefs are 260 included for systems that don't have it (in termios.h). 261 262 SLC_SUSP was not supported properly before. It is now. 263 264 IAC EOF was not translated properly in telnetd for SYSV_TERMIO 265 when not in linemode. It now saves a copy of the VEOF character, 266 so that when ICANON is turned off and we can't trust it anymore 267 (because it is now the VMIN character) we use the saved value. 268 269 There were two missing "break" commands in the linemode 270 processing code in telnetd. 271 272 Telnetd wasn't setting the kernel window size information 273 properly. It was using the rows for both rows and columns... 274 275Questions/comments go to 276 David Borman 277 Cray Research, Inc. 278 655F Lone Oak Drive 279 Eagan, MN 55123 280 dab@cray.com. 281 282README: You are reading it. 283 284kern.diff: 285 This file contains the diffs for the changes needed for the 286 kernel to support LINEMODE is the server. These changes are 287 for a 4.3BSD system. You may need to make some changes for 288 your particular system. 289 290 There is a new bit in the terminal state word, TS_EXTPROC. 291 When this bit is set, several aspects of the terminal driver 292 are disabled. Input line editing, character echo, and 293 mapping of signals are all disabled. This allows the telnetd 294 to turn of these functions when in linemode, but still keep 295 track of what state the user wants the terminal to be in. 296 297 New ioctl()s: 298 299 TIOCEXT Turn on/off the TS_EXTPROC bit 300 TIOCGSTATE Get t_state of tty to look at TS_EXTPROC bit 301 TIOCSIG Generate a signal to processes in the 302 current process group of the pty. 303 304 There is a new mode for packet driver, the TIOCPKT_IOCTL bit. 305 When packet mode is turned on in the pty, and the TS_EXTPROC 306 bit is set, then whenever the state of the pty is changed, the 307 next read on the master side of the pty will have the TIOCPKT_IOCTL 308 bit set, and the data will contain the following: 309 struct xx { 310 struct sgttyb a; 311 struct tchars b; 312 struct ltchars c; 313 int t_state; 314 int t_flags; 315 } 316 This allows the process on the server side of the pty to know 317 when the state of the terminal has changed, and what the new 318 state is. 319 320 However, if you define USE_TERMIO or SYSV_TERMIO, the code will 321 expect that the structure returned in the TIOCPKT_IOCTL is 322 the termio/termios structure. 323 324stty.diff: 325 This file contains the changes needed for the stty(1) program 326 to report on the current status of the TS_EXTPROC bit. It also 327 allows the user to turn on/off the TS_EXTPROC bit. This is useful 328 because it allows the user to say "stty -extproc", and the 329 LINEMODE option will be automatically disabled, and saying "stty 330 extproc" will re-enable the LINEMODE option. 331 332telnet.state: 333 Both the client and server have code in them to deal 334 with option negotiation loops. The algorithm that is 335 used is described in this file. 336 337telnet: 338 This directory contains the client code. No kernel changes are 339 needed to use this code. 340 341telnetd: 342 This directory contains the server code. If LINEMODE or KLUDGELINEMODE 343 are defined, then the kernel modifications listed above are needed. 344 345arpa: 346 This directory has a new <arpa/telnet.h> 347 348 349The following TELNET options are supported: 350 351 LINEMODE: 352 The LINEMODE option is supported as per RFC1116. The 353 FORWARDMASK option is not currently supported. 354 355 BINARY: The client has the ability to turn on/off the BINARY 356 option in each direction. Turning on BINARY from 357 server to client causes the LITOUT bit to get set in 358 the terminal driver on both ends, turning on BINARY 359 from the client to the server causes the PASS8 bit 360 to get set in the terminal driver on both ends. 361 362 TERMINAL-TYPE: 363 This is supported as per RFC1091. On the server side, 364 when a terminal type is received, termcap/terminfo 365 is consulted to determine if it is a known terminal 366 type. It keeps requesting terminal types until it 367 gets one that it recongnizes, or hits the end of the 368 list. The server side looks up the entry in the 369 termcap/terminfo data base, and generates a list of 370 names which it then passes one at a time to each 371 request for a terminal type, duplicating the last 372 entry in the list before cycling back to the beginning. 373 374 NAWS: The Negotiate about Window Size, as per RFC 1073. 375 376 TERMINAL-SPEED: 377 Implemented as per RFC 1079 378 379 TOGGLE-FLOW-CONTROL: 380 Implemented as per RFC 1080 381 382 TIMING-MARK: 383 As per RFC 860 384 385 SGA: As per RFC 858 386 387 ECHO: As per RFC 857 388 389 STATUS: 390 The server will send its current status upon 391 request. It does not ask for the clients status. 392 The client will request the servers current status 393 from the "send getstatus" command. 394 395 ENVIRON: 396 This option is currently being defined by the IETF 397 Telnet Working Group, and an RFC has not yet been 398 issued, but should be in the near future... 399 400 X-DISPLAY-LOCATION: 401 This functionality can be done through the ENVIRON 402 option, it is added here for completeness. 403 404Look at the Makefile for comments about #define paramaters that need 405to be set up for your individual site. There are also several Makefiles 406for various systems that these have been compiled on. 407