From b33abb44fd4fa371e8f4d567dc6421cbdd560d75 Mon Sep 17 00:00:00 2001 From: Unknown User d91-jda Date: Mon, 23 Oct 1995 11:20:30 +0000 Subject: [PATCH] Initial revision git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@171 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/popper/README | 381 ++++++ appl/popper/README-KRB4 | 1 + appl/popper/pop3.rfc1081 | 898 ++++++++++++++ appl/popper/pop3e.rfc1082 | 619 ++++++++++ appl/popper/pop_dele.c | 59 + appl/popper/pop_last.c | 24 + appl/popper/pop_list.c | 64 + appl/popper/pop_lower.c | 27 + appl/popper/pop_parse.c | 64 + appl/popper/pop_quit.c | 27 + appl/popper/pop_rset.c | 39 + appl/popper/pop_stat.c | 28 + appl/popper/pop_xtnd.c | 38 + appl/popper/popper.8 | 155 +++ appl/popper/popper.README.release | 45 + appl/popper/version.h | 15 + appl/telnet/Config.generic | 916 +++++++++++++++ appl/telnet/Config.local | 105 ++ appl/telnet/Makefile.ORIG | 9 + appl/telnet/README | 743 ++++++++++++ appl/telnet/arpa/telnet.h | 323 +++++ appl/telnet/config.h.in | 144 +++ appl/telnet/configure | 1631 ++++++++++++++++++++++++++ appl/telnet/kern.diff | 308 +++++ appl/telnet/libtelnet/Makefile.4.4 | 33 + appl/telnet/libtelnet/Makefile.ORIG | 45 + appl/telnet/libtelnet/auth-proto.h | 114 ++ appl/telnet/libtelnet/auth.h | 87 ++ appl/telnet/libtelnet/enc-proto.h | 121 ++ appl/telnet/libtelnet/encrypt.h | 109 ++ appl/telnet/libtelnet/forward.c | 636 ++++++++++ appl/telnet/libtelnet/genget.c | 105 ++ appl/telnet/libtelnet/key-proto.h | 71 ++ appl/telnet/libtelnet/misc.h | 42 + appl/telnet/libtelnet/parsetos.c | 41 + appl/telnet/libtelnet/setsid.c | 51 + appl/telnet/stty.diff | 72 ++ appl/telnet/telnet.state | 80 ++ appl/telnet/telnet/Makefile.4.4 | 73 ++ appl/telnet/telnet/Makefile.ORIG | 45 + appl/telnet/telnet/Makefile.generic | 89 ++ appl/telnet/telnet/defines.h | 61 + appl/telnet/telnet/fdset.h | 49 + appl/telnet/telnet/general.h | 45 + appl/telnet/telnet/main.c.foodiff | 86 ++ appl/telnet/telnet/ring.h | 105 ++ appl/telnet/telnet/telnet.0.ps | 1008 ++++++++++++++++ appl/telnet/telnet/telnet.0.txt | 722 ++++++++++++ appl/telnet/telnet/telnet.1 | 1366 +++++++++++++++++++++ appl/telnet/telnet/tn3270.c | 411 +++++++ appl/telnet/telnet/types.h | 52 + appl/telnet/telnetd/Makefile.4.4 | 36 + appl/telnet/telnetd/Makefile.ORIG | 45 + appl/telnet/telnetd/Makefile.generic | 71 ++ appl/telnet/telnetd/pathnames.h | 55 + appl/telnet/telnetd/telnetd.0.ps | 555 +++++++++ appl/telnet/telnetd/telnetd.0.txt | 322 +++++ appl/telnet/telnetd/telnetd.8 | 607 ++++++++++ appl/telnet/telnetd/telnetd.h | 49 + appl/xnlock/README | 21 + appl/xnlock/nose.0.left | 38 + appl/xnlock/nose.0.right | 38 + appl/xnlock/nose.1.left | 38 + appl/xnlock/nose.1.right | 38 + appl/xnlock/nose.down | 38 + appl/xnlock/nose.front | 38 + appl/xnlock/nose.left.front | 38 + appl/xnlock/nose.right.front | 38 + appl/xnlock/xnlock.c.save | 860 ++++++++++++++ appl/xnlock/xnlock.man | 123 ++ lib/des/3cbc_enc.c | 51 + lib/des/3ecb_enc.c | 26 + lib/des/ARTISTIC | 105 ++ lib/des/CHANGES | 16 + lib/des/COPYING | 489 ++++++++ lib/des/FILES | 60 + lib/des/INSTALL | 53 + lib/des/Imakefile | 33 + lib/des/KERBEROS | 38 + lib/des/MODES.DES | 84 ++ lib/des/PC1 | 28 + lib/des/PC2 | 57 + lib/des/README | 56 + lib/des/VERSION | 185 +++ lib/des/cbc_enc.c | 72 ++ lib/des/cfb_enc.c | 99 ++ lib/des/des.c | 842 +++++++++++++ lib/des/des.man | 187 +++ lib/des/des.pl | 536 +++++++++ lib/des/des.x | Bin 0 -> 3920 bytes lib/des/des_crypt.3 | 381 ++++++ lib/des/des_crypt.man | 502 ++++++++ lib/des/des_locl.h | 174 +++ lib/des/destest.c | 373 ++++++ lib/des/doIP | 46 + lib/des/doPC1 | 110 ++ lib/des/doPC2 | 94 ++ lib/des/ecb_enc.c | 110 ++ lib/des/enc_read.c | 155 +++ lib/des/enc_writ.c | 94 ++ lib/des/fcrypt.c | 573 +++++++++ lib/des/ofb_enc.c | 62 + lib/des/pcbc_enc.c | 67 ++ lib/des/podd.h | 19 + lib/des/qud_cksm.c | 83 ++ lib/des/rand_key.c | 44 + lib/des/rpw.c | 37 + lib/des/shifts.pl | 160 +++ lib/des/sk.h | 140 +++ lib/des/speed.c | 205 ++++ lib/des/spr.h | 146 +++ lib/des/str2key.c | 112 ++ lib/des/testdes.pl | 167 +++ lib/des/times | 77 ++ lib/des/vms.com | 90 ++ lib/roken/getopt.c | 128 ++ lib/roken/strcasecmp.c | 122 ++ lib/roken/strftime.c | 315 +++++ 118 files changed, 23033 insertions(+) create mode 100644 appl/popper/README create mode 100644 appl/popper/README-KRB4 create mode 100644 appl/popper/pop3.rfc1081 create mode 100644 appl/popper/pop3e.rfc1082 create mode 100644 appl/popper/pop_dele.c create mode 100644 appl/popper/pop_last.c create mode 100644 appl/popper/pop_list.c create mode 100644 appl/popper/pop_lower.c create mode 100644 appl/popper/pop_parse.c create mode 100644 appl/popper/pop_quit.c create mode 100644 appl/popper/pop_rset.c create mode 100644 appl/popper/pop_stat.c create mode 100644 appl/popper/pop_xtnd.c create mode 100644 appl/popper/popper.8 create mode 100644 appl/popper/popper.README.release create mode 100644 appl/popper/version.h create mode 100644 appl/telnet/Config.generic create mode 100644 appl/telnet/Config.local create mode 100644 appl/telnet/Makefile.ORIG create mode 100644 appl/telnet/README create mode 100644 appl/telnet/arpa/telnet.h create mode 100644 appl/telnet/config.h.in create mode 100755 appl/telnet/configure create mode 100644 appl/telnet/kern.diff create mode 100644 appl/telnet/libtelnet/Makefile.4.4 create mode 100644 appl/telnet/libtelnet/Makefile.ORIG create mode 100644 appl/telnet/libtelnet/auth-proto.h create mode 100644 appl/telnet/libtelnet/auth.h create mode 100644 appl/telnet/libtelnet/enc-proto.h create mode 100644 appl/telnet/libtelnet/encrypt.h create mode 100644 appl/telnet/libtelnet/forward.c create mode 100644 appl/telnet/libtelnet/genget.c create mode 100644 appl/telnet/libtelnet/key-proto.h create mode 100644 appl/telnet/libtelnet/misc.h create mode 100644 appl/telnet/libtelnet/parsetos.c create mode 100644 appl/telnet/libtelnet/setsid.c create mode 100644 appl/telnet/stty.diff create mode 100644 appl/telnet/telnet.state create mode 100644 appl/telnet/telnet/Makefile.4.4 create mode 100644 appl/telnet/telnet/Makefile.ORIG create mode 100644 appl/telnet/telnet/Makefile.generic create mode 100644 appl/telnet/telnet/defines.h create mode 100644 appl/telnet/telnet/fdset.h create mode 100644 appl/telnet/telnet/general.h create mode 100644 appl/telnet/telnet/main.c.foodiff create mode 100644 appl/telnet/telnet/ring.h create mode 100644 appl/telnet/telnet/telnet.0.ps create mode 100644 appl/telnet/telnet/telnet.0.txt create mode 100644 appl/telnet/telnet/telnet.1 create mode 100644 appl/telnet/telnet/tn3270.c create mode 100644 appl/telnet/telnet/types.h create mode 100644 appl/telnet/telnetd/Makefile.4.4 create mode 100644 appl/telnet/telnetd/Makefile.ORIG create mode 100644 appl/telnet/telnetd/Makefile.generic create mode 100644 appl/telnet/telnetd/pathnames.h create mode 100644 appl/telnet/telnetd/telnetd.0.ps create mode 100644 appl/telnet/telnetd/telnetd.0.txt create mode 100644 appl/telnet/telnetd/telnetd.8 create mode 100644 appl/telnet/telnetd/telnetd.h create mode 100644 appl/xnlock/README create mode 100644 appl/xnlock/nose.0.left create mode 100644 appl/xnlock/nose.0.right create mode 100644 appl/xnlock/nose.1.left create mode 100644 appl/xnlock/nose.1.right create mode 100644 appl/xnlock/nose.down create mode 100644 appl/xnlock/nose.front create mode 100644 appl/xnlock/nose.left.front create mode 100644 appl/xnlock/nose.right.front create mode 100644 appl/xnlock/xnlock.c.save create mode 100644 appl/xnlock/xnlock.man create mode 100644 lib/des/3cbc_enc.c create mode 100644 lib/des/3ecb_enc.c create mode 100644 lib/des/ARTISTIC create mode 100644 lib/des/CHANGES create mode 100644 lib/des/COPYING create mode 100644 lib/des/FILES create mode 100644 lib/des/INSTALL create mode 100644 lib/des/Imakefile create mode 100644 lib/des/KERBEROS create mode 100644 lib/des/MODES.DES create mode 100755 lib/des/PC1 create mode 100755 lib/des/PC2 create mode 100644 lib/des/README create mode 100644 lib/des/VERSION create mode 100644 lib/des/cbc_enc.c create mode 100644 lib/des/cfb_enc.c create mode 100644 lib/des/des.c create mode 100644 lib/des/des.man create mode 100644 lib/des/des.pl create mode 100644 lib/des/des.x create mode 100644 lib/des/des_crypt.3 create mode 100644 lib/des/des_crypt.man create mode 100644 lib/des/des_locl.h create mode 100644 lib/des/destest.c create mode 100755 lib/des/doIP create mode 100755 lib/des/doPC1 create mode 100755 lib/des/doPC2 create mode 100644 lib/des/ecb_enc.c create mode 100644 lib/des/enc_read.c create mode 100644 lib/des/enc_writ.c create mode 100644 lib/des/fcrypt.c create mode 100644 lib/des/ofb_enc.c create mode 100644 lib/des/pcbc_enc.c create mode 100644 lib/des/podd.h create mode 100644 lib/des/qud_cksm.c create mode 100644 lib/des/rand_key.c create mode 100644 lib/des/rpw.c create mode 100644 lib/des/shifts.pl create mode 100644 lib/des/sk.h create mode 100644 lib/des/speed.c create mode 100644 lib/des/spr.h create mode 100644 lib/des/str2key.c create mode 100755 lib/des/testdes.pl create mode 100644 lib/des/times create mode 100644 lib/des/vms.com create mode 100644 lib/roken/getopt.c create mode 100644 lib/roken/strcasecmp.c create mode 100644 lib/roken/strftime.c diff --git a/appl/popper/README b/appl/popper/README new file mode 100644 index 000000000..0735fdd56 --- /dev/null +++ b/appl/popper/README @@ -0,0 +1,381 @@ +@(#)@(#)README 2.6 2.6 4/2/91 + + +The Post Office Protocol Server: Installation Guide + + + +Introduction + +The Post Office Protocol server runs on a variety of Unix[1] computers +to manage electronic mail for Macintosh and MS-DOS computers. The +server was developed at the University of California at Berkeley and +conforms fully to the specifications in RFC 1081[2] and RFC 1082[3]. +The Berkeley server also has extensions to send electronic mail on +behalf of a client. + +This guide explains how to install the POP server on your Unix +computer. It assumes that you are not only familiar with Unix but also +capable of performing Unix system administration. + + +How to Obtain the Server + +The POP server is available via anonymous ftp from ftp.CC.Berkeley.EDU +(128.32.136.9, 128.32.206.12). It is in two files in the pub directory: +a compressed tar file popper-version.tar.Z and a Macintosh StuffIt archive +in BinHex format called MacPOP.sit.hqx. + + +Contents of the Distribution + +The distribution contains the following: + ++ All of the C source necessary to create the server program. + ++ A visual representation of how the POP system works. + ++ Reprints of RFC 1081 and RFC 1082. + ++ A HyperCard stack POP client implementation using MacTCP. + ++ A man page for the popper daemon. + ++ This guide. + + +Compatibility + +The Berkeley POP server has been successfully tested on the following +Unix operating systems: + ++ Berkeley Systems Distribution 4.3 + ++ Sun Microsystems Operating System versions 3.5 and 4.0 + ++ Ultrix version 2.3 + +The following POP clients operate correctly with the Berkeley POP server: + ++ The Berkeley HyperMail HyperCard stack for the Apple Macintosh + (distributed with the server). + ++ The Stanford University Macintosh Internet Protocol MacMH program. + ++ The Stanford University Personal Computer Internet Protocol MH + program. + ++ The mh version 6.0 programs for Unix. + + +Support + +The Berkeley POP server is not officially supported and is without any +warranty, explicit or implied. However, we are interested in your +experiences using the server. Bugs, comments and suggestions should be +sent electronically to netinfo@garnet.Berkeley.EDU. + + +Operational Characteristics + +The POP Transaction Cycle + +The Berkeley POP server is a single program (called popper) that is +launched by inetd when it gets a service request on the POP TCP port. +(The official port number specified in RFC 1081 for POP version 3 is +port 110. However, some POP3 clients attempt to contact the server at +port 109, the POP version 2 port. Unless you are running both POP2 and +POP3 servers, you can simply define both ports for use by the POP3 +server. This is explained in the installation instructions later on.) +The popper program initializes and verifies that the peer IP address is +registered in the local domain, logging a warning message when a +connection is made to a client whose IP address does not have a +canonical name. For systems using BSD 4.3 bind, it also checks to see +if a cannonical name lookup for the client returns the same peer IP +address, logging a warning message if it does not. The the server +enters the authorization state, during which the client must correctly +identify itself by providing a valid Unix userid and password on the +server's host machine. No other exchanges are allowed during this +state (other than a request to quit.) If authentication fails, a +warning message is logged and the session ends. Once the user is +identified, popper changes its user and group ids to match that of the +user and enters the transaction state. The server makes a temporary +copy of the user's maildrop (ordinarily in /usr/spool/mail) which is +used for all subsequent transactions. These include the bulk of POP +commands to retrieve mail, delete mail, undelete mail, and so forth. A +Berkeley extension also allows the user to submit a mail parcel to the +server who mails it using the sendmail program (this extension is +supported in the HyperMail client distributed with the server). When +the client quits, the server enters the final update state during which +the network connection is terminated and the user's maildrop is updated +with the (possibly) modified temporary maildrop. + + +Logging + +The POP server uses syslog to keep a record of its activities. On +systems with BSD 4.3 syslogging, the server logs (by default) to the +"local0" facility at priority "notice" for all messages except +debugging which is logged at priority "debug". The default log file is +/usr/spool/mqueue/POPlog. These can be changed, if desired. On +systems with 4.2 syslogging all messages are logged to the local log +file, usually /usr/spool/mqueue/syslog. + +Problems + +If the filesystem which holds the /usr/spool/mail fills up users will +experience difficulties. The filesystem must have enough space to hold +(approximately) two copies of the largest mail box. Popper (v1.81 and +above) is designed to be robust in the face of this problem, but you may +end up with a situation where some of the user's mail is in + + /usr/spool/mail/.userid.pop + +and some of the mail is in + + /usr/spool/mail/userid + +If this happens the System Administrator should clear enough disk space +so that the filesystem has at least as much free disk as both mailboxes +hold and probably a little more. Then the user should initiate a POP +session, and do nothing but quit. If the POP session ends without an +error the user can then use POP or another mail program to clean up his/her +mailbox. + +Alternatively, the System Administrator can combine the two files (but +popper will do this for you if there is enough disk space). + + +Debugging + +The popper program will log debugging information when the -d parameter +is specified after its invocation in the inetd.conf file. Care should +be exercised in using this option since it generates considerable +output in the syslog file. Alternatively, the "-t " option +will place debugging information into file "" using fprintf +instead of syslog. (To enable debugging, you must edit the Makefile +to add -DDEBUG to the compiler options.) + +For SunOS version 3.5, the popper program is launched by inetd from +/etc/servers. This file does not allow you to specify command line +arguments. Therefore, if you want to enable debugging, you can specify +a shell script in /etc/servers to be launched instead of popper and in +this script call popper with the desired arguments. + + +Installation + +1. Examine this file for the latest information, warnings, etc. + +2. Check the Makefile for conformity with your system. + +3. Issue the make command in the directory containing the popper + source. + +4. Issue the make install command in the directory containing the + popper source to copy the program to /usr/etc. + +5. Enable syslogging: + + + For systems with 4.3 syslogging: + + Add the following line to the /etc/syslog.conf file: + + local0.notice;local0.debug /usr/spool/mqueue/POPlog + + Create the empty file /usr/spool/mqueue/POPlog. + + Kill and restart the syslogd daemon. + + + For systems with 4.2 syslogging: + + Be sure that you are logging messages of priority 7 and higher. + For example: + + 7/usr/spool/mqueue/syslog + 9/dev/null + +6. Update /etc/services: + + Add the following line to the /etc/services file: + + pop 110/tcp + + Note: This is the official port number for version 3 of the + Post Office Protocol as defined in RFC 1081. However, some + POP3 clients use port 109, the port number for the previous + version (2) of POP. Therefore you may also want to add the + following line to the /etc/services file: + + pop2 109/tcp + + For Sun systems running yp, also do the following: + + + Change to the /var/yp directory. + + + Issue the make services command. + +7. Update the inetd daemon configuration. Include the second line ONLY if you + are running the server at both ports. + + + On BSD 4.3 and SunOS 4.0 systems, add the following line to the + /etc/inetd.conf file: + + pop stream tcp nowait root /usr/etc/popper popper + pop2 stream tcp nowait root /usr/etc/popper popper + + + On Ultrix systems, add the following line to the + /etc/inetd.conf file: + + pop stream tcp nowait /usr/etc/popper popper + pop2 stream tcp nowait /usr/etc/popper popper + + + On SunOS 3.5 systems, add the following line to the + /etc/servers file: + + pop tcp /usr/etc/popper + pop2 tcp /usr/etc/popper + + Kill and restart the inetd daemon. + +You can confirm that the POP server is running on Unix by telneting to +port 110 (or 109 if you set it up that way). For example: + +%telnet myhost 110 +Trying... +Connected to myhost.berkeley.edu. +Escape character is '^]'. ++OK UCB Pop server (version 1.6) at myhost starting. +quit +Connection closed by foreign host. + + +Release Notes + +1.83 Make sure that everything we do as root is non-destructive. + +1.82 Make the /usr/spool/mail/.userid.pop file owned by the user rather + than owned by root. + +1.81 There were two versions of 1.7 floating around, 1.7b4 and 1.7b5. + The difference is that 1.7b5 attempted to save disk space on + /usr/spool/mail by deleting the users permanent maildrop after + making the temporary copy. Unfortunately, if compiled with + -DDEBUG, this version could easily wipe out a users' mail file. + This is now fixed. + + This version also fixes a security hole for systems that have + /usr/spool/mail writeable by all users. + + With this version we go to all new SCCS IDs for all files. This + is unfortunate, and we hope it is not too much of a problem. + + Thanks to Steve Dorner of UIUC for pointing out the major problem. + +1.7 Extensive re-write of the maildrop processing code contributed by + Viktor Dukhovni that greatly reduces the + possibility that the maildrop can be corrupted as the result of + simultaneous access by two or more processes. + + Added "pop_dropcopy" module to create a temporary maildrop from + the existing, standard maildrop as root before the setuid and + setgid for the user is done. This allows the temporary maildrop + to be created in a mail spool area that is not world read-writable. + + This version does *not* send the sendmail "From " delimiter line + in response to a TOP or RETR command. + + Encased all debugging code in #ifdef DEBUG constructs. This code can + be included by specifying the DEGUG compiler flag. Note: You still + need to use the -d or -t option to obtain debugging output. + +1.6 Corrects a bug that causes the server to crash on SunOS + 4.0 systems. + + Uses varargs and vsprintf (if available) in pop_log and + pop_msg. This is enabled by the "HAVE_VSPRINTF" + compiler flag. + + For systems with BSD 4.3 bind, performs a cannonical + name lookup and searches the returned address(es) for + the client's address, logging a warning message if it + is not located. This is enabled by the "BIND43" + comiler flag. + + Removed all the includes from popper.h and distributed + them throughout the porgrams files, as needed. + + Reformatted the source to convert tabs to spaces and + shorten lines for display on 80-column terminals. + +1.5 Creates the temporary maildrop with mode "600" and + immediately unlinks it. + + Uses client's IP address in lieu of a canonical name if + the latter cannot be obtained. + + Added "-t " option. The presence of this + option causes debugging output to be placed in the file + "file-name" using fprintf instead of the system log + file using syslog. + + Corrected maildrop parsing problem. + +1.4 Copies user's mail into a temporary maildrop on which + all subsequent activity is performed. + + Added "pop_log" function and replaced "syslog" calls + throughout the code with it. + +1.3 Corrected updating of Status: header line. + + Added strncasecmp for systems that do not have one. + Used strncasecmp in all appropriate places. This is + enabled by the STRNCASECMP compiler flag. + +1.2 Support for version 4.2 syslogging added. This is + enabled by the SYSLOG42 compiler flag. + +1.1 Several bugs fixed. + +1.0 Original version. + + +Limitations + ++ The POP server copies the user's entire maildrop to /tmp and + then operates on that copy. If the maildrop is particularly + large, or inadequate space is available in /tmp, then the + server will refuse to continue and terminate the connection. + ++ Simultaneous modification of a single maildrop can result in + confusing results. For example, manipulating messages in a + maildrop using the Unix /usr/ucb/mail command while a copy of + it is being processed by the POP server can cause the changes + made by one program to be lost when the other terminates. This + problem is being worked on and will be fixed in a later + release. + + +Credits + +The POP server was written by Edward Moy and Austin Shelton with +contributions from Robert Campbell (U.C. Berkeley) and Viktor Dukhovni +(Princeton University). Edward Moy wrote the HyperMail stack and drew +the POP operation diagram. This installation guide was written by +Austin Shelton. + + +Footnotes + +[1] Copyright (c) 1990 Regents of the University of California. + All rights reserved. The Berkeley software License Agreement + specifies the terms and conditions for redistribution. Unix is + a registered trademark of AT&T corporation. HyperCard and + Macintosh are registered trademarks of Apple Corporation. + +[2] M. Rose, Post Office Protocol - Version 3. RFC 1081, NIC, + November 1988. + +[3] M. Rose, Post Office Protocol - Version 3 Extended Service + Offerings. RFC 1082, NIC, November 1988. diff --git a/appl/popper/README-KRB4 b/appl/popper/README-KRB4 new file mode 100644 index 000000000..828718176 --- /dev/null +++ b/appl/popper/README-KRB4 @@ -0,0 +1 @@ +Define KERBEROS if you want Kerberos V4 style authentification. diff --git a/appl/popper/pop3.rfc1081 b/appl/popper/pop3.rfc1081 new file mode 100644 index 000000000..08ea6dd14 --- /dev/null +++ b/appl/popper/pop3.rfc1081 @@ -0,0 +1,898 @@ + + + + + + +Network Working Group M. Rose +Request for Comments: 1081 TWG + November 1988 + + Post Office Protocol - Version 3 + + +Status of this Memo + + This memo suggests a simple method for workstations to dynamically + access mail from a mailbox server. This RFC specifies a proposed + protocol for the Internet community, and requests discussion and + suggestions for improvements. Distribution of this memo is + unlimited. + + This memo is based on RFC 918 (since revised as RFC 937). Although + similar in form to the original Post Office Protocol (POP) proposed + for the Internet community, the protocol discussed in this memo is + similar in spirit to the ideas investigated by the MZnet project at + the University of California, Irvine. + + Further, substantial work was done on examining POP in a PC-based + environment. This work, which resulted in additional functionality + in this protocol, was performed by the ACIS Networking Systems Group + at Stanford University. The author gratefully acknowledges their + interest. + +Introduction + + On certain types of smaller nodes in the Internet it is often + impractical to maintain a message transport system (MTS). For + example, a workstation may not have sufficient resources (cycles, + disk space) in order to permit a SMTP server and associated local + mail delivery system to be kept resident and continuously running. + Similarly, it may be expensive (or impossible) to keep a personal + computer interconnected to an IP-style network for long amounts of + time (the node is lacking the resource known as "connectivity"). + + Despite this, it is often very useful to be able to manage mail on + these smaller nodes, and they often support a user agent (UA) to aid + the tasks of mail handling. To solve this problem, a node which can + support an MTS entity offers a maildrop service to these less endowed + nodes. The Post Office Protocol - Version 3 (POP3) is intended to + permit a workstation to dynamically access a maildrop on a server + host in a useful fashion. Usually, this means that the POP3 is used + to allow a workstation to retrieve mail that the server is holding + for it. + + + + +Rose [Page 1] + +RFC 1081 POP3 November 1988 + + + For the remainder of this memo, the term "client host" refers to a + host making use of the POP3 service, while the term "server host" + refers to a host which offers the POP3 service. + +A Short Digression + + This memo does not specify how a client host enters mail into the + transport system, although a method consistent with the philosophy of + this memo is presented here: + + When the user agent on a client host wishes to enter a message + into the transport system, it establishes an SMTP connection to + its relay host (this relay host could be, but need not be, the + POP3 server host for the client host). + + If this method is followed, then the client host appears to the MTS + as a user agent, and should NOT be regarded as a "trusted" MTS entity + in any sense whatsoever. This concept, along with the role of the + POP3 as a part of a split-UA model is discussed later in this memo. + + Initially, the server host starts the POP3 service by listening on + TCP port 110. When a client host wishes to make use of the service, + it establishes a TCP connection with the server host. When the + connection is established, the POP3 server sends a greeting. The + client and POP3 server then exchange commands and responses + (respectively) until the connection is closed or aborted. + + Commands in the POP3 consist of a keyword possibly followed by an + argument. All commands are terminated by a CRLF pair. + + Responses in the POP3 consist of a success indicator and a keyword + possibly followed by additional information. All responses are + terminated by a CRLF pair. There are currently two success + indicators: positive ("+OK") and negative ("-ERR"). + + Responses to certain commands are multi-line. In these cases, which + are clearly indicated below, after sending the first line of the + response and a CRLF, any additional lines are sent, each terminated + by a CRLF pair. When all lines of the response have been sent, a + final line is sent, consisting of a termination octet (decimal code + 046, ".") and a CRLF pair. If any line of the multi-line response + begins with the termination octet, the line is "byte-stuffed" by + pre-pending the termination octet to that line of the response. + Hence a multi-line response is terminated with the five octets + "CRLF.CRLF". When examining a multi-line response, the client checks + to see if the line begins with the termination octet. If so and if + octets other than CRLF follow, the the first octet of the line (the + termination octet) is stripped away. If so and if CRLF immediately + + + +Rose [Page 2] + +RFC 1081 POP3 November 1988 + + + follows the termination character, then the response from the POP + server is ended and the line containing ".CRLF" is not considered + part of the multi-line response. + + A POP3 session progresses through a number of states during its + lifetime. Once the TCP connection has been opened and the POP3 + server has sent the greeting, the session enters the AUTHORIZATION + state. In this state, the client must identify itself to the POP3 + server. Once the client has successfully done this, the server + acquires resources associated with the client's maildrop, and the + session enters the TRANSACTION state. In this state, the client + requests actions on the part of the POP3 server. When the client has + finished its transactions, the session enters the UPDATE state. In + this state, the POP3 server releases any resources acquired during + the TRANSACTION state and says goodbye. The TCP connection is then + closed. + +The AUTHORIZATION State + + Once the TCP connection has been opened by a POP3 client, the POP3 + server issues a one line greeting. This can be any string terminated + by CRLF. An example might be: + + S. +OK dewey POP3 server ready (Comments to: PostMaster@UDEL.EDU) + + Note that this greeting is a POP3 reply. The POP3 server should + always give a positive response as the greeting. + + The POP3 session is now in the AUTHORIZATION state. The client must + now issue the USER command. If the POP3 server responds with a + positive success indicator ("+OK"), then the client may issue either + the PASS command to complete the authorization, or the QUIT command + to terminate the POP3 session. If the POP3 server responds with a + negative success indicator ("-ERR") to the USER command, then the + client may either issue a new USER command or may issue the QUIT + command. + + When the client issues the PASS command, the POP3 server uses the + argument pair from the USER and PASS commands to determine if the + client should be given access to the appropriate maildrop. If so, + the POP3 server then acquires an exclusive-access lock on the + maildrop. If the lock is successfully acquired, the POP3 server + parses the maildrop into individual messages (read note below), + determines the last message (if any) present in the maildrop that was + referenced by the RETR command, and responds with a positive success + indicator. The POP3 session now enters the TRANSACTION state. If + the lock can not be acquired or the client should is denied access to + the appropriate maildrop or the maildrop can't be parsed for some + + + +Rose [Page 3] + +RFC 1081 POP3 November 1988 + + + reason, the POP3 server responds with a negative success indicator. + (If a lock was acquired but the POP3 server intends to respond with a + negative success indicator, the POP3 server must release the lock + prior to rejecting the command.) At this point, the client may + either issue a new USER command and start again, or the client may + issue the QUIT command. + + NOTE: Minimal implementations of the POP3 need only be + able to break a maildrop into its component messages; + they need NOT be able to parse individual messages. + More advanced implementations may wish to have this + capability, for reasons discussed later. + + After the POP3 server has parsed the maildrop into individual + messages, it assigns a message-id to each message, and notes the size + of the message in octets. The first message in the maildrop is + assigned a message-id of "1", the second is assigned "2", and so on, + so that the n'th message in a maildrop is assigned a message-id of + "n". In POP3 commands and responses, all message-id's and message + sizes are expressed in base-10 (i.e., decimal). + + It sets the "highest number accessed" to be that of the last message + referenced by the RETR command. + + Here are summaries for the three POP3 commands discussed thus far: + + USER name + Arguments: a server specific user-id (required) + Restrictions: may only be given in the AUTHORIZATION + state after the POP3 greeting or after an + unsuccessful USER or PASS command + Possible Responses: + +OK name is welcome here + -ERR never heard of name + Examples: + C: USER mrose + S: +OK mrose is a real hoopy frood + ... + C: USER frated + S: -ERR sorry, frated doesn't get his mail here + + PASS string + Arguments: a server/user-id specific password (required) + Restrictions: may only be given in the AUTHORIZATION + state after a successful USER command + Possible Responses: + +OK maildrop locked and ready + -ERR invalid password + + + +Rose [Page 4] + +RFC 1081 POP3 November 1988 + + + -ERR unable to lock maildrop + Examples: + C: USER mrose + S: +OK mrose is a real hoopy frood + C: PASS secret + S: +OK mrose's maildrop has 2 messages + (320 octets) + ... + C: USER mrose + S: +OK mrose is a real hoopy frood + C: PASS secret + S: -ERR unable to lock mrose's maildrop, file + already locked + + QUIT + Arguments: none + Restrictions: none + Possible Responses: + +OK + Examples: + C: QUIT + S: +OK dewey POP3 server signing off + + +The TRANSACTION State + + Once the client has successfully identified itself to the POP3 server + and the POP3 server has locked and burst the appropriate maildrop, + the POP3 session is now in the TRANSACTION state. The client may now + issue any of the following POP3 commands repeatedly. After each + command, the POP3 server issues a response. Eventually, the client + issues the QUIT command and the POP3 session enters the UPDATE state. + + Here are the POP3 commands valid in the TRANSACTION state: + + STAT + Arguments: none + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + The POP3 server issues a positive response with a line + containing information for the maildrop. This line is + called a "drop listing" for that maildrop. + + In order to simplify parsing, all POP3 servers are + required to use a certain format for drop listings. + The first octets present must indicate the number of + messages in the maildrop. Following this is the size + + + +Rose [Page 5] + +RFC 1081 POP3 November 1988 + + + of the maildrop in octets. This memo makes no + requirement on what follows the maildrop size. + Minimal implementations should just end that line of + the response with a CRLF pair. More advanced + implementations may include other information. + + NOTE: This memo STRONGLY discourages + implementations from supplying additional + information in the drop listing. Other, + optional, facilities are discussed later on + which permit the client to parse the messages + in the maildrop. + + Note that messages marked as deleted are not counted in + either total. + + Possible Responses: + +OK nn mm + Examples: + C: STAT + S: +OK 2 320 + + LIST [msg] + Arguments: a message-id (optionally) If a message-id is + given, it may NOT refer to a message marked as + deleted. + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + If an argument was given and the POP3 server issues a + positive response with a line containing information + for that message. This line is called a "scan listing" + for that message. + + If no argument was given and the POP3 server issues a + positive response, then the response given is + multi-line. After the initial +OK, for each message + in the maildrop, the POP3 server responds with a line + containing information for that message. This line + is called a "scan listing" for that message. + + In order to simplify parsing, all POP3 servers are + required to use a certain format for scan listings. + The first octets present must be the message-id of + the message. Following the message-id is the size of + the message in octets. This memo makes no requirement + on what follows the message size in the scan listing. + Minimal implementations should just end that line of + + + +Rose [Page 6] + +RFC 1081 POP3 November 1988 + + + the response with a CRLF pair. More advanced + implementations may include other information, as + parsed from the message. + + NOTE: This memo STRONGLY discourages + implementations from supplying additional + information in the scan listing. Other, optional, + facilities are discussed later on which permit + the client to parse the messages in the maildrop. + + Note that messages marked as deleted are not listed. + + Possible Responses: + +OK scan listing follows + -ERR no such message + Examples: + C: LIST + S: +OK 2 messages (320 octets) + S: 1 120 + S: 2 200 + S: . + ... + C: LIST 2 + S: +OK 2 200 + ... + C: LIST 3 + S: -ERR no such message, only 2 messages in + maildrop + + RETR msg + Arguments: a message-id (required) This message-id may + NOT refer to a message marked as deleted. + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + If the POP3 server issues a positive response, then the + response given is multi-line. After the initial +OK, + the POP3 server sends the message corresponding to the + given message-id, being careful to byte-stuff the + termination character (as with all multi-line + responses). + + If the number associated with this message is higher + than the "highest number accessed" in the maildrop, the + POP3 server updates the "highest number accessed" to + the number associated with this message. + + + + + +Rose [Page 7] + +RFC 1081 POP3 November 1988 + + + Possible Responses: + +OK message follows + -ERR no such message + Examples: + C: RETR 1 + S: +OK 120 octets + S: + S: . + + DELE msg + Arguments: a message-id (required) This message-id + may NOT refer to a message marked as deleted. + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + The POP3 server marks the message as deleted. Any + future reference to the message-id associated with the + message in a POP3 command generates an error. The POP3 + server does not actually delete the message until the + POP3 session enters the UPDATE state. + + If the number associated with this message is higher + than the "highest number accessed" in the maildrop, + the POP3 server updates the "highest number accessed" + to the number associated with this message. + + Possible Responses: + +OK message deleted + -ERR no such message + Examples: + C: DELE 1 + S: +OK message 1 deleted + ... + C: DELE 2 + S: -ERR message 2 already deleted + + NOOP + Arguments: none + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + The POP3 server does nothing, it merely replies with a + positive response. + + Possible Responses: + +OK + + + + + +Rose [Page 8] + +RFC 1081 POP3 November 1988 + + + Examples: + C: NOOP + S: +OK + + LAST + Arguments: none + Restrictions: may only be issued in the TRANSACTION state. + Discussion: + + The POP3 server issues a positive response with a line + containing the highest message number which accessed. + Zero is returned in case no message in the maildrop has + been accessed during previous transactions. A client + may thereafter infer that messages, if any, numbered + greater than the response to the LAST command are + messages not yet accessed by the client. + + Possible Response: + +OK nn + + Examples: + C: STAT + S: +OK 4 320 + C: LAST + S: +OK 1 + C: RETR 3 + S: +OK 120 octets + S: + S: . + C: LAST + S: +OK 3 + C: DELE 2 + S: +OK message 2 deleted + C: LAST + S: +OK 3 + C: RSET + S: +OK + C: LAST + S: +OK 1 + + RSET + Arguments: none + Restrictions: may only be given in the TRANSACTION + state. + Discussion: + + If any messages have been marked as deleted by the POP3 + + + +Rose [Page 9] + +RFC 1081 POP3 November 1988 + + + server, they are unmarked. The POP3 server then + replies with a positive response. In addition, the + "highest number accessed" is also reset to the value + determined at the beginning of the POP3 session. + + Possible Responses: + +OK + Examples: + C: RSET + S: +OK maildrop has 2 messages (320 octets) + + + +The UPDATE State + + When the client issues the QUIT command from the TRANSACTION state, + the POP3 session enters the UPDATE state. (Note that if the client + issues the QUIT command from the AUTHORIZATION state, the POP3 + session terminates but does NOT enter the UPDATE state.) + + QUIT + Arguments: none + Restrictions: none + Discussion: + + The POP3 server removes all messages marked as deleted + from the maildrop. It then releases the + exclusive-access lock on the maildrop and replies as + to the success of + these operations. The TCP connection is then closed. + + Possible Responses: + +OK + Examples: + C: QUIT + S: +OK dewey POP3 server signing off (maildrop + empty) + ... + C: QUIT + S: +OK dewey POP3 server signing off (2 messages + left) + ... + + +Optional POP3 Commands + + The POP3 commands discussed above must be supported by all minimal + implementations of POP3 servers. + + + +Rose [Page 10] + +RFC 1081 POP3 November 1988 + + + The optional POP3 commands described below permit a POP3 client + greater freedom in message handling, while preserving a simple POP3 + server implementation. + + NOTE: This memo STRONGLY encourages implementations to + support these commands in lieu of developing augmented + drop and scan listings. In short, the philosophy of + this memo is to put intelligence in the part of the + POP3 client and not the POP3 server. + + TOP msg n + Arguments: a message-id (required) and a number. This + message-id may NOT refer to a message marked as + deleted. + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + If the POP3 server issues a positive response, then + the response given is multi-line. After the initial + +OK, the POP3 server sends the headers of the message, + the blank line separating the headers from the body, + and then the number of lines indicated message's body, + being careful to byte-stuff the termination character + (as with all multi-line responses). + + Note that if the number of lines requested by the POP3 + client is greater than than the number of lines in the + body, then the POP3 server sends the entire message. + + Possible Responses: + +OK top of message follows + -ERR no such message + Examples: + C: TOP 10 + S: +OK + S: + S: . + ... + C: TOP 100 + S: -ERR no such message + + RPOP user + Arguments: a client specific user-id (required) + Restrictions: may only be given in the AUTHORIZATION + state after a successful USER command; in addition, + may only be given if the client used a reserved + + + +Rose [Page 11] + +RFC 1081 POP3 November 1988 + + + (privileged) TCP port to connect to the server. + Discussion: + + The RPOP command may be used instead of the PASS + command to authenticate access to the maildrop. In + order for this command to be successful, the POP3 + client must use a reserved TCP port (port < 1024) to + connect tothe server. The POP3 server uses the + argument pair from the USER and RPOP commands to + determine if the client should be given access to + the appropriate maildrop. Unlike the PASS command + however, the POP3 server considers if the remote user + specified by the RPOP command who resides on the POP3 + client host is allowed to access the maildrop for the + user specified by the USER command (e.g., on Berkeley + UNIX, the .rhosts mechanism is used). With the + exception of this differing in authentication, this + command is identical to the PASS command. + + Note that the use of this feature has allowed much wider + penetration into numerous hosts on local networks (and + sometimes remote networks) by those who gain illegal + access to computers by guessing passwords or otherwise + breaking into the system. + + Possible Responses: + +OK maildrop locked and ready + -ERR permission denied + Examples: + C: USER mrose + S: +OK mrose is a real hoopy frood + C: RPOP mrose + S: +OK mrose's maildrop has 2 messages (320 + octets) + + Minimal POP3 Commands: + USER name valid in the AUTHORIZATION state + PASS string + QUIT + + STAT valid in the TRANSACTION state + LIST [msg] + RETR msg + DELE msg + NOOP + LAST + RSET + + + + +Rose [Page 12] + +RFC 1081 POP3 November 1988 + + + QUIT valid in the UPDATE state + + Optional POP3 Commands: + RPOP user valid in the AUTHORIZATION state + + TOP msg n valid in the TRANSACTION state + + POP3 Replies: + +OK + -ERR + + Note that with the exception of the STAT command, the reply given + by the POP3 server to any command is significant only to "+OK" + and "-ERR". Any text occurring after this reply may be ignored + by the client. + +Example POP3 Session + + S: + ... + C: + S: +OK dewey POP3 server ready (Comments to: PostMaster@UDEL.EDU) + C: USER mrose + S: +OK mrose is a real hoopy frood + C: PASS secret + S: +OK mrose's maildrop has 2 messages (320 octets) + C: STAT + S: +OK 2 320 + C: LIST + S: +OK 2 messages (320 octets) + S: 1 120 + S: 2 200 + S: . + C: RETR 1 + S: +OK 120 octets + S: + S: . + C: DELE 1 + S: +OK message 1 deleted + C: RETR 2 + S: +OK 200 octets + S: + S: . + C: DELE 2 + S: +OK message 2 deleted + C: QUIT + + + + + +Rose [Page 13] + +RFC 1081 POP3 November 1988 + + + S: +OK dewey POP3 server signing off (maildrop empty) + C: + S: + +Message Format + + All messages transmitted during a POP3 session are assumed to conform + to the standard for the format of Internet text messages [RFC822]. + + It is important to note that the byte count for a message on the + server host may differ from the octet count assigned to that message + due to local conventions for designating end-of-line. Usually, + during the AUTHORIZATION state of the POP3 session, the POP3 client + can calculate the size of each message in octets when it parses the + maildrop into messages. For example, if the POP3 server host + internally represents end-of-line as a single character, then the + POP3 server simply counts each occurrence of this character in a + message as two octets. Note that lines in the message which start + with the termination octet need not be counted twice, since the POP3 + client will remove all byte-stuffed termination characters when it + receives a multi-line response. + +The POP and the Split-UA model + + The underlying paradigm in which the POP3 functions is that of a + split-UA model. The POP3 client host, being a remote PC based + workstation, acts solely as a client to the message transport system. + It does not provide delivery/authentication services to others. + Hence, it is acting as a UA, on behalf of the person using the + workstation. Furthermore, the workstation uses SMTP to enter mail + into the MTS. + + In this sense, we have two UA functions which interface to the + message transport system: Posting (SMTP) and Retrieval (POP3). The + entity which supports this type of environment is called a split-UA + (since the user agent is split between two hosts which must + interoperate to provide these functions). + + ASIDE: Others might term this a remote-UA instead. + There are arguments supporting the use of both terms. + + This memo has explicitly referenced TCP as the underlying transport + agent for the POP3. This need not be the case. In the MZnet split- + UA, for example, personal micro-computer systems are used which do + not have IP-style networking capability. To connect to the POP3 + server host, a PC establishes a terminal connection using some simple + protocol (PhoneNet). A program on the PC drives the connection, + first establishing a login session as a normal user. The login shell + + + +Rose [Page 14] + +RFC 1081 POP3 November 1988 + + + for this pseudo-user is a program which drives the other half of the + terminal protocol and communicates with one of two servers. Although + MZnet can support several PCs, a single pseudo-user login is present + on the server host. The user-id and password for this pseudo-user + login is known to all members of MZnet. Hence, the first action of + the login shell, after starting the terminal protocol, is to demand a + USER/PASS authorization pair from the PC. This second level of + authorization is used to ascertain who is interacting with the MTS. + Although the server host is deemed to support a "trusted" MTS entity, + PCs in MZnet are not. Naturally, the USER/PASS authorization pair + for a PC is known only to the owner of the PC (in theory, at least). + + After successfully verifying the identity of the client, a modified + SMTP server is started, and the PC posts mail with the server host. + After the QUIT command is given to the SMTP server and it terminates, + a modified POP3 server is started, and the PC retrieves mail from the + server host. After the QUIT command is given to the POP3 server and + it terminates, the login shell for the pseudo-user terminates the + terminal protocol and logs the job out. The PC then closes the + terminal connection to the server host. + + The SMTP server used by MZnet is modified in the sense that it knows + that it's talking to a user agent and not a "trusted" entity in the + message transport system. Hence, it does performs the validation + activities normally performed by an entity in the MTS when it accepts + a message from a UA. + + The POP3 server used by MZnet is modified in the sense that it does + not require a USER/PASS combination before entering the TRANSACTION + state. The reason for this (of course) is that the PC has already + identified itself during the second-level authorization step + described above. + + NOTE: Truth in advertising laws require that the author + of this memo state that MZnet has not actually been + fully implemented. The concepts presented and proven + by the project led to the notion of the MZnet + split-slot model. This notion has inspired the + split-UA concept described in this memo, led to the + author's interest in the POP, and heavily influenced + the the description of the POP3 herein. + + In fact, some UAs present in the Internet already support the notion + of posting directly to an SMTP server and retrieving mail directly + from a POP server, even if the POP server and client resided on the + same host! + + ASIDE: this discussion raises an issue which this memo + + + +Rose [Page 15] + +RFC 1081 POP3 November 1988 + + + purposedly avoids: how does SMTP know that it's talking + to a "trusted" MTS entity? + +References + + [MZnet] Stefferud, E., J. Sweet, and T. Domae, "MZnet: Mail + Service for Personal Micro-Computer Systems", + Proceedings, IFIP 6.5 International Conference on + Computer Message Systems, Nottingham, U.K., May 1984. + + [RFC821] Postel, J., "Simple Mail Transfer Protocol", + USC/Information Sciences Institute, August 1982. + + [RFC822] Crocker, D., "Standard for the Format of ARPA-Internet + Text Messages", University of Delaware, August 1982. + + [RFC937] Butler, M., J. Postel, D. Chase, J. Goldberger, and J. + Reynolds, "Post Office Protocol - Version 2", RFC 937, + USC/Information Sciences Institute, February 1985. + + [RFC1010] Reynolds, J., and J. Postel, "Assigned Numbers", RFC + 1010, USC/Information Sciences Institute, May 1987. + +Author's Address: + + + Marshall Rose + The Wollongong Group + 1129 San Antonio Rd. + Palo Alto, California 94303 + + Phone: (415) 962-7100 + + Email: MRose@TWG.COM + + + + + + + + + + + + + + + + + +Rose [Page 16] diff --git a/appl/popper/pop3e.rfc1082 b/appl/popper/pop3e.rfc1082 new file mode 100644 index 000000000..36deae545 --- /dev/null +++ b/appl/popper/pop3e.rfc1082 @@ -0,0 +1,619 @@ + + + + + + +Network Working Group M. Rose +Request for Comments: 1082 TWG + November 1988 + + + + Post Office Protocol - Version 3 + Extended Service Offerings + +Status of This Memo + + This memo suggests a simple method for workstations to dynamically + access mail from a discussion group server, as an extension to an + earlier memo which dealt with dynamically accessing mail from a + mailbox server using the Post Office Protocol - Version 3 (POP3). + This RFC specifies a proposed protocol for the Internet community, + and requests discussion and suggestions for improvements. All of the + extensions described in this memo to the POP3 are OPTIONAL. + Distribution of this memo is unlimited. + +Introduction and Motivation + + It is assumed that the reader is familiar with RFC 1081 that + discusses the Post Office Protocol - Version 3 (POP3) [RFC1081]. + This memo describes extensions to the POP3 which enhance the service + it offers to clients. This additional service permits a client host + to access discussion group mail, which is often kept in a separate + spool area, using the general POP3 facilities. + + The next section describes the evolution of discussion groups and the + technologies currently used to implement them. To summarize: + + o An exploder is used to map from a single address to + a list of addresses which subscribe to the list, and redirects + any subsequent error reports associated with the delivery of + each message. This has two primary advantages: + - Subscribers need know only a single address + - Responsible parties get the error reports and not + the subscribers + + + + + + + + + + + + +Rose [Page 1] + +RFC 1082 POP3 Extended Service November 1988 + + + o Typically, each subscription address is not a person's private + maildrop, but a system-wide maildrop, which can be accessed + by more than one user. This has several advantages: + - Only a single copy of each message need traverse the + net for a given site (which may contain several local + hosts). This conserves bandwidth and cycles. + - Only a single copy of each message need reside on each + subscribing host. This conserves disk space. + - The private maildrop for each user is not cluttered + with discussion group mail. + + Despite this optimization of resources, further economy can be + achieved at sites with more than one host. Typically, sites with + more than one host either: + + 1. Replicate discussion group mail on each host. This + results in literally gigabytes of disk space committed to + unnecessarily store redundant information. + + 2. Keep discussion group mail on one host and give all users a + login on that host (in addition to any other logins they may + have). This is usually a gross inconvenience for users who + work on other hosts, or a burden to users who are forced to + work on that host. + + As discussed in [RFC1081], the problem of giving workstations dynamic + access to mail from a mailbox server has been explored in great + detail (originally there was [RFC918], this prompted the author to + write [RFC1081], independently of this [RFC918] was upgraded to + [RFC937]). A natural solution to the problem outlined above is to + keep discussion group mail on a mailbox server at each site and + permit different hosts at that site to employ the POP3 to access + discussion group mail. If implemented properly, this avoids the + problems of both strategies outlined above. + + ASIDE: It might be noted that a good distributed filesystem + could also solve this problem. Sadly, "good" + distributed filesystems, which do not suffer + unacceptable response time for interactive use, are + few and far between these days! + + Given this motivation, now let's consider discussion groups, both in + general and from the point of view of a user agent. Following this, + extensions to the POP3 defined in [RFC1081] are presented. Finally, + some additional policy details are discussed along with some initial + experiences. + + + + + +Rose [Page 2] + +RFC 1082 POP3 Extended Service November 1988 + + +What's in a Discussion Group + + Since mailers and user agents first crawled out of the primordial + ARPAnet, the value of discussion groups have been appreciated, + (though their implementation has not always been well-understood). + + Described simply, a discussion group is composed of a number of + subscribers with a common interest. These subscribers post mail to a + single address, known as a distribution address. From this + distribution address, a copy of the message is sent to each + subscriber. Each group has a moderator, which is the person that + administrates the group. The moderator can usually be reached at a + special address, known as a request address. Usually, the + responsibilities of the moderator are quite simple, since the mail + system handles the distribution to subscribers automatically. In + some cases, the interest group, instead of being distributed directly + to its subscribers, is put into a digest format by the moderator and + then sent to the subscribers. Although this requires more work on + the part of the moderator, such groups tend to be better organized. + + Unfortunately, there are a few problems with the scheme outlined + above. First, if two users on the same host subscribe to the same + interest group, two copies of the message get delivered. This is + wasteful of both processor and disk resources. + + Second, some of these groups carry a lot of traffic. Although + subscription to an group does indicate interest on the part of a + subscriber, it is usually not interesting to get 50 messages or so + delivered to the user's private maildrop each day, interspersed with + personal mail, that is likely to be of a much more important and + timely nature. + + Third, if a subscriber on the distribution list for a group becomes + "bad" somehow, the originator of the message and not the moderator of + the group is notified. It is not uncommon for a large list to have + 10 or so bogus addresses present. This results in the originator + being flooded with "error messages" from mailers across the Internet + stating that a given address on the list was bad. Needless to say, + the originator usually could not care less if the bogus addresses got + a copy of the message or not. The originator is merely interested in + posting a message to the group at large. Furthermore, the moderator + of the group does care if there are bogus addresses on the list, but + ironically does not receive notification. + + There are various approaches which can be used to solve some or all + of these problems. Usually these involve placing an exploder agent + at the distribution source of the discussion group, which expands the + name of the group into the list of subscription addresses for the + + + +Rose [Page 3] + +RFC 1082 POP3 Extended Service November 1988 + + + group. In the process, the exploder will also change the address + that receives error notifications to be the request address or other + responsible party. + + A complementary approach, used in order to cut down on resource + utilization of all kinds, replaces all the subscribers at a single + host (or group of hosts under a single administration) with a single + address at that host. This address maps to a file on the host, + usually in a spool area, which all users can access. (Advanced + implementations can also implement private discussion groups this + way, in which a single copy of each message is kept, but is + accessible to only a select number of users on the host.) + + The two approaches can be combined to avoid all of the problems + described above. + + Finally, a third approach can be taken, which can be used to aid user + agents processing mail for the discussion group: In order to speed + querying of the maildrop which contains the local host's copy of the + discussion group, two other items are usually associated with the + discussion group, on a local basis. These are the maxima and the + last-date. Each time a message is received for the group on the + local host, the maxima is increased by at least one. Furthermore, + when a new maxima is generated, the current date is determined. This + is called the last date. As the message is entered into the local + maildrop, it is given the current maxima and last-date. This permits + the user agent to quickly determine if new messages are present in + the maildrop. + + NOTE: The maxima may be characterized as a monotonically + increasing quanity. Although sucessive values of the + maxima need not be consecutive, any maxima assigned + is always greater than any previously assigned value. + +Definition of Terms + + To formalize these notions somewhat, consider the following 7 + parameters which describe a given discussion group from the + perspective of the user agent (the syntax given is from [RFC822]): + + + + + + + + + + + + +Rose [Page 4] + +RFC 1082 POP3 Extended Service November 1988 + + + NAME Meaning: the name of the discussion group + Syntax: TOKEN (ALPHA *[ ALPHA / DIGIT / "-" ]) + (case-insensitive recognition) + Example: unix-wizards + + ALIASES Meaning: alternates names for the group, which + are locally meaningful; these are + typically used to shorten user typein + Syntax: TOKEN (case-insensitive recognition) + Example: uwiz + + ADDRESS Meaning: the primary source of the group + Syntax: 822 address + Example: Unix-Wizards@BRL.MIL + + REQUEST Meaning: the primary moderator of the group + Syntax: 822 address + Example: Unix-Wizards-Request@BRL.MIL + + FLAGS Meaning: locally meaningful flags associated + with the discussion group; this memo + leaves interpretation of this + parameter to each POP3 implementation + Syntax: octal number + Example: 01 + + MAXIMA Meaning: the magic cookie associated with the + last message locally received for the + group; it is the property of the magic + cookie that it's value NEVER + decreases, and increases by at least + one each time a message is locally + received + Syntax: decimal number + Example: 1004 + + LASTDATE Meaning: the date that the last message was + locally received + Syntax: 822 date + Example: Thu, 19 Dec 85 10:26:48 -0800 + + Note that the last two values are locally determined for the maildrop + associated with the discussion group and with each message in that + maildrop. Note however that the last message in the maildrop have a + different MAXIMA and LASTDATE than the discussion group. This often + occurs when the maildrop has been archived. + + + + + +Rose [Page 5] + +RFC 1082 POP3 Extended Service November 1988 + + + Finally, some local systems provide mechanisms for automatically + archiving discussion group mail. In some cases, a two-level archive + scheme is used: current mail is kept in the standard maildrop, + recent mail is kept in an archive maildrop, and older mail is kept + off-line. With this scheme, in addition to having a "standard" + maildrop for each discussion group, an "archive" maildrop may also be + available. This permits a user agent to examine the most recent + archive using the same mechanisms as those used on the current mail. + +The XTND Command + + The following commands are valid only in the TRANSACTION state of the + POP3. This implies that the POP3 server has already opened the + user's maildrop (which may be empty). This maildrop is called the + "default maildrop". The phrase "closes the current maildrop" has two + meanings, depending on whether the current maildrop is the default + maildrop or is a maildrop associated with a discussion group. + + In the former context, when the current maildrop is closed any + messages marked as deleted are removed from the maildrop currently in + use. The exclusive-access lock on the maildrop is then released + along with any implementation-specific resources (e.g., file- + descriptors). + + In the latter context, a maildrop associated with a discussion group + is considered to be read-only to the POP3 client. In this case, the + phrase "closes the current maildrop" merely means that any + implementation-specific resources are released. (Hence, the POP3 + command DELE is a no-op.) + + All the new facilities are introduced via a single POP3 command, + XTND. All positive reponses to the XTND command are multi-line. + + The most common multi-line response to the commands contains a + "discussion group listing" which presents the name of the discussion + group along with it's maxima. In order to simplify parsing all POP3 + servers are required to use a certain format for discussion group + listings: + + NAME SP MAXIMA + + This memo makes no requirement on what follows the maxima in the + listing. Minimal implementations should just end that line of the + response with a CRLF pair. More advanced implementations may include + other information, as parsed from the message. + + NOTE: This memo STRONGLY discourages implementations from + supplying additional information in the listing. + + + +Rose [Page 6] + +RFC 1082 POP3 Extended Service November 1988 + + + XTND BBOARDS [name] + Arguments: the name of a discussion group (optionally) + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + If an argument was given, the POP3 server closes the current + maildrop. The POP3 server then validates the argument as the name of + a discussion group. If this is successful, it opens the maildrop + associated with the group, and returns a multi-line response + containing the discussion group listing. If the discussion group + named is not valid, or the associated archive maildrop is not + readable by the user, then an error response is returned. + + If no argument was given, the POP3 server issues a multi-line + response. After the initial +OK, for each discussion group known, + the POP3 server responds with a line containing the listing for that + discussion group. Note that only world-readable discussion groups + are included in the multi-line response. + + In order to aid user agents, this memo requires an extension to the + scan listing when an "XTND BBOARDS" command has been given. + Normally, a scan listing, as generated by the LIST, takes the form: + + MSGNO SIZE + + where MSGNO is the number of the message being listed and SIZE is the + size of the message in octets. When reading a maildrop accessed via + "XTND BBOARDS", the scan listing takes the form + + MSGNO SIZE MAXIMA + + where MAXIMA is the maxima that was assigned to the message when it + was placed in the BBoard. + + Possible Responses: + +OK XTND + -ERR no such bboard + Examples: + C: XTND BBOARDS + S: +OK XTND + S: system 10 + S: mh-users 100 + S: . + C: XTND BBOARDS system + S: + OK XTND + S: system 10 + S: . + + + + +Rose [Page 7] + +RFC 1082 POP3 Extended Service November 1988 + + + XTND ARCHIVE name + Arguments: the name of a discussion group (required) + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + The POP3 server closes the current maildrop. The POP3 server then + validates the argument as the name of a discussion group. If this is + successful, it opens the archive maildrop associated with the group, + and returns a multi-line response containing the discussion group + listing. If the discussion group named is not valid, or the + associated archive maildrop is not readable by the user, then an + error response is returned. + + In addition, the scan listing generated by the LIST command is + augmented (as described above). + + Possible Responses: + +OK XTND + -ERR no such bboard Examples: + C: XTND ARCHIVE system + S: + OK XTND + S: system 3 + S: . + + XTND X-BBOARDS name + Arguments: the name of a discussion group (required) + Restrictions: may only be given in the TRANSACTION state. + Discussion: + + The POP3 server validates the argument as the name of a + discussion group. If this is unsuccessful, then an error + response is returned. Otherwise a multi-line response is + returned. The first 14 lines of this response (after the + initial +OK) are defined in this memo. Minimal implementations + need not include other information (and may omit certain + information, outputing a bare CRLF pair). More advanced + implementations may include other information. + + Line Information (refer to "Definition of Terms") + ---- ----------- + 1 NAME + 2 ALIASES, separated by SP + 3 system-specific: maildrop + 4 system-specific: archive maildrop + 5 system-specific: information + 6 system-specific: maildrop map + 7 system-specific: encrypted password + 8 system-specific: local leaders, separated by SP + + + +Rose [Page 8] + +RFC 1082 POP3 Extended Service November 1988 + + + 9 ADDRESS + 10 REQUEST + 11 system-specific: incoming feed + 12 system-specific: outgoing feeds + 13 FLAGS SP MAXIMA + 14 LASTDATE + + Most of this information is entirely too specific to the UCI Version + of the Rand MH Message Handling System [MRose85]. Nevertheless, + lines 1, 2, 9, 10, 13, and 14 are of general interest, regardless of + the implementation. + + Possible Responses: + +OK XTND + -ERR no such bboard + Examples: + C: XTND X-BBOARDS system + S: + OK XTND + S: system + S: local general + S: /usr/bboards/system.mbox + S: /usr/bboards/archive/system.mbox + S: /usr/bboards/.system.cnt + S: /usr/bboards/.system.map + S: * + S: mother + S: system@nrtc.northrop.com + S: system-request@nrtc.northrop.com + S: + S: dist-system@nrtc-gremlin.northrop.com + S: 01 10 + S: Thu, 19 Dec 85 00:08:49 -0800 + S: . + +Policy Notes + + Depending on the particular entity administrating the POP3 service + host, two additional policies might be implemented: + + 1. Private Discussion Groups + + In the general case, discussion groups are world-readable, any user, + once logged in (via a terminal, terminal server, or POP3, etc.), is + able to read the maildrop for each discussion group known to the POP3 + service host. Nevertheless, it is desirable, usually for privacy + reasons, to implement private discussion groups as well. + + Support of this is consistent with the extensions outlined in this + + + +Rose [Page 9] + +RFC 1082 POP3 Extended Service November 1988 + + + memo. Once the AUTHORIZATION state has successfully concluded, the + POP3 server grants the user access to exactly those discussion groups + the POP3 service host permits the authenticated user to access. As a + "security" feature, discussion groups associated with unreadable + maildrops should not be listed in a positive response to the XTND + BBOARDS command. + + 2. Anonymous POP3 Users + + In order to minimize the authentication problem, a policy permitting + "anonymous" access to the world-readable maildrops for discussion + groups on the POP3 server may be implemented. + + Support of this is consistent with the extensions outlined in this + memo. The POP3 server can be modified to accept a USER command for a + well-known pseudonym (i.e., "anonymous") which is valid with any PASS + command. As a "security" feature, it is advisable to limit this kind + of access to only hosts at the local site, or to hosts named in an + access list. + +Experiences and Conclusions + + All of the facilities described in this memo and in [RFC1081] have + been implemented in MH #6.1. Initial experiences have been, on the + whole, very positive. + + After the first implementation, some performance tuning was required. + This consisted primarily of caching the datastructures which describe + discussion groups in the POP3 server. A second optimization + pertained to the client: the program most commonly used to read + BBoards in MH was modified to retrieve messages only when needed. + Two schemes are used: + + o If only the headers (and the first few lines of the body) of + the message are required (e.g., for a scan listing), then only + these are retrieved. The resulting output is then cached, on + a per-message basis. + + o If the entire message is required, then it is retrieved intact, + and cached locally. + + With these optimizations, response time is quite adequate when the + POP3 server and client are connected via a high-speed local area + network. In fact, the author uses this mechanism to access certain + private discussion groups over the Internet. In this case, response + is still good. When a 9.6Kbps modem is inserted in the path, + response went from good to almost tolerable (fortunately the author + only reads a few discussion groups in this fashion). + + + +Rose [Page 10] + +RFC 1082 POP3 Extended Service November 1988 + + + To conclude: the POP3 is a good thing, not only for personal mail but + for discussion group mail as well. + + +References + + [RFC1081] Rose, M., "Post Office Protocol - Verison 3 (POP3)", RFC + 1081, TWG, November 1988. + + [MRose85] Rose, M., and J. Romine, "The Rand MH Message Handling + System: User's Manual", University of California, Irvine, + November 1985. + + [RFC822] Crocker, D., "Standard for the Format of ARPA-Internet + Text Messages", RFC 822, University of Delaware, August + 1982. + + [RFC918] Reynolds, J., "Post Office Protocol", RFC 918, + USC/Information Sciences Institute, October 1984. + + [RFC937] Butler, M., J. Postel, D. Chase, J. Goldberger, and J. + Reynolds, "Post Office Protocol - Version 2", RFC 937, + USC/Information Sciences Institute, February 1985. + +Author's Address: + + + Marshall Rose + The Wollongong Group + 1129 San Antonio Rd. + Palo Alto, California 94303 + + Phone: (415) 962-7100 + + Email: MRose@TWG.COM + + + + + + + + + + + + + + + + +Rose [Page 11] + \ No newline at end of file diff --git a/appl/popper/pop_dele.c b/appl/popper/pop_dele.c new file mode 100644 index 000000000..808e555fe --- /dev/null +++ b/appl/popper/pop_dele.c @@ -0,0 +1,59 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_dele.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include +#include "popper.h" + +/* + * dele: Delete a message from the POP maildrop + */ +pop_dele (p) +POP * p; +{ + MsgInfoList * mp; /* Pointer to message info list */ + int msg_num; + + /* Convert the message number parameter to an integer */ + msg_num = atoi(p->pop_parm[1]); + + /* Is requested message out of range? */ + if ((msg_num < 1) || (msg_num > p->msg_count)) + return (pop_msg (p,POP_FAILURE,"Message %d does not exist.",msg_num)); + + /* Get a pointer to the message in the message list */ + mp = &(p->mlp[msg_num-1]); + + /* Is the message already flagged for deletion? */ + if (mp->del_flag) + return (pop_msg (p,POP_FAILURE,"Message %d has already been deleted.", + msg_num)); + + /* Flag the message for deletion */ + mp->del_flag = TRUE; + +#ifdef DEBUG + if(p->debug) + pop_log(p,POP_DEBUG,"Deleting message %u at offset %u of length %u\n", + mp->number,mp->offset,mp->length); +#endif DEBUG + + /* Update the messages_deleted and bytes_deleted counters */ + p->msgs_deleted++; + p->bytes_deleted += mp->length; + + /* Update the last-message-accessed number if it is lower than + the deleted message */ + if (p->last_msg < msg_num) p->last_msg = msg_num; + + return (pop_msg (p,POP_SUCCESS,"Message %d has been deleted.",msg_num)); +} diff --git a/appl/popper/pop_last.c b/appl/popper/pop_last.c new file mode 100644 index 000000000..a8b0e274c --- /dev/null +++ b/appl/popper/pop_last.c @@ -0,0 +1,24 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_last.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include "popper.h" + +/* + * last: Display the last message touched in a POP session + */ + +int pop_last (p) +POP * p; +{ + return (pop_msg(p,POP_SUCCESS,"%u is the last message seen.",p->last_msg)); +} diff --git a/appl/popper/pop_list.c b/appl/popper/pop_list.c new file mode 100644 index 000000000..a162461d7 --- /dev/null +++ b/appl/popper/pop_list.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_list.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include "popper.h" + +/* + * list: List the contents of a POP maildrop + */ + +int pop_list (p) +POP * p; +{ + MsgInfoList * mp; /* Pointer to message info list */ + register int i; + register int msg_num; + + /* Was a message number provided? */ + if (p->parm_count > 0) { + msg_num = atoi(p->pop_parm[1]); + + /* Is requested message out of range? */ + if ((msg_num < 1) || (msg_num > p->msg_count)) + return (pop_msg (p,POP_FAILURE, + "Message %d does not exist.",msg_num)); + + /* Get a pointer to the message in the message list */ + mp = &p->mlp[msg_num-1]; + + /* Is the message already flagged for deletion? */ + if (mp->del_flag) + return (pop_msg (p,POP_FAILURE, + "Message %d has been deleted.",msg_num)); + + /* Display message information */ + return (pop_msg(p,POP_SUCCESS,"%u %u",msg_num,mp->length)); + } + + /* Display the entire list of messages */ + pop_msg(p,POP_SUCCESS, + "%u messages (%u octets)", + p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); + + /* Loop through the message information list. Skip deleted messages */ + for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) { + if (!mp->del_flag) + (void)fprintf(p->output,"%u %u\r\n",mp->number,mp->length); + } + + /* "." signals the end of a multi-line transmission */ + (void)fprintf(p->output,".\r\n"); + (void)fflush(p->output); + + return(POP_SUCCESS); +} diff --git a/appl/popper/pop_lower.c b/appl/popper/pop_lower.c new file mode 100644 index 000000000..531433893 --- /dev/null +++ b/appl/popper/pop_lower.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_lower.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include + +/* + * lower: Convert a string to lowercase + */ + +pop_lower (buf) +char * buf; +{ + char * mp; + + for (mp = buf; *mp; mp++) + if (isupper(*mp) && isupper(*mp)) *mp = (char)tolower((int)*mp); +} diff --git a/appl/popper/pop_parse.c b/appl/popper/pop_parse.c new file mode 100644 index 000000000..b0581de20 --- /dev/null +++ b/appl/popper/pop_parse.c @@ -0,0 +1,64 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_parse.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include +#include "popper.h" + +/* + * parse: Parse a raw input line from a POP client + * into null-delimited tokens + */ + +pop_parse(p,buf) +POP * p; +char * buf; /* Pointer to a message containing + the line from the client */ +{ + char * mp; + register int i; + + /* Loop through the POP command array */ + for (mp = buf, i = 0; ; i++) { + + /* Skip leading spaces and tabs in the message */ + while (isspace(*mp))mp++; + + /* Are we at the end of the message? */ + if (*mp == 0) break; + + /* Have we already obtained the maximum allowable parameters? */ + if (i >= MAXPARMCOUNT) { + pop_msg(p,POP_FAILURE,"Too many arguments supplied."); + return(-1); + } + + /* Point to the start of the token */ + p->pop_parm[i] = mp; + + /* Search for the first space character (end of the token) */ + while (!isspace(*mp) && *mp) mp++; + + /* Delimit the token with a null */ + if (*mp) *mp++ = 0; + } + + /* Were any parameters passed at all? */ + if (i == 0) return (-1); + + /* Convert the first token (POP command) to lower case */ + pop_lower(p->pop_command); + + /* Return the number of tokens extracted minus the command itself */ + return (i-1); + +} diff --git a/appl/popper/pop_quit.c b/appl/popper/pop_quit.c new file mode 100644 index 000000000..b379b5071 --- /dev/null +++ b/appl/popper/pop_quit.c @@ -0,0 +1,27 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_quit.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include "popper.h" + +/* + * quit: Terminate a POP session + */ + +int pop_quit (p) +POP * p; +{ + /* Release the message information list */ + if (p->mlp) free ((char *)p->mlp); + + return(POP_SUCCESS); +} diff --git a/appl/popper/pop_rset.c b/appl/popper/pop_rset.c new file mode 100644 index 000000000..344d390ba --- /dev/null +++ b/appl/popper/pop_rset.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_rset.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include "popper.h" + +/* + * rset: Unflag all messages flagged for deletion in a POP maildrop + */ + +int pop_rset (p) +POP * p; +{ + MsgInfoList * mp; /* Pointer to the message info list */ + register int i; + + /* Unmark all the messages */ + for (i = p->msg_count, mp = p->mlp; i > 0; i--, mp++) + mp->del_flag = FALSE; + + /* Reset the messages-deleted and bytes-deleted counters */ + p->msgs_deleted = 0; + p->bytes_deleted = 0; + + /* Reset the last-message-access flag */ + p->last_msg = 0; + + return (pop_msg(p,POP_SUCCESS,"Maildrop has %u messages (%u octets)", + p->msg_count,p->drop_size)); +} diff --git a/appl/popper/pop_stat.c b/appl/popper/pop_stat.c new file mode 100644 index 000000000..9daa24fe0 --- /dev/null +++ b/appl/popper/pop_stat.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_stat.c 2.2 2.2 3/18/91"; +#endif not lint + +#include +#include +#include "popper.h" + +/* + * stat: Display the status of a POP maildrop to its client + */ + +int pop_stat (p) +POP * p; +{ +#ifdef DEBUG + if (p->debug) pop_log(p,POP_DEBUG,"%d message(s) (%d octets).",p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted); +#endif DEBUG + return (pop_msg (p,POP_SUCCESS, + "%u %u",p->msg_count-p->msgs_deleted,p->drop_size-p->bytes_deleted)); +} diff --git a/appl/popper/pop_xtnd.c b/appl/popper/pop_xtnd.c new file mode 100644 index 000000000..fcc01094b --- /dev/null +++ b/appl/popper/pop_xtnd.c @@ -0,0 +1,38 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + */ + +#ifndef lint +static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; +static char SccsId[] = "@(#)@(#)pop_xtnd.c 2.1 2.1 3/18/91"; +#endif not lint + +#include +#include +#include "popper.h" + +/* + * xtnd: Handle extensions to the POP protocol suite + */ + +extern xtnd_table * pop_get_subcommand(); + +int pop_xtnd (p) +POP * p; +{ + xtnd_table * x; + + /* Convert the XTND subcommand to lower case */ + pop_lower(p->pop_subcommand); + + /* Search for the subcommand in the XTND command table */ + if ((x = pop_get_subcommand(p)) == NULL) return(POP_FAILURE); + + /* Call the function associated with this subcommand */ + if (x->function) return((*x->function)(p)); + + /* Otherwise assume NOOP */ + return (pop_msg(p,POP_SUCCESS,NULL)); +} diff --git a/appl/popper/popper.8 b/appl/popper/popper.8 new file mode 100644 index 000000000..390809ac4 --- /dev/null +++ b/appl/popper/popper.8 @@ -0,0 +1,155 @@ +.\" Copyright (c) 1980 Regents of the University of California. +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms are permitted +.\" provided that this notice is preserved and that due credit is given +.\" to the University of California at Berkeley. The name of the University +.\" may not be used to endorse or promote products derived from this +.\" software without specific prior written permission. This software +.\" is provided ``as is'' without express or implied warranty. +.\" +.\" @(#)@(#)popper.8 2.3 2.3 (CCS) 4/2/91 Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n +.\" +.TH popper 8 "August 1990" +.UC 6 +.ad +.SH NAME +popper \- pop 3 server +.SH SYNOPSIS +.B /usr/etc/popper +[ -d ] +[ -t trace-file] +.SH DESCRIPTION +.I Popper +is an implementation of the Post Office Protocol server that runs on a +variety of Unix computers to manage electronic mail for Macintosh +and MS-DOS computers. The server was developed at the University of +California at Berkeley and conforms fully to the specifications in RFC +1081 and RFC 1082. The Berkeley server also has extensions to +send electronic mail on behalf of a client. +.PP +The +.B \-d +flag sets the socket to debugging and turns on debugging. All debugging +information is saved using syslog(8). The +.B \-t trace\-file +flag turns on debugging and saves the trace information in +.I trace\-file +using fprintf(s). +.SH HOW TO OBTAIN THE SERVER +.PP +The POP server is available via anonymous ftp from ftp.CC.Berkeley.EDU +(128.32.136.9, 128.32.206.12). It is in two files in the pub directory: +a compressed +tar file popper.tar.Z and a Macintosh StuffIt archive in BinHex format +called MacPOP.sit.hqx. +.SH THE POP TRANSACTION CYCLE +.PP +The Berkeley POP server is a single program (called popper) that is +launched by inetd when it gets a service request on the POP TCP port. +(The official port number specified in RFC 1081 for POP version 3 is +port 110. However, some POP3 clients attempt to contact the server at +port 109, the POP version 2 port. Unless you are running both POP2 and +POP3 servers, you can simply define both ports for use by the POP3 +server. This is explained in the installation instructions later on.) +The popper program initializes and verifies that the peer IP address is +registered in the local domain, logging a warning message when a +connection is made to a client whose IP address does not have a +canonical name. For systems using BSD 4.3 bind, it also checks to see +if a cannonical name lookup for the client returns the same peer IP +address, logging a warning message if it does not. The the server +enters the authorization state, during which the client must correctly +identify itself by providing a valid Unix userid and password on the +server's host machine. No other exchanges are allowed during this +state (other than a request to quit.) If authentication fails, a +warning message is logged and the session ends. Once the user is +identified, popper changes its user and group ids to match that of the +user and enters the transaction state. The server makes a temporary +copy of the user's maildrop (ordinarily in /usr/spool/mail) which is +used for all subsequent transactions. These include the bulk of POP +commands to retrieve mail, delete mail, undelete mail, and so forth. A +Berkeley extension also allows the user to submit a mail parcel to the +server who mails it using the sendmail program (this extension is +supported in the HyperMail client distributed with the server). When +the client quits, the server enters the final update state during which +the network connection is terminated and the user's maildrop is updated +with the (possibly) modified temporary maildrop. +.SH LOGGING +.PP +The POP server uses syslog to keep a record of its activities. On +systems with BSD 4.3 syslogging, the server logs (by default) to the +"local0" facility at priority "notice" for all messages except +debugging which is logged at priority "debug". The default log file is +/usr/spool/mqueue/POPlog. These can be changed, if desired. On +systems with 4.2 syslogging all messages are logged to the local log +file, usually /usr/spool/mqueue/syslog. +.SH DEBUGGING +.PP +The popper program will log debugging information when the -d parameter +is specified after its invocation in the inetd.conf file. Care should +be exercised in using this option since it generates considerable +output in the syslog file. Alternatively, the "-t " option +will place debugging information into file "" using fprintf +instead of syslog. +.PP +For SunOS version 3.5, the popper program is launched by inetd from +/etc/servers. This file does not allow you to specify command line +arguments. Therefore, if you want to enable debugging, you can specify +a shell script in /etc/servers to be launched instead of popper and in +this script call popper with the desired arguments. +.PP +You can confirm that the POP server is running on Unix by telneting to +port 110 (or 109 if you set it up that way). For example: +.PP +.nf +%telnet myhost 110 +Trying... +Connected to myhost.berkeley.edu. +Escape character is '^]'. ++OK UCB Pop server (version 1.6) at myhost starting. +quit +Connection closed by foreign host. +.fi +.SH VERSION 1.7 RELEASE NOTES +Extensive re-write of the maildrop processing code contributed by +Viktor Dukhovni that greatly reduces the +possibility that the maildrop can be corrupted as the result of +simultaneous access by two or more processes. +.PP +Added "pop_dropcopy" module to create a temporary maildrop from +the existing, standard maildrop as root before the setuid and +setgid for the user is done. This allows the temporary maildrop +to be created in a mail spool area that is not world read-writable. +.PP +This version does *not* send the sendmail "From " delimiter line +in response to a TOP or RETR command. +.PP +Encased all debugging code in #ifdef DEBUG constructs. This code can +be included by specifying the DEGUG compiler flag. Note: You still +need to use the -d or -t option to obtain debugging output. +.SH LIMITATIONS +The POP server copies the user's entire maildrop to /tmp and +then operates on that copy. If the maildrop is particularly +large, or inadequate space is available in /tmp, then the +server will refuse to continue and terminate the connection. +.PP +Simultaneous modification of a single maildrop can result in +confusing results. For example, manipulating messages in a +maildrop using the Unix /usr/ucb/mail command while a copy of +it is being processed by the POP server can cause the changes +made by one program to be lost when the other terminates. This +problem is being worked on and will be fixed in a later +release. +.SH FILES +.nf +/usr/spool/mail mail files +/etc/inetd.conf pop program invocation +/etc/syslog.conf logging specifications +.fi +.SH "SEE ALSO" +inetd(8), +RFC1081, +RFC1082 +.SH AUTHORS +Bob Campbell, Edward Moy, Austin Shelton, Marshall T Rose, and cast of +thousands at Rand, UDel, UCI, and elsewhere diff --git a/appl/popper/popper.README.release b/appl/popper/popper.README.release new file mode 100644 index 000000000..c0b313ecd --- /dev/null +++ b/appl/popper/popper.README.release @@ -0,0 +1,45 @@ +Release Notes: + +popper-1.831beta is no longer beta 30 July 91 + Removed popper-1.7.tar.Z + +popper-1.831beta.tar.Z 03 April 91 + Changed mkstemp to mktemp for Ultrix. Sigh. + +popper-1.83beta.tar.Z 02 April 91 + + This version makes certain that while running as root we do nothing + at all destructive. + +popper-1.82beta.tar.Z 27 March 91 + + This version fixes problems on Encore MultiMax and some Sun releases + which wouldn't allow a user to ftruncate() a file from an open + file descripter unless the user owns the file. Now the user + owns the /usr/spool/mail/.userid.pop file. Thanks to Ben Levy + of FTP Software and Henry Holtzman of Apple. + +popper-1.81beta.tar.Z 20 March 91 + + This version of popper is supposed to fix three problems reported + with various versions of popper (all called 1.7 or 1.7something). + + 1) Dropped network connections meant lost mail files. Some 1.7 + versions also risked corrupting mail files. + + 2) Some versions of 1.7 created temporary drop files with world + read and write permissions. + + 3) Some versions of 1.7 were not careful about opening the temporary + drop file. + +popper-1.7.tar.Z 09 September 90 (updated 20 March 91) + + This version will exhibit the first problem listed above if it is + compiled with -DDEBUG and run without the "-d" (debug) flag. + + If it is compiled without -DDEBUG it will exhibit only the second + and third bug listed above. + +Cliff Frost poptest@nettlesome.berkeley.edu +UC Berkeley diff --git a/appl/popper/version.h b/appl/popper/version.h new file mode 100644 index 000000000..6c61caa04 --- /dev/null +++ b/appl/popper/version.h @@ -0,0 +1,15 @@ +/* + * Copyright (c) 1989 Regents of the University of California. + * All rights reserved. The Berkeley software License Agreement + * specifies the terms and conditions for redistribution. + * + * static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n"; + * static char SccsId[] = "@(#)@(#)version.h 2.6 2.6 4/3/91"; + * + */ + +/* + * Current version of this POP implementation + */ + +#define VERSION "1.831beta" diff --git a/appl/telnet/Config.generic b/appl/telnet/Config.generic new file mode 100644 index 000000000..4f7569cb0 --- /dev/null +++ b/appl/telnet/Config.generic @@ -0,0 +1,916 @@ +# +# Copyright (c) 1991 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted provided +# that: (1) source distributions retain this entire copyright notice and +# comment, and (2) distributions including binaries display the following +# acknowledgement: ``This product includes software developed by the +# University of California, Berkeley and its contributors'' in the +# documentation or other materials provided with the distribution and in +# all advertising materials mentioning features or use of this software. +# Neither the name of the University nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)Config.generic 5.5 (Berkeley) 3/1/91 +# + +# This is the configuration file for building all of +# telnet/telnetd/libtelnet. If you want to add your +# own local configuration for a specific machine that +# is already listed here, it is best to create a new +# file called "Config.local", and put the definitions +# there. If you are adding definitions for a new system +# type, you can add them here. In this case, please send +# the new definition, and any changes you have to make to +# the code, back to "dab@cray.com" so that your changes +# can be put into the next release. +# +# Each definition must have the form: +# +# : +# make -f Makefile.generic ${WHAT} \ +# + +# DEFINES= +# +# Variables to be defined when actually compiling the source. Defined +# as: DEFINES="-D -D ... -D" +# +# TELNET/TELNETD CONFIGURATION +# +# LINEMODE Turns on support in telnetd for the linemode option. +# (Linemode is always on in the client). +# +# KLUDGELINEMODE Define this to get the kludged up version of linemode +# that was in 4.3BSD. This is a good thing to have +# around for talking to older systems. This has no +# effect on telnetd if LINEMODE has not been defined. +# +# DIAGNOSTICS Turns on diagnostic code in telnetd; adds extra +# logic and checks, and debuging output if started +# with the -D option. +# +# NO_URGENT Define this if you don't want telnetd to send +# IAC DM in urgent mode when the pty output queue +# is flushed. +# +# GENERATE_GA Turns on code to allow the generation of Go Ahead(GA) +# if the server is WONT SGA. This code is imprecise, +# it generates the GA when two seconds have elapsed +# and no input or output has occurred. +# +# AUTHENTICATION Enable the AUTHENTICATION option. +# +# ENCRYPTION Enable the ENCRYPT option. +# +# KRB4 Enable Kerberos Version 4 Authentication code +# in libtelnet/libtelnet.a +# +# KRB5 Enable Kerberos Version 5 Authentication code +# in libtelnet/libtelnet.a +# +# SPX Enable SPX authentication code in. +# libtelnet/libtelnet.a +# +# RSA_ENCPWD +# +# KRB4_ENCPWD +# +# +# DES_ENCRYPTION Enable DES encryption/decryption, requires +# getting a the initial key from Kerberos. This +# works with both Kerberos Version 4 and 5. +# +# ENV_HACK Turn on code to recognize and allow +# interoperability with systems that have their +# definitions for ENV_VALUE and ENV_VAR reversed. +# +# LOCAL SYSYTEM PARAMATERS +# +# TERMCAP Define this if your system is termcap based, +# otherwise a terminfo based system is assumed. +# +# SYSV_TERMIO Use the System V termio structure. (implies USE_TERMIO) +# +# NO_CC_T Define this if your termio.h file does not have +# a typedef for cc_t. +# +# USE_TERMIO Define this if you have the POSIX termios structures. +# This code works under the BSD 4.4 terminal driver. +# +# HAS_GETTOS Define this if you have the setsockopt() option for +# setting the IP Type Of Service bits, (IP_TOS) and +# you have the gettosbyname() function. +# +# NEWINIT Turns on the new init code for UNICOS systems. +# +# STREAMS This system needs for +# (Sun 4.0.3) +# +# FILIO_H This system should use instead +# of (Sun 4.0.3) +# +# HAVE_fd_set This system has a typedef for fd_set, but does +# not have FDSET() defined. +# +# NO_STRING_H If you don't have , but have +# +# NO_LOGIN_P If /bin/login doesn't understand the "-p" +# (preserve environment) option. +# +# LOGIN_ARGS if /bin/login understands environment variables +# after the login name. Only used if NO_LOGIN_P +# is defined. +# +# NO_LOGIN_F If /bin/login doesn't understand the "-f" option. +# Only used if AUTHENTICATION is defined. +# +# LOGIN_R This says that /bin/login understands the "-r host" +# option. Only used if NO_LOGIN_F is defined (and +# the system supports the TIOCSTI ioctl). +# +# LOGIN_HOST Only applies if LOGIN_R is defined. This +# specifies the hostname to be passed to "login -r" +# for successfully authenticated logins. This +# defaults to "localhost" (don't forget to include +# the quotes, e.g. -DLOGIN_HOST=\"localhost\"). +# +# It can also be set to host (-DLOGIN_HOST=host) +# to have the real hostname passed to "/bin/login -r". +# NOTE: If you do this, then anyone that wants to +# allow authenticated login access will have +# to add those remote hosts to their .rhosts, +# which sort of defeats the whole purpose of +# authenticated login... +# +# NO_BSD_SETJMP For UNICOS releases prior to 7.0. Turns off +# the inclusion of . +# +# STREAMS If the system has streams; causes +# to be included instead of +# +# MUST_ALIGN If !KRB & !HAVE_KRB4_DES_LIB and your words +# must be word aligned. +# +# STREAMSPTY Use /dev/ptmx to get a clean pty. Uses +# streams packet mode rather than Berkeley. +# Appropriate for SVr4 derivatives. +# +# UTMPX System has /etc/utmpx as well as /etc/utmp. +# Use makeutx and modutx to update utmp/x and wtmp/x. +# Appropriate for SVr4 derivatives. +# +# HAS_CGETENT If your system has the cgetent() and cgetstr() +# routines. This is a 4.4BSD feature, that +# eliminates grabbing the getty gettytab.c source. +# You need to include getent.o on the LIB_OBJ +# line if this is defined. +# +# OLD_ENVIRON Support for the old environment option. +# +# NO_MKTIME If you don't have mktime(). + +# LIB_OBJ= +# This is a list of object files that are needed but are not in +# the standard C library. +# +# strcasecmp.o If you don't have strncasecmp(3) +# strdup.o If you don't have strdup(3) +# setenv.o If you don't have setenv(3) and unsetenv(3) +# setsid.o If you don't have the POSIX setsid() call +# strerror.o If you don't have strerror(3) +# strftime.o If you don't have strftime(3) +# getopt.o If you don't have getopt(3) +# herror.o If you don't have herror(3) +# gettytab.o If you can get gettytab.c from getty source. +# getent.o If you can't get gettytab.c (or have +# HAS_CGETENT defined...) +# mem.o If you don't have mem*(3) routines. + +# LIB_SRC= +# This is a list of source modules for specificed in LIB_OBJ. +# This information is used by make for checking dependencies. + + +# LIBS= +# This is a list of libraries to be included. This will always +# include the telnet library, and will also include either -lcurses +# or -ltermcap, -lutil for 4.4bsd, and -lnet for UNICOS5.0 and earlier. +# Also -lkrb & -ldes if Kerberos. + +# LIBPATH= +# This is a list of the paths to all the libraries listed in LIBS. +# This information is used by make for checking dependencies. +# Don't forget libc.a + +# VPATH= +# Directory where gettytab.c can be found, if you have it. + +# LIBEXEC= +# Directory where the telnetd executable should be installed. + +# LCCFLAGS= +# Local flags for ${CC} (like -O) + +# AR= +# Name of "ar" program, usually just "ar". + +# ARFLAGS +# Flags to pass to ${AR} + +# RANLIB +# Name of "ranlib" program, set it to "NONE" if you don't +# have a "ranlib". + +all: + @echo "You must specify what type of system you are on," + @echo "or setup a Config.local file for your system." + @echo "Known system types are:" + @echo + @echo " 4.4bsd 4.3reno 4.4bsd.auth 4.3reno.auth 4.3tahoe 4.3bsd" + @echo " bsdi1.0 bsdi1.0.auth" + @echo " unicos9.0 unicos8.3 unicos8.0 unicos7.C unicos7.0 unicos6.1" + @echo " unicos9.0.auth unicos8.3.auth unicos8.0.auth unicos7.0.auth" + @echo " unicos7.C.auth unicos7.0.des.auth" + @echo " sun3.5 sun4.0.3c sun4.0 sun4.1 sun4.1.auth" + @echo " solaris2.2 solaris2.2.auth" + @echo " dynix3.0.12 dynix3.0.17" + @echo " ultrix3.1 ultrix4.0 ultrix4.1 ultrix4.3 ultrix4.3.auth" + @echo " irix4.0.1" + @echo " hpux8.0" + @echo " next1.0" + @echo " convex" + +4.4bsd: + make -f Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/usr/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DLINEMODE -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\n4.4 BSD UNIX (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + -DHAS_CGETENT ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-O" + +4.3reno: + make -f Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DLINEMODE -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\n4.3BSD-Reno UNIX (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK \ + -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="gettytab.o" \ + LIB_SRC="gettytab.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + VPATH=/usr/src/libexec/getty \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-O" + + +4.4bsd.auth 4.3reno.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION \ + -DKRB4 -DDES_ENCRYPTION" \ + AUTH_INC=-I/usr/include/kerberosIV + +4.3tahoe: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\n4.3BSD-Tahoe UNIX (%h) (%t)\r\n\r\r\n\r\"'\ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + INCLUDES="-I.." \ + LIB_OBJ="strdup.o setsid.o strftime.o gettytab.o" \ + LIB_SRC="strdup.c setsid.c strftime.c gettytab.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + VPATH=/usr/src/etc/getty \ + LIBEXEC=${DESTDIR}/etc \ + CC="${CC}" LCCFLAGS="-O" + +4.3bsd: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\n4.3BSD UNIX (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + INCLUDES="-I.." \ + LIB_OBJ="strdup.o setsid.o strftime.o \ + gettytab.o getopt.o herror.o" \ + LIB_SRC="strdup.c setsid.c strftime.c \ + gettytab.c getopt.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + VPATH=/usr/src/etc/getty \ + LIBEXEC=${DESTDIR}/etc \ + CC="${CC}" LCCFLAGS="-O" + +bsdi2.0: + make -f Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DLINEMODE -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nBSDI BSD/OS 2.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK \ + -DOLD_ENVIRON ${AUTH_DEF} -DHAS_CGETENT" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-O" + +bsdi2.0.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION \ + -DKRB4 -DDES_ENCRYPTION" \ + AUTH_INC=-I/usr/include/kerberosIV + +bsdi1.1: + make -f Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DLINEMODE -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nBSDI BSD/386 1.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK \ + -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="gettytab.o" \ + LIB_SRC="gettytab.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + VPATH=/usr/src/libexec/getty \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-O" + +bsdi1.1.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION \ + -DKRB4 -DDES_ENCRYPTION" \ + AUTH_INC=-I/usr/include/kerberosIV + +bsdi1.0: + make -f Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DLINEMODE -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nBSDI BSD/386 1.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK \ + -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="gettytab.o" \ + LIB_SRC="gettytab.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + VPATH=/usr/src/libexec/getty \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-O" + +bsdi1.0.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION \ + -DKRB4 -DDES_ENCRYPTION" + AUTH_INC=-I/usr/include/kerberosIV + +unicos9.1: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DLINEMODE -DKLUDGELINEMODE \ + -DSYSV_TERMIO -DHAS_GETTOS ${AUTH_DEF} \ + -DDEFAULT_IM='\"\r\nCray UNICOS 9.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + CC="${CC}" LCCFLAGS="-O" + +unicos9.0: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DLINEMODE -DKLUDGELINEMODE \ + -DSYSV_TERMIO -DHAS_GETTOS ${AUTH_DEF} \ + -DDEFAULT_IM='\"\r\nCray UNICOS 9.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + CC="${CC}" LCCFLAGS="-O" + +unicos8.3: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DLINEMODE -DKLUDGELINEMODE \ + -DSYSV_TERMIO -DHAS_GETTOS ${AUTH_DEF} \ + -DDEFAULT_IM='\"\r\nCray UNICOS 8.3 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + CC="${CC}" LCCFLAGS="-O" + +unicos8.0: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DLINEMODE -DKLUDGELINEMODE \ + -DSYSV_TERMIO -DHAS_GETTOS ${AUTH_DEF} \ + -DDEFAULT_IM='\"\r\nCray UNICOS 8.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + CC="${CC}" LCCFLAGS="-O" + +unicos7.C: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}"\ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DLINEMODE -DKLUDGELINEMODE \ + -DSYSV_TERMIO -DHAS_GETTOS ${AUTH_DEF} \ + -DDEFAULT_IM='\"\r\nCray UNICOS 7.C (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + CC="${CC}" LCCFLAGS="-O" + + +unicos7.0: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet -lkrb" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a /usr/lib/libkrb.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DLINEMODE -DKLUDGELINEMODE \ + -DSYSV_TERMIO -DHAS_GETTOS \ + -DDEFAULT_IM='\"\r\nCray UNICOS 7.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + CC="${CC}" LCCFLAGS="-O" + +# As of UNICOS 7.0.5.2, there is no longer a /usr/lib/libdes.a +# If you still have a /usr/lib/libdes.a, use the "unicos7.0.des.auth" +# target instead of "unicos7.0.auth". + +unicos9.1.auth unicos9.0.auth unicos8.3.auth unicos8.0.auth unicos7.0.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB=-lkrb AUTH_LIBPATH=/usr/lib/libkrb.a \ + AUTH_INC=-I/usr/include/krb \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION -DKRB4 -DDES_ENCRYPTION" + +unicos7.C.auth unicos7.0.des.auth: + make -f ../Config.generic `basename $@ .des.auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_INC=-I/usr/include/krb \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION -DKRB4 -DDES_ENCRYPTION" + +unicos6.1: + make -f Makefile.generic ${WHAT} \ + LIBS="-lcurses -L../libtelnet -ltelnet" \ + LIBPATH="/lib/libc.a /usr/lib/libcurses.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dvfork=fork -Dsignal=bsdsignal \ + -DKLUDGELINEMODE -DUSE_TERMIO -DHAS_GETTOS \ + -DLINEMODE -DSYSV_TERMIO -DNEWINIT \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_BSD_SETJMP \ + -DLOGIN_ARGS \ + -DDEFAULT_IM='\"\r\nCray UNICOS 6.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + AR=bld ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o parsetos.o" \ + LIB_SRC="getent.c parsetos.c" \ + CC="${CC}" LCCFLAGS="-O" + +sun3.5: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DTERMCAP -DKLUDGELINEMODE \ + -DHAVE_fd_set -DNO_MKTIME \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + -DDEFAULT_IM='\"\r\nSunOS UNIX 3.5 (%h) (%t)\r\n\r\r\n\r\"' \ + -DNO_LOGIN_P" \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o strdup.o strerror.o setsid.o \ + setenv.o strftime.o strcasecmp.o herror.o" \ + LIB_SRC="getent.c strdup.c strerror.c setsid.c \ + setenv.c strftime.c strcasecmp.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-O" + +sun3.5.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION -DKRB4 -DDES_ENCRYPTION" + +sun4.0.3c sun4.0: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DFILIO_H -DTERMCAP -DUSE_TERMIO -DNO_CC_T \ + -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nSunOS UNIX 4.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DSTREAMS -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + " \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o strerror.o setsid.o setenv.o \ + strcasecmp.o strftime.o herror.o" \ + LIB_SRC="getent.c strerror.c setsid.c setenv.c \ + strcasecmp.c strftime.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-O" + +sun4.1: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DFILIO_H -DTERMCAP -DUSE_TERMIO \ + -DKLUDGELINEMODE -DSTREAMS \ + -DDEFAULT_IM='\"\r\nSunOS UNIX 4.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o strerror.o setenv.o herror.o" \ + LIB_SRC="getent.c strerror.c setenv.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-O" + +sun4.1.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DENCRYPTION -DNO_LOGIN_F -DLOGIN_R \ + -DKRB4 -DDES_ENCRYPTION" + +sol2.2 solaris2.2: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermlib ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/usr/ccs/lib/libtermlib.a ../libtelnet/libtelnet.a \ + /usr/lib/libc.a /usr/ucblib/libucb.a \ + /usr/lib/libsocket.a /usr/lib/libnsl.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES="-DFILIO_H -DUSE_TERMIO -DKLUDGELINEMODE \ + -DSTREAMS -DSTREAMSPTY -DDIAGNOSTICS -DSOLARIS \ + -DENV_HACK -DOLD_ENVIRON -DNO_LOGIN_P -DUTMPX \ + -DDEFAULT_IM='\"\r\n\r\nUNIX(r) System V Release 4.0 (%h)\r\n\r\n\"' \ + -DLOGIN_ARGS ${AUTH_DEF}" \ + INCLUDES="-I.. -I/usr/ucbinclude ${AUTH_INC}" \ + LIB_OBJ="getent.o strerror.o setenv.o herror.o" \ + LIB_SRC="getent.c strerror.c setenv.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-O" + +sol2.2.auth solaris2.2.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb" AUTH_LIBPATH="/usr/lib/libkrb.a" \ + AUTH_INC=-I/usr/include/kerberos \ + AUTH_DEF="-DAUTHENTICATION -DKRB4" + +sol2.3 solaris2.3: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermlib ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/usr/ccs/lib/libtermlib.a ../libtelnet/libtelnet.a \ + /usr/lib/libc.a /usr/ucblib/libucb.a \ + /usr/lib/libsocket.a /usr/lib/libnsl.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES="-DFILIO_H -DUSE_TERMIO -DKLUDGELINEMODE \ + -DSTREAMS -DSTREAMSPTY -DDIAGNOSTICS -DSOLARIS \ + -DENV_HACK -DOLD_ENVIRON -DNO_LOGIN_P -DUTMPX \ + -DDEFAULT_IM='\"\r\n\r\nUNIX(r) System V Release 4.0 (%h)\r\n\r\n\"' \ + -DLOGIN_ARGS ${AUTH_DEF}" \ + INCLUDES="-I.. -I/usr/ucbinclude ${AUTH_INC}" \ + LIB_OBJ="getent.o strerror.o setenv.o herror.o" \ + LIB_SRC="getent.c strerror.c setenv.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-O" + +sol2.3.auth solaris2.3.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb /home/poplar36/gw/lib/libdes.a" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /home/poplar36/gw/lib/libdes.a"\ + AUTH_INC=-I/usr/include/kerberos \ + AUTH_DEF="-DAUTHENTICATION -DKRB4 -DENCRYPTION -DDES_ENCRYPTION" + +sol2.4 solaris2.4: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermlib ../libtelnet/libtelnet.a -lsocket -lnsl \ + ${AUTH_LIB}" \ + LIBPATH="/usr/ccs/lib/libtermlib.a ../libtelnet/libtelnet.a \ + /usr/lib/libc.a /usr/lib/libsocket.a \ + /usr/lib/libnsl.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES="-DFILIO_H -DUSE_TERMIO -DKLUDGELINEMODE \ + -DSTREAMS -DSTREAMSPTY -DDIAGNOSTICS -DSOLARIS \ + -DENV_HACK -DOLD_ENVIRON -DNO_LOGIN_P -DUTMPX \ + -DDEFAULT_IM='\"\r\n\r\nUNIX(r) System V Release 4.0 (%h)\r\n\r\n\"' \ + -Dsignal=sigset -DLOGIN_ARGS ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o strerror.o setenv.o herror.o" \ + LIB_SRC="getent.c strerror.c setenv.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-O" + +sol2.4.auth solaris2.4.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb " \ + AUTH_LIBPATH="/usr/lib/libkrb.a"\ + AUTH_INC=-I/usr/include/kerberos \ + AUTH_DEF="-DAUTHENTICATION -DKRB4 -DNO_LOGIN_F -DLOGIN_R" + +dynix3.0.12: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nDYNIX(R) V3.0.12 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON -DNO_STRING_H " \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o strchr.o strrchr.o strdup.o strerror.o \ + setsid.o setenv.o strcasecmp.o strftime.o getopt.o \ + mem.o" \ + LIB_SRC="getent.c strchr.c strrchr.c strdup.c strerror.c \ + setsid.c setenv.c strcasecmp.c strftime.c getopt.c \ + mem.o" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" + +dynix3.0.17: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a -lseq" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a /usr/lib/libseq.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DTERMCAP -DKLUDGELINEMODE \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON -DNO_STRING_H \ + -DDEFAULT_IM='\"\r\nDYNIX(R) V3.0.17 (%h) (%t)\r\n\r\r\n\r\"' \ + " \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o strchr.o strrchr.o strdup.o strerror.o \ + setsid.o strftime.o mem.o" \ + LIB_SRC="getent.c strchr.c strrchr.c strdup.c strerror.c \ + setsid.c strftime.c mem.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" + +ultrix3.1: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DTERMCAP -DKLUDGELINEMODE \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_LOGIN_H \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON -DUSE_TERMIO \ + -DDEFAULT_IM='\"\r\nULTRIX V3.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -YPOSIX" \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o strdup.o strerror.o setenv.o \ + strftime.o herror.o" \ + LIB_SRC="getent.c strdup.c strerror.c setenv.c \ + strftime.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" + +ultrix4.0: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DUSE_TERMIO -DTERMCAP \ + -DDEFAULT_IM='\"\r\nULTRIX V4.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DKLUDGELINEMODE -DDIAGNOSTICS \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_LOGIN_H \ + -DENV_HACK -DOLD_ENVIRON" \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o strdup.o strerror.o setsid.o \ + setenv.o strftime.o" \ + LIB_SRC="getent.c strdup.c strerror.c setsid.c \ + setenv.c strftime.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" + +ultrix4.1: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DUSE_TERMIO -DTERMCAP \ + -DDEFAULT_IM='\"\r\nULTRIX V4.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DKLUDGELINEMODE -DDIAGNOSTICS \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_LOGIN_H \ + -DENV_HACK -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o strdup.o" \ + LIB_SRC="getent.c strdup.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" +ultrix4.1.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DKRB4" + +ultrix4.3: + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DUSE_TERMIO -DTERMCAP \ + -DDEFAULT_IM='\"\r\nULTRIX V4.3 (%h) (%t)\r\n\r\r\n\r\"' \ + -DKLUDGELINEMODE -DDIAGNOSTICS \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_LOGIN_H \ + -DENV_HACK -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. ${AUTH_INC}" \ + LIB_OBJ="getent.o strdup.o" \ + LIB_SRC="getent.c strdup.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" + +ultrix4.3.auth: + make -f ../Config.generic `basename $@ .auth` WHAT=${WHAT} \ + AUTH_LIB="-lkrb -ldes" \ + AUTH_LIBPATH="/usr/lib/libkrb.a /usr/lib/libdes.a" \ + AUTH_DEF="-DAUTHENTICATION -DKRB4" + +irix4.0.1: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermlib ../libtelnet/libtelnet.a" \ + LIBPATH="/usr/lib/libc.a /usr/lib/libtermlib.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-Dvfork=fork -DUSE_TERMIO \ + -DDEFAULT_IM='\"\r\n\r\nIRIX System V.3 (%h) (%t)\r\n\r\r\n\r\"' \ + -DNO_LOGIN_F -DNO_LOGIN_P \ + -DDIAGNOSTICS " \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o setenv.o" \ + LIB_SRC="getent.c setenv.c" \ + AR=ar ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + CC="${CC}" LCCFLAGS="-O" + +hpux8.0: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-Dvfork=fork -DUSE_TERMIO \ + -DDEFAULT_IM='\"\r\n\r\nHP-UX 8.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_LOGIN_H \ + -DDIAGNOSTICS -DLOGIN_ARGS" \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o setenv.o" \ + LIB_SRC="getent.c setenv.c" \ + AR=ar ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + CC="${CC}" LCCFLAGS="-O" + +next1.0: + @echo $@ is untested... it may or may not work..." + make -f Makefile.generic ${WHAT} \ + LIBS="../libtelnet/libtelnet.a -ltermcap -lsys_s" \ + LIBPATH="/lib/libc.a /lib/libsys_s.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-bsd -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nNeXT 1.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + -DNO_STRING_H -Dgetenv=getenv_" \ + INCLUDES="-I.." \ + LIB_OBJ="strdup.o setenv.o setsid.o strftime.o \ + strcasecmp.o gettytab.o" \ + LIB_SRC=s"trdup.c setenv.c setsid.c strftime.c \ + strcasecmp.c gettytab.c" \ + CC="${CC}" LCCFLAGS="-O" \ + VPATH=../../getty \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc + +# +# For the convex, make symbolic links to the tc[sg]getattr.c routines, +# because we are using posix stuff, but not the posix library... +# Pass the stuff to Makefile.generic by passing the object/source names +# in through LIB_OBJ and LIB_SRC +# +convex: + @echo $@ is untested... it may or may not work..." + ln -s ../../rel_usr/src/lib/libc/posix/tcsetattr.c tcsetattr.c + ln -s ../../rel_usr/src/lib/libc/posix/tcgetattr.c tcgetattr.c + make -f Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a" \ + LIBPATH="../libtelnet/libtelnet.a" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-g ${OPTLEV} -Dconvex" \ + DEFINES=${ODEFS}"-DUSE_TERMIO -DLINEMODE \ + -DDEFAULT_IM='\"\r\nConvex (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON" \ + INCLUDES="-I.." \ + LIB_OBJ="getent.o setsid.o strftime.o \ + tcsetattr.o tcgetattr.o" \ + LIB_SRC="getent.c setsid.c strftime.c \ + tcsetattr.c tcgetattr.c" + +clean cleandir: + make -f Makefile.generic $@ diff --git a/appl/telnet/Config.local b/appl/telnet/Config.local new file mode 100644 index 000000000..dc2a1e325 --- /dev/null +++ b/appl/telnet/Config.local @@ -0,0 +1,105 @@ +AUTH_LIB = ../../../lib/krb/libkrb.a ../../../lib/des/libdes.a +AUTH_LIBPATH = ../../../lib/krb/libkrb.a ../../../lib/des/libdes.a +AUTH_INC = -I../../../include -I$(VPATH)/../../../include +AUTH_DEF = -DAUTHENTICATION -DENCRYPTION -DKRB4 -DDES_ENCRYPTION + +all: + @echo "You must specify what type of system you are on," + @echo "or setup a Config.local file for your system." + @echo "Known system types are:" + @echo + @echo " sunos4 hpux osf ultrix netbsd" + +sunos4: + $(MAKE) VPATH=$(VPATH) -f $(VPATH)/Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-Dmemmove=memcpy -DFILIO_H \ + -DTERMCAP -DUSE_TERMIO \ + -DKLUDGELINEMODE -DSTREAMS \ + -DDEFAULT_IM='\"\r\nSunOS UNIX 4.1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + ${AUTH_DEF}" \ + INCLUDES="-I.. -I$(VPATH)/.. ${AUTH_INC} " \ + LIB_OBJ="getent.o strerror.o setenv.o herror.o" \ + LIB_SRC="getent.c strerror.c setenv.c herror.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc/in.telnetd \ + CC="${CC}" LCCFLAGS="-g" +#-DNO_LOGIN_F -DLOGIN_R + +osf: + $(MAKE) VPATH=$(VPATH) -f $(VPATH)/Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/usr/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}" -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nDEC OSF/1 (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + ${AUTH_DEF}" \ + INCLUDES="-I.. -I$(VPATH)/.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-g" + + +hpux: + $(MAKE) VPATH=$(VPATH) -f $(VPATH)/Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-Dvfork=fork -DUSE_TERMIO \ + -DDEFAULT_IM='\"\r\n\r\nHP-UX 9.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DNO_LOGIN_F -DNO_LOGIN_P -DNO_LOGIN_H \ + -DDIAGNOSTICS -DLOGIN_ARGS ${AUTH_DEF}" \ + INCLUDES="-I.. -I$(VPATH)/.. ${AUTH_INC} " \ + LIB_OBJ="getent.o setenv.o" \ + LIB_SRC="getent.c setenv.c" \ + AR=ar ARFLAGS=cq RANLIB=NONE \ + LIBEXEC=${DESTDIR}/etc \ + CC="${CC}" LCCFLAGS="-O" + + +ultrix: + $(MAKE) -f $(VPATH)/Makefile.generic ${WHAT} \ + LIBS="-ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/ucb \ + DEFINES=${ODEFS}"-DUSE_TERMIO -DTERMCAP \ + -DDEFAULT_IM='\"\r\nULTRIX V4.4 (%h) (%t)\r\n\r\r\n\r\"' \ + -DKLUDGELINEMODE -DDIAGNOSTICS \ + -DNO_LOGIN_F -DNO_LOGIN_P -DLOGIN_R \ + -DENV_HACK -DOLD_ENVIRON ${AUTH_DEF}" \ + INCLUDES="-I.. -I$(VPATH)/.. ${AUTH_INC}" \ + LIB_OBJ="getent.o strdup.o" \ + LIB_SRC="getent.c strdup.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/etc \ + CC="${CC}" LCCFLAGS="-O" + +netbsd: + $(MAKE) -f $(VPATH)/Makefile.generic ${WHAT} \ + LIBS="-lutil -ltermcap ../libtelnet/libtelnet.a ${AUTH_LIB}" \ + LIBPATH="/usr/lib/libc.a /usr/lib/libtermcap.a \ + ../libtelnet/libtelnet.a ${AUTH_LIBPATH}" \ + DEST=${DESTDIR}/usr/bin \ + DEFINES=${ODEFS}"-DLINEMODE -DTERMCAP -DKLUDGELINEMODE \ + -DDEFAULT_IM='\"\r\nNetBSD 1.0 (%h) (%t)\r\n\r\r\n\r\"' \ + -DUSE_TERMIO -DDIAGNOSTICS -DENV_HACK -DOLD_ENVIRON \ + -DHAS_CGETENT ${AUTH_DEF}" \ + INCLUDES="-I.. -I$(VPATH)/.. ${AUTH_INC}" \ + LIB_OBJ="getent.o" \ + LIB_SRC="getent.c" \ + AR=ar ARFLAGS=cq RANLIB=ranlib \ + LIBEXEC=${DESTDIR}/usr/libexec \ + CC="${CC}" LCCFLAGS="-O" + +clean cleandir: + $(MAKE) -f Makefile.generic $@ diff --git a/appl/telnet/Makefile.ORIG b/appl/telnet/Makefile.ORIG new file mode 100644 index 000000000..3a0986e02 --- /dev/null +++ b/appl/telnet/Makefile.ORIG @@ -0,0 +1,9 @@ +all: + cd libtelnet; make CC="${CC}" + cd telnet; make CC="${CC}" + cd telnetd; make CC="${CC}" + +.DEFAULT: + cd libtelnet; make $@ WHAT=${WHAT} CC="${CC}" + cd telnet; make $@ WHAT=${WHAT} CC="${CC}" + cd telnetd; make $@ WHAT=${WHAT} CC="${CC}" diff --git a/appl/telnet/README b/appl/telnet/README new file mode 100644 index 000000000..37b588faf --- /dev/null +++ b/appl/telnet/README @@ -0,0 +1,743 @@ + +This is a distribution of both client and server telnet. These programs +have been compiled on: + telnet telnetd + 4.4 BSD-Lite x x + 4.3 BSD Reno X X + UNICOS 9.1 X X + UNICOS 9.0 X X + UNICOS 8.0 X X + BSDI 2.0 X X + Solaris 2.4 x x (no linemode in server) + SunOs 4.1.4 X X (no linemode in server) + Ultrix 4.3 X X (no linemode in server) + Ultrix 4.1 X X (no linemode in server) + +In addition, previous versions have been compiled on the following +machines, but were not available for testing this version. + telnet telnetd + Next1.0 X X + UNICOS 8.3 X X + UNICOS 7.C X X + UNICOS 7.0 X X + SunOs 4.0.3c X X (no linemode in server) + 4.3 BSD X X (no linemode in server) + DYNIX V3.0.12 X X (no linemode in server) + Ultrix 3.1 X X (no linemode in server) + Ultrix 4.0 X X (no linemode in server) + SunOs 3.5 X X (no linemode in server) + SunOs 4.1.3 X X (no linemode in server) + Solaris 2.2 x x (no linemode in server) + Solaris 2.3 x x (no linemode in server) + BSDI 1.0 X X + BSDI 1.1 X X + DYNIX V3.0.17.9 X X (no linemode in server) + HP-UX 8.0 x x (no linemode in server) + +This code should work, but there are no guarantees. + +May 30, 1995 + +This release represents what is on the 4.4BSD-Lite2 release, which +should be the final BSD release. I will continue to support of +telnet, The code (without encryption) is available via anonymous ftp +from ftp.cray.com, in src/telnet/telnet.YY.MM.DD.NE.tar.Z, where +YY.MM.DD is replaced with the year, month and day of the release. +If you can't find it at one of these places, at some point in the +near future information about the latest releases should be available +from ftp.borman.com. + +In addition, the version with the encryption code is available via +ftp from net-dist.mit.edu, in the directory /pub/telnet. There +is a README file there that gives further information on how +to get the distribution. + +Questions, comments, bug reports and bug fixes can be sent to +one of these addresses: + dab@borman.com + dab@cray.com + dab@bsdi.com + +This release is mainly bug fixes and code cleanup. + + Replace all calls to bcopy()/bzero() with calls to + memmove()/memset() and all calls to index()/rindex() + with calls to strchr()/strrchr(). + + Add some missing diagnostics for option tracing + to telnetd. + + Add support for BSDI 2.0 and Solaris 2.4. + + Add support for UNICOS 8.0 + + Get rid of expanded tabs and trailing white spaces. + + From Paul Vixie: + Fix for telnet going into an endless spin + when the session dies abnormally. + + From Jef Poskanzer: + Changes to allow telnet to compile + under SunOS 3.5. + + From Philip Guenther: + makeutx() doesn't expand utmpx, + use pututxline() instead. + + From Chris Torek: + Add a sleep(1) before execing login + to avoid race condition that can eat + up the login prompt. + Use terminal speed directly if it is + not an encoded value. + + From Steve Parker: + Fix to realloc() call. Fix for execing + login on solaris with no user name. + +January 19, 1994 + +This is a list of some of the changes since the last tar release +of telnet/telnetd. There are probably other changes that aren't +listed here, but this should hit a lot of the main ones. + + General: + Changed #define for AUTHENTICATE to AUTHENTICATION + Changed #define for ENCRYPT to ENCRYPTION + Changed #define for DES_ENCRYPT to DES_ENCRYPTION + + Added support for SPX authentication: -DSPX + + Added support for Kerberos Version 5 authentication: -DKRB5 + + Added support for ANSI C function prototypes + + Added support for the NEW-ENVIRON option (RFC-1572) + including support for USERVAR. + + Made support for the old Environment Option (RFC-1408) + conditional on -DOLD_ENVIRON + + Added #define ENV_HACK - support for RFC 1571 + + The encryption code is removed from the public distributions. + Domestic 4.4 BSD distributions contain the encryption code. + + ENV_HACK: Code to deal with systems that only implement + the old ENVIRON option, and have reversed definitions + of ENV_VAR and ENV_VAL. Also fixes ENV processing in + client to handle things besides just the default set... + + NO_BSD_SETJMP: UNICOS configuration for + UNICOS 6.1/6.0/5.1/5.0 systems. + + STREAMSPTY: Use /dev/ptmx to get a clean pty. This + is for SVr4 derivatives (Like Solaris) + + UTMPX: For systems that have /etc/utmpx. This is for + SVr4 derivatives (Like Solaris) + + Definitions for BSDI 1.0 + + Definitions for 4.3 Reno and 4.4 BSD. + + Definitions for UNICOS 8.0 and UNICOS 7.C + + Definitions for Solaris 2.0 + + Definitions for HP-UX 8.0 + + Latest Copyright notices from Berkeley. + + FLOW-CONTROL: support for RFC-XXXx + + + Client Specific: + + Fix the "send" command to not send garbage... + + Fix status message for "skiprc" + + Make sure to send NAWS after telnet has been suspended + or an external command has been run, if the window size + has changed. + + sysV88 support. + + Server Specific: + + Support flowcontrol option in non-linemode servers. + + -k Server supports Kludge Linemode, but will default to + either single character mode or real Linemode support. + The user will have to explicitly ask to switch into + kludge linemode. ("stty extproc", or escape back to + to telnet and say "mode line".) + + -u Specify the length of the hostname field in the utmp + file. Hostname longer than this length will be put + into the utmp file in dotted decimal notation, rather + than putting in a truncated hostname. + + -U Registered hosts only. If a reverse hostname lookup + fails, the connection will be refused. + + -f/-F + Allows forwarding of credentials for KRB5. + +Februrary 22, 1991: + + Features: + + This version of telnet/telnetd has support for both + the AUTHENTICATION and ENCRYPTION options. The + AUTHENTICATION option is fairly well defined, and + an option number has been assigned to it. The + ENCRYPTION option is still in a state of flux; an + option number has been assigned to, but it is still + subject to change. The code is provided in this release + for experimental and testing purposes. + + The telnet "send" command can now be used to send + do/dont/will/wont commands, with any telnet option + name. The rules for when do/dont/will/wont are sent + are still followed, so just because the user requests + that one of these be sent doesn't mean that it will + be sent... + + The telnet "getstatus" command no longer requires + that option printing be enabled to see the response + to the "DO STATUS" command. + + A -n flag has been added to telnetd to disable + keepalives. + + A new telnet command, "auth" has been added (if + AUTHENTICATE is defined). It has four sub-commands, + "status", "disable", "enable" and "help". + + A new telnet command, "encrypt" has been added (if + ENCRYPT is defined). It has many sub-commands: + "enable", "type", "start", "stop", "input", + "-input", "output", "-output", "status", and "help". + + The LOGOUT option is now supported by both telnet + and telnetd, a new command, "logout", was added + to support this. + + Several new toggle options were added: + "autoencrypt", "autodecrypt", "autologin", "authdebug", + "encdebug", "skiprc", "verbose_encrypt" + + An "rlogin" interface has been added. If the program + is named "rlogin", or the "-r" flag is given, then + an rlogin type of interface will be used. + ~. Terminates the session + ~ Suspend the session + ~^] Escape to telnet command mode + ~~ Pass through the ~. + BUG: If you type the rlogin escape character + in the middle of a line while in rlogin + mode, you cannot erase it or any characters + before it. Hopefully this can be fixed + in a future release... + + General changes: + + A "libtelnet.a" has now been created. This libraray + contains code that is common to both telnet and + telnetd. This is also where library routines that + are needed, but are not in the standard C library, + are placed. + + The makefiles have been re-done. All of the site + specific configuration information has now been put + into a single "Config.generic" file, in the top level + directory. Changing this one file will take care of + all three subdirectories. Also, to add a new/local + definition, a "Config.local" file may be created + at the top level; if that file exists, the subdirectories + will use that file instead of "Config.generic". + + Many 1-2 line functions in commands.c have been + removed, and just inserted in-line, or replaced + with a macro. + + Bug Fixes: + + The non-termio code in both telnet and telnetd was + setting/clearing CTLECH in the sg_flags word. This + was incorrect, and has been changed to set/clear the + LCTLECH bit in the local mode word. + + The SRCRT #define has been removed. If IP_OPTIONS + and IPPROTO_IP are defined on the system, then the + source route code is automatically enabled. + + The NO_GETTYTAB #define has been removed; there + is a compatability routine that can be built into + libtelnet to achive the same results. + + The server, telnetd, has been switched to use getopt() + for parsing the argument list. + + The code for getting the input/output speeds via + cfgetispeed()/cfgetospeed() was still not quite + right in telnet. Posix says if the ispeed is 0, + then it is really equal to the ospeed. + + The suboption processing code in telnet now has + explicit checks to make sure that we received + the entire suboption (telnetd was already doing this). + + The telnet code for processing the terminal type + could cause a core dump if an existing connection + was closed, and a new connection opened without + exiting telnet. + + Telnetd was doing a TCSADRAIN when setting the new + terminal settings; This is not good, because it means + that the tcsetattr() will hang waiting for output to + drain, and telnetd is the only one that will drain + the output... The fix is to use TCSANOW which does + not wait. + + Telnetd was improperly setting/clearing the ISTRIP + flag in the c_lflag field, it should be using the + c_iflag field. + + When the child process of telnetd was opening the + slave side of the pty, it was re-setting the EXTPROC + bit too early, and some of the other initialization + code was wiping it out. This would cause telnetd + to go out of linemode and into single character mode. + + One instance of leaving linemode in telnetd forgot + to send a WILL ECHO to the client, the net result + would be that the user would see double character + echo. + + If the MODE was being changed several times very + quickly, telnetd could get out of sync with the + state changes and the returning acks; and wind up + being left in the wrong state. + +September 14, 1990: + + Switch the client to use getopt() for parsing the + argument list. The 4.3Reno getopt.c is included for + systems that don't have getopt(). + + Use the posix _POSIX_VDISABLE value for what value + to use when disabling special characters. If this + is undefined, it defaults to 0x3ff. + + For non-termio systems, TIOCSETP was being used to + change the state of the terminal. This causes the + input queue to be flushed, which we don't want. This + is now changed to TIOCSETN. + + Take out the "#ifdef notdef" around the code in the + server that generates a "sync" when the pty oputput + is flushed. The potential problem is that some older + telnet clients may go into an infinate loop when they + receive a "sync", if so, the server can be compiled + with "NO_URGENT" defined. + + Fix the client where it was setting/clearing the OPOST + bit in the c_lflag field, not the c_oflag field. + + Fix the client where it was setting/clearing the ISTRIP + bit in the c_lflag field, not the c_iflag field. (On + 4.3Reno, this is the ECHOPRT bit in the c_lflag field.) + The client also had its interpretation of WILL BINARY + and DO BINARY reversed. + + Fix a bug in client that would cause a core dump when + attempting to remove the last environment variable. + + In the client, there were a few places were switch() + was being passed a character, and if it was a negative + value, it could get sign extended, and not match + the 8 bit case statements. The fix is to and the + switch value with 0xff. + + Add a couple more printoption() calls in the client, I + don't think there are any more places were a telnet + command can be received and not printed out when + "options" is on. + + A new flag has been added to the client, "-a". Currently, + this just causes the USER name to be sent across, in + the future this may be used to signify that automatic + authentication is requested. + + The USER variable is now only sent by the client if + the "-a" or "-l user" options are explicity used, or + if the user explicitly asks for the "USER" environment + variable to be exported. In the server, if it receives + the "USER" environment variable, it won't print out the + banner message, so that only "Password:" will be printed. + This makes the symantics more like rlogin, and should be + more familiar to the user. (People are not used to + getting a banner message, and then getting just a + "Password:" prompt.) + + Re-vamp the code for starting up the child login + process. The code was getting ugly, and it was + hard to tell what was really going on. What we + do now is after the fork(), in the child: + 1) make sure we have no controlling tty + 2) open and initialize the tty + 3) do a setsid()/setpgrp() + 4) makes the tty our controlling tty. + On some systems, #2 makes the tty our controlling + tty, and #4 is a no-op. The parent process does + a gets rid of any controlling tty after the child + is fork()ed. + + Use the strdup() library routine in telnet, instead + of the local savestr() routine. If you don't have + strdup(), you need to define NO_STRDUP. + + Add support for ^T (SIGINFO/VSTATUS), found in the + 4.3Reno distribution. This maps to the AYT character. + You need a 4-line bugfix in the kernel to get this + to work properly: + + > *** tty_pty.c.ORG Tue Sep 11 09:41:53 1990 + > --- tty_pty.c Tue Sep 11 17:48:03 1990 + > *************** + > *** 609,613 **** + > if ((tp->t_lflag&NOFLSH) == 0) + > ttyflush(tp, FREAD|FWRITE); + > ! pgsignal(tp->t_pgrp, *(unsigned int *)data); + > return(0); + > } + > --- 609,616 ---- + > if ((tp->t_lflag&NOFLSH) == 0) + > ttyflush(tp, FREAD|FWRITE); + > ! pgsignal(tp->t_pgrp, *(unsigned int *)data, 1); + > ! if ((*(unsigned int *)data == SIGINFO) && + > ! ((tp->t_lflag&NOKERNINFO) == 0)) + > ! ttyinfo(tp); + > return(0); + > } + + The client is now smarter when setting the telnet escape + character; it only sets it to one of VEOL and VEOL2 if + one of them is undefined, and the other one is not already + defined to the telnet escape character. + + Handle TERMIOS systems that have seperate input and output + line speed settings imbedded in the flags. + + Many other minor bug fixes. + +June 20, 1990: + Re-organize makefiles and source tree. The telnet/Source + directory is now gone, and all the source that was in + telnet/Source is now just in the telnet directory. + + Seperate makefile for each system are now gone. There + are two makefiles, Makefile and Makefile.generic. + The "Makefile" has the definitions for the various + system, and "Makefile.generic" does all the work. + There is a variable called "WHAT" that is used to + specify what to make. For example, in the telnet + directory, you might say: + make 4.4bsd WHAT=clean + to clean out the directory. + + Add support for the ENVIRON and XDISPLOC options. + In order for the server to work, login has to have + the "-p" option to preserve environment variables. + + Add the SOFT_TAB and LIT_ECHO modes in the LINEMODE support. + + Add the "-l user" option to command line and open command + (This is passed through the ENVIRON option). + + Add the "-e" command line option, for setting the escape + character. + + Add the "-D", diagnostic, option to the server. This allows + the server to print out debug information, which is very + useful when trying to debug a telnet that doesn't have any + debugging ability. + + Turn off the literal next character when not in LINEMODE. + + Don't recognize ^Y locally, just pass it through. + + Make minor modifications for Sun4.0 and Sun4.1 + + Add support for both FORW1 and FORW2 characters. The + telnet escpape character is set to whichever of the + two is not being used. If both are in use, the escape + character is not set, so when in linemode the user will + have to follow the escape character with a or + +libtelnet/Makefile.4.4: +telnet/Makefile.4.4: +telnetd/Makefile.4.4: + These are the makefiles that can be used on a 4.3Reno + system when this software is installed in /usr/src/lib/libtelnet, + /usr/src/libexec/telnetd, and /usr/src/usr.bin/telnet. + + +The following TELNET options are supported: + + LINEMODE: + The LINEMODE option is supported as per RFC1116. The + FORWARDMASK option is not currently supported. + + BINARY: The client has the ability to turn on/off the BINARY + option in each direction. Turning on BINARY from + server to client causes the LITOUT bit to get set in + the terminal driver on both ends, turning on BINARY + from the client to the server causes the PASS8 bit + to get set in the terminal driver on both ends. + + TERMINAL-TYPE: + This is supported as per RFC1091. On the server side, + when a terminal type is received, termcap/terminfo + is consulted to determine if it is a known terminal + type. It keeps requesting terminal types until it + gets one that it recongnizes, or hits the end of the + list. The server side looks up the entry in the + termcap/terminfo data base, and generates a list of + names which it then passes one at a time to each + request for a terminal type, duplicating the last + entry in the list before cycling back to the beginning. + + NAWS: The Negotiate about Window Size, as per RFC 1073. + + TERMINAL-SPEED: + Implemented as per RFC 1079 + + TOGGLE-FLOW-CONTROL: + Implemented as per RFC 1080 + + TIMING-MARK: + As per RFC 860 + + SGA: As per RFC 858 + + ECHO: As per RFC 857 + + LOGOUT: As per RFC 727 + + STATUS: + The server will send its current status upon + request. It does not ask for the clients status. + The client will request the servers current status + from the "send getstatus" command. + + ENVIRON: + This option is currently being defined by the IETF + Telnet Working Group, and an RFC has not yet been + issued, but should be in the near future... + + X-DISPLAY-LOCATION: + This functionality can be done through the ENVIRON + option, it is added here for completeness. + + AUTHENTICATION: + This option is currently being defined by the IETF + Telnet Working Group, and an RFC has not yet been + issued. The basic framework is pretty much decided, + but the definitions for the specific authentication + schemes is still in a state of flux. + + ENCRYPTION: + This option is currently being defined by the IETF + Telnet Working Group, and an RFC has not yet been + issued. The draft RFC is still in a state of flux, + so this code may change in the future. diff --git a/appl/telnet/arpa/telnet.h b/appl/telnet/arpa/telnet.h new file mode 100644 index 000000000..5d9ef6001 --- /dev/null +++ b/appl/telnet/arpa/telnet.h @@ -0,0 +1,323 @@ +/* + * Copyright (c) 1983, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)telnet.h 8.2 (Berkeley) 12/15/93 + */ + +#ifndef _TELNET_H_ +#define _TELNET_H_ + +/* + * Definitions for the TELNET protocol. + */ +#define IAC 255 /* interpret as command: */ +#define DONT 254 /* you are not to use option */ +#define DO 253 /* please, you use option */ +#define WONT 252 /* I won't use option */ +#define WILL 251 /* I will use option */ +#define SB 250 /* interpret as subnegotiation */ +#define GA 249 /* you may reverse the line */ +#define EL 248 /* erase the current line */ +#define EC 247 /* erase the current character */ +#define AYT 246 /* are you there */ +#define AO 245 /* abort output--but let prog finish */ +#define IP 244 /* interrupt process--permanently */ +#define BREAK 243 /* break */ +#define DM 242 /* data mark--for connect. cleaning */ +#define NOP 241 /* nop */ +#define SE 240 /* end sub negotiation */ +#define EOR 239 /* end of record (transparent mode) */ +#define ABORT 238 /* Abort process */ +#define SUSP 237 /* Suspend process */ +#define xEOF 236 /* End of file: EOF is already used... */ + +#define SYNCH 242 /* for telfunc calls */ + +#ifdef TELCMDS +char *telcmds[] = { + "EOF", "SUSP", "ABORT", "EOR", + "SE", "NOP", "DMARK", "BRK", "IP", "AO", "AYT", "EC", + "EL", "GA", "SB", "WILL", "WONT", "DO", "DONT", "IAC", 0, +}; +#else +extern char *telcmds[]; +#endif + +#define TELCMD_FIRST xEOF +#define TELCMD_LAST IAC +#define TELCMD_OK(x) ((unsigned int)(x) <= TELCMD_LAST && \ + (unsigned int)(x) >= TELCMD_FIRST) +#define TELCMD(x) telcmds[(x)-TELCMD_FIRST] + +/* telnet options */ +#define TELOPT_BINARY 0 /* 8-bit data path */ +#define TELOPT_ECHO 1 /* echo */ +#define TELOPT_RCP 2 /* prepare to reconnect */ +#define TELOPT_SGA 3 /* suppress go ahead */ +#define TELOPT_NAMS 4 /* approximate message size */ +#define TELOPT_STATUS 5 /* give status */ +#define TELOPT_TM 6 /* timing mark */ +#define TELOPT_RCTE 7 /* remote controlled transmission and echo */ +#define TELOPT_NAOL 8 /* negotiate about output line width */ +#define TELOPT_NAOP 9 /* negotiate about output page size */ +#define TELOPT_NAOCRD 10 /* negotiate about CR disposition */ +#define TELOPT_NAOHTS 11 /* negotiate about horizontal tabstops */ +#define TELOPT_NAOHTD 12 /* negotiate about horizontal tab disposition */ +#define TELOPT_NAOFFD 13 /* negotiate about formfeed disposition */ +#define TELOPT_NAOVTS 14 /* negotiate about vertical tab stops */ +#define TELOPT_NAOVTD 15 /* negotiate about vertical tab disposition */ +#define TELOPT_NAOLFD 16 /* negotiate about output LF disposition */ +#define TELOPT_XASCII 17 /* extended ascic character set */ +#define TELOPT_LOGOUT 18 /* force logout */ +#define TELOPT_BM 19 /* byte macro */ +#define TELOPT_DET 20 /* data entry terminal */ +#define TELOPT_SUPDUP 21 /* supdup protocol */ +#define TELOPT_SUPDUPOUTPUT 22 /* supdup output */ +#define TELOPT_SNDLOC 23 /* send location */ +#define TELOPT_TTYPE 24 /* terminal type */ +#define TELOPT_EOR 25 /* end or record */ +#define TELOPT_TUID 26 /* TACACS user identification */ +#define TELOPT_OUTMRK 27 /* output marking */ +#define TELOPT_TTYLOC 28 /* terminal location number */ +#define TELOPT_3270REGIME 29 /* 3270 regime */ +#define TELOPT_X3PAD 30 /* X.3 PAD */ +#define TELOPT_NAWS 31 /* window size */ +#define TELOPT_TSPEED 32 /* terminal speed */ +#define TELOPT_LFLOW 33 /* remote flow control */ +#define TELOPT_LINEMODE 34 /* Linemode option */ +#define TELOPT_XDISPLOC 35 /* X Display Location */ +#define TELOPT_OLD_ENVIRON 36 /* Old - Environment variables */ +#define TELOPT_AUTHENTICATION 37/* Authenticate */ +#define TELOPT_ENCRYPT 38 /* Encryption option */ +#define TELOPT_NEW_ENVIRON 39 /* New - Environment variables */ +#define TELOPT_EXOPL 255 /* extended-options-list */ + + +#define NTELOPTS (1+TELOPT_NEW_ENVIRON) +#ifdef TELOPTS +char *telopts[NTELOPTS+1] = { + "BINARY", "ECHO", "RCP", "SUPPRESS GO AHEAD", "NAME", + "STATUS", "TIMING MARK", "RCTE", "NAOL", "NAOP", + "NAOCRD", "NAOHTS", "NAOHTD", "NAOFFD", "NAOVTS", + "NAOVTD", "NAOLFD", "EXTEND ASCII", "LOGOUT", "BYTE MACRO", + "DATA ENTRY TERMINAL", "SUPDUP", "SUPDUP OUTPUT", + "SEND LOCATION", "TERMINAL TYPE", "END OF RECORD", + "TACACS UID", "OUTPUT MARKING", "TTYLOC", + "3270 REGIME", "X.3 PAD", "NAWS", "TSPEED", "LFLOW", + "LINEMODE", "XDISPLOC", "OLD-ENVIRON", "AUTHENTICATION", + "ENCRYPT", "NEW-ENVIRON", + 0, +}; +#define TELOPT_FIRST TELOPT_BINARY +#define TELOPT_LAST TELOPT_NEW_ENVIRON +#define TELOPT_OK(x) ((unsigned int)(x) <= TELOPT_LAST) +#define TELOPT(x) telopts[(x)-TELOPT_FIRST] +#endif + +/* sub-option qualifiers */ +#define TELQUAL_IS 0 /* option is... */ +#define TELQUAL_SEND 1 /* send option */ +#define TELQUAL_INFO 2 /* ENVIRON: informational version of IS */ +#define TELQUAL_REPLY 2 /* AUTHENTICATION: client version of IS */ +#define TELQUAL_NAME 3 /* AUTHENTICATION: client version of IS */ + +#define LFLOW_OFF 0 /* Disable remote flow control */ +#define LFLOW_ON 1 /* Enable remote flow control */ +#define LFLOW_RESTART_ANY 2 /* Restart output on any char */ +#define LFLOW_RESTART_XON 3 /* Restart output only on XON */ + +/* + * LINEMODE suboptions + */ + +#define LM_MODE 1 +#define LM_FORWARDMASK 2 +#define LM_SLC 3 + +#define MODE_EDIT 0x01 +#define MODE_TRAPSIG 0x02 +#define MODE_ACK 0x04 +#define MODE_SOFT_TAB 0x08 +#define MODE_LIT_ECHO 0x10 + +#define MODE_MASK 0x1f + +/* Not part of protocol, but needed to simplify things... */ +#define MODE_FLOW 0x0100 +#define MODE_ECHO 0x0200 +#define MODE_INBIN 0x0400 +#define MODE_OUTBIN 0x0800 +#define MODE_FORCE 0x1000 + +#define SLC_SYNCH 1 +#define SLC_BRK 2 +#define SLC_IP 3 +#define SLC_AO 4 +#define SLC_AYT 5 +#define SLC_EOR 6 +#define SLC_ABORT 7 +#define SLC_EOF 8 +#define SLC_SUSP 9 +#define SLC_EC 10 +#define SLC_EL 11 +#define SLC_EW 12 +#define SLC_RP 13 +#define SLC_LNEXT 14 +#define SLC_XON 15 +#define SLC_XOFF 16 +#define SLC_FORW1 17 +#define SLC_FORW2 18 + +#define NSLC 18 + +/* + * For backwards compatability, we define SLC_NAMES to be the + * list of names if SLC_NAMES is not defined. + */ +#define SLC_NAMELIST "0", "SYNCH", "BRK", "IP", "AO", "AYT", "EOR", \ + "ABORT", "EOF", "SUSP", "EC", "EL", "EW", "RP", \ + "LNEXT", "XON", "XOFF", "FORW1", "FORW2", 0, +#ifdef SLC_NAMES +char *slc_names[] = { + SLC_NAMELIST +}; +#else +extern char *slc_names[]; +#define SLC_NAMES SLC_NAMELIST +#endif + +#define SLC_NAME_OK(x) ((unsigned int)(x) <= NSLC) +#define SLC_NAME(x) slc_names[x] + +#define SLC_NOSUPPORT 0 +#define SLC_CANTCHANGE 1 +#define SLC_VARIABLE 2 +#define SLC_DEFAULT 3 +#define SLC_LEVELBITS 0x03 + +#define SLC_FUNC 0 +#define SLC_FLAGS 1 +#define SLC_VALUE 2 + +#define SLC_ACK 0x80 +#define SLC_FLUSHIN 0x40 +#define SLC_FLUSHOUT 0x20 + +#define OLD_ENV_VAR 1 +#define OLD_ENV_VALUE 0 +#define NEW_ENV_VAR 0 +#define NEW_ENV_VALUE 1 +#define ENV_ESC 2 +#define ENV_USERVAR 3 + +/* + * AUTHENTICATION suboptions + */ + +/* + * Who is authenticating who ... + */ +#define AUTH_WHO_CLIENT 0 /* Client authenticating server */ +#define AUTH_WHO_SERVER 1 /* Server authenticating client */ +#define AUTH_WHO_MASK 1 + +/* + * amount of authentication done + */ +#define AUTH_HOW_ONE_WAY 0 +#define AUTH_HOW_MUTUAL 2 +#define AUTH_HOW_MASK 2 + +#define AUTHTYPE_NULL 0 +#define AUTHTYPE_KERBEROS_V4 1 +#define AUTHTYPE_KERBEROS_V5 2 +#define AUTHTYPE_SPX 3 +#define AUTHTYPE_MINK 4 +#define AUTHTYPE_SRA 5 +#define AUTHTYPE_CNT 6 +/* #define AUTHTYPE_UNSECURE 6 */ + +#define AUTHTYPE_TEST 99 + +#ifdef AUTH_NAMES +char *authtype_names[] = { + "NULL", "KERBEROS_V4", "KERBEROS_V5", "SPX", "MINK", + "SRA", 0, +}; +#else +extern char *authtype_names[]; +#endif + +#define AUTHTYPE_NAME_OK(x) ((unsigned int)(x) < AUTHTYPE_CNT) +#define AUTHTYPE_NAME(x) authtype_names[x] + +/* + * ENCRYPTion suboptions + */ +#define ENCRYPT_IS 0 /* I pick encryption type ... */ +#define ENCRYPT_SUPPORT 1 /* I support encryption types ... */ +#define ENCRYPT_REPLY 2 /* Initial setup response */ +#define ENCRYPT_START 3 /* Am starting to send encrypted */ +#define ENCRYPT_END 4 /* Am ending encrypted */ +#define ENCRYPT_REQSTART 5 /* Request you start encrypting */ +#define ENCRYPT_REQEND 6 /* Request you send encrypting */ +#define ENCRYPT_ENC_KEYID 7 +#define ENCRYPT_DEC_KEYID 8 +#define ENCRYPT_CNT 9 + +#define ENCTYPE_ANY 0 +#define ENCTYPE_DES_CFB64 1 +#define ENCTYPE_DES_OFB64 2 +#define ENCTYPE_CNT 3 + +#ifdef ENCRYPT_NAMES +char *encrypt_names[] = { + "IS", "SUPPORT", "REPLY", "START", "END", + "REQUEST-START", "REQUEST-END", "ENC-KEYID", "DEC-KEYID", + 0, +}; +char *enctype_names[] = { + "ANY", "DES_CFB64", "DES_OFB64", 0, +}; +#else +extern char *encrypt_names[]; +extern char *enctype_names[]; +#endif + + +#define ENCRYPT_NAME_OK(x) ((unsigned int)(x) < ENCRYPT_CNT) +#define ENCRYPT_NAME(x) encrypt_names[x] + +#define ENCTYPE_NAME_OK(x) ((unsigned int)(x) < ENCTYPE_CNT) +#define ENCTYPE_NAME(x) enctype_names[x] + +#endif /* !_TELNET_H_ */ diff --git a/appl/telnet/config.h.in b/appl/telnet/config.h.in new file mode 100644 index 000000000..19965b030 --- /dev/null +++ b/appl/telnet/config.h.in @@ -0,0 +1,144 @@ +/* config.h.in. Generated automatically from configure.in by autoheader. */ + +/* + * configuration file for telnet + * + * $Id$ + * + */ + +#ifndef T_CONFIG_H +#define T_CONFIG_H + + +/* define this if you want authentication */ +#undef AUTHENTICATION + +/* define this if you have kerberos 4 */ +#undef KRB4 + +/* define this if you want encryption */ +#undef ENCRYPTION + +/* Set this if you want des encryption */ +#undef DES_ENCRYPTION + +/* Set this to the default system lead string for telnetd + * can contain %-escapes: %s=sysname, %m=machine, %r=os-release + * %v=os-version, %t=tty, %h=hostname, %d=date and time + */ +#undef USE_IM + +/* define this if you want diagnostics in telnetd */ +#undef DIAGNOSTICS + +/* define this if you want support for broken ENV_{VALUE,VAR} systems */ +#undef ENV_HACK + +/* define this if you want support for 4.3BSD kludged line mode */ +#undef KLUDGELINEMODE + +/* */ +#undef OLD_ENVIRON + +/* */ +#undef STREAMSPTY + +#ifdef HAVE_TGETENT +#define TERMCAP 1 +#endif + +/* Define if you have the cgetent function. */ +#undef HAVE_CGETENT + +/* Define if you have the gethostbyname function. */ +#undef HAVE_GETHOSTBYNAME + +/* Define if you have the setupterm function. */ +#undef HAVE_SETUPTERM + +/* Define if you have the socket function. */ +#undef HAVE_SOCKET + +/* Define if you have the tgetent function. */ +#undef HAVE_TGETENT + +/* Define if you have the uname function. */ +#undef HAVE_UNAME + +/* Define if you have the vfork function. */ +#undef HAVE_VFORK + +/* Define if you have the vhangup function. */ +#undef HAVE_VHANGUP + +/* Define if you have the header file. */ +#undef HAVE_SAC_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_RESOURCE_H + +/* Define if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define if you have the header file. */ +#undef HAVE_UTMPX_H + +/* Define if you have the nsl library (-lnsl). */ +#undef HAVE_LIBNSL + +/* Define if you have the socket library (-lsocket). */ +#undef HAVE_LIBSOCKET + +/* Define if you have the util library (-lutil). */ +#undef HAVE_LIBUTIL + +/* set this to a sensible login */ +#ifndef LOGIN_PATH +#define LOGIN_PATH "/usr/athena/bin/login" +#endif + + +#ifdef HAVE_TGETENT +#define TERMCAP 1 +#endif + +#if defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H) +#define USE_TERMIO 1 + +/* If this is not a POSIX boxen use SYSV, this may not work on CRAY + * se telnetd/desf.h */ +#ifndef HAVE_TERMIOS_H +#define SYSV_TERMIO +#endif + +#endif /* defined(HAVE_TERMIOS_H) || defined(HAVE_TERMIO_H) */ + +#ifndef HAVE_VFORK +#define vfork fork +#endif + +/* os specific tests ahead */ + +#ifdef sun + +#define FILIO_H 1 +#define STREAMS 1 + +#ifdef __svr4__ +#define SOLARIS +#endif + +#endif /* sun */ + +#ifdef _AIX +#define unix /* well, ok... */ +#endif + +#endif /* T_CONFIG_H */ diff --git a/appl/telnet/configure b/appl/telnet/configure new file mode 100755 index 000000000..a5baa9fba --- /dev/null +++ b/appl/telnet/configure @@ -0,0 +1,1631 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.2 +# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_default_prefix=/usr/athena +ac_help="$ac_help + --enable-authentication configure with authentication" +ac_help="$ac_help + --enable-encryption configure with encryption" +ac_help="$ac_help + --enable-default-im[=ARG] default initial banner" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE + +# Initialize some other variables. +subdirs= + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -build | --build | --buil | --bui | --bu | --b) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=* | --b=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=PREFIX install architecture-dependent files in PREFIX + [same as prefix] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +--enable and --with options recognized:$ac_help +EOF + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.2" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set LANG and LC_ALL to C if already set. +# These must not be set unconditionally because not all systems understand +# e.g. LANG=C (notably SCO). +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LANG+set}" = set; then LANG=C; export LANG; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=telnet/telnet.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} conftest.$ac_ext $CFLAGS $CPPFLAGS -c 1>&5 2>&5' +ac_link='${CC-cc} conftest.$ac_ext $CFLAGS $CPPFLAGS $LDFLAGS -o conftest $LIBS 1>&5 2>&5' + +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + +# This may be overridden using --prefix=/usr to configure + + +# We want these before the checks, so the checks can modify their values. +test -z "$CFLAGS" && CFLAGS=-g auto_cflags=1 +test -z "$LDFLAGS" && LDFLAGS=-g + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_CC" && ac_cv_prog_CC="cc" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <&5 | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 +if test $ac_cv_prog_gcc = yes; then + GCC=yes + if test "${CFLAGS+set}" != set; then + echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_gcc_g=yes +else + ac_cv_prog_gcc_g=no +fi +rm -f conftest* + +fi + echo "$ac_t""$ac_cv_prog_gcc_g" 1>&6 + if test $ac_cv_prog_gcc_g = yes; then + CFLAGS="-g -O" + else + CFLAGS="-O" + fi + fi +else + GCC= + test "${CFLAGS+set}" = set || CFLAGS="-g" +fi + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +# If we're using gcc and the user hasn't specified CFLAGS, add -O to CFLAGS. +test -n "$GCC" && test -n "$auto_cflags" && CFLAGS="$CFLAGS -O" + + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall installbsd scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_ifs" + # As a last resort, use the slow shell script. + test -z "$ac_cv_path_install" && ac_cv_path_install="$ac_install_sh" +fi + INSTALL="$ac_cv_path_install" +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# +# authentication +# + +echo $ac_n "checking for authentication""... $ac_c" 1>&6 + +# Check whether --enable-authentication or --disable-authentication was given. +enableval="$enable_authentication" +if test -n "$enableval"; then + + if test "$enableval" = no; then + do_authentication=no + else + do_authentication=yes + fi + unset telnet_cv_opt_authentication + +else + + do_authentication=yes + +fi + + +if eval "test \"`echo '$''{'telnet_cv_opt_authentication'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + telnet_cv_opt_authentication=$do_authentication +fi + + +if test "$telnet_cv_opt_authentication" != no; then + cat >> confdefs.h <<\EOF +#define AUTHENTICATION 1 +EOF + + cat >> confdefs.h <<\EOF +#define KRB4 1 +EOF + +fi + +echo "$ac_t""$telnet_cv_opt_authentication" 1>&6 + + + + +# +# encryption +# + + +echo $ac_n "checking for encryption""... $ac_c" 1>&6 + +# Check whether --enable-encryption or --disable-encryption was given. +enableval="$enable_encryption" +if test -n "$enableval"; then + + if test "$enableval" = no; then + do_encryption=no + else + do_encryption=yes + fi + unset telnet_cv_opt_encryption + +else + + do_encryption=$telnet_cv_opt_authentication + +fi + + +if eval "test \"`echo '$''{'telnet_cv_opt_encryption'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + telnet_cv_opt_encryption=$do_encryption +fi + + +if test "$telnet_cv_opt_encryption" != no; then + cat >> confdefs.h <<\EOF +#define ENCRYPTION 1 +EOF + + cat >> confdefs.h <<\EOF +#define DES_ENCRYPTION 1 +EOF + +fi + +echo "$ac_t""$telnet_cv_opt_encryption" 1>&6 + + + + +# +# default im +# + + +echo $ac_n "checking for default im""... $ac_c" 1>&6 + +# Check whether --enable-default-im or --disable-default-im was given. +enableval="$enable_default_im" +if test -n "$enableval"; then + + +if test "$enableval" != yes; then + default_im=$enableval +else + os_ver=`uname -s` + case $os_ver in + AIX) + os_rel=`uname -v`.`uname -r` + ;; + *) + os_rel=`uname -r` + ;; + esac + + default_im="$os_ver $os_rel (%h) (%t)" +fi +unset telnet_cv_opt_default_im + +else + + default_im=no + +fi + +if eval "test \"`echo '$''{'telnet_cv_opt_default_im'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + telnet_cv_opt_default_im="$default_im" +fi + + +if test "$telnet_cv_opt_default_im" != no; then + cat >> confdefs.h <&6 + + + +# +# misc options +# + +cat >> confdefs.h <<\EOF +#define DIAGNOSTICS 1 +EOF + + + +cat >> confdefs.h <<\EOF +#define KLUDGELINEMODE 1 +EOF + + + +cat >> confdefs.h <<\EOF +#define ENV_HACK 1 +EOF + + + +cat >> confdefs.h <<\EOF +#define OLD_ENVIRON 1 +EOF + + + +for ac_func in getent herror memmove setenv strdup strerror +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +LIBOBJS="$LIBOBJS ${ac_func}.o" +fi + +done + + +for ac_func in cgetent uname vfork vhangup +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi +done + + +for ac_func in tgetent +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi +done + +if test $ac_cv_func_tgetent = no; then + # tgetent is not in the default libraries. See if it's in some other. + for lib in termcap; do + echo $ac_n "checking for -l$lib""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_lib_$lib'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-l$lib $LIBS" +cat > conftest.$ac_ext <&6 + cat >> confdefs.h <<\EOF +#define HAVE_TGETENT 1 +EOF + + LIBS="$LIBS -l$lib"; break +else + echo "$ac_t""no" 1>&6 +fi + + done +fi + +for ac_func in setupterm +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi +done + + + +# these two are mainly here for solaris +for ac_func in socket +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi +done + +if test "$ac_cv_func_socket" = no; then + echo $ac_n "checking for -lsocket""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_lib_socket'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lsocket $LIBS" +cat > conftest.$ac_ext <&6 + ac_tr_lib=HAVE_LIB`echo socket | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi + +fi +for ac_func in gethostbyname +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +/* Override any gcc2 internal prototype to avoid an error. */ +char $ac_func(); + +int main() { return 0; } +int t() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if eval $ac_link; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* + +fi +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi +done + +if test "$ac_cv_func_gethostbyname" = no; then + echo $ac_n "checking for -lnsl""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_lib_nsl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lnsl $LIBS" +cat > conftest.$ac_ext <&6 + ac_tr_lib=HAVE_LIB`echo nsl | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi + +fi + +echo $ac_n "checking for -lutil""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_lib_util'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lutil $LIBS" +cat > conftest.$ac_ext <&6 + ac_tr_lib=HAVE_LIB`echo util | tr '[a-z]' '[A-Z]'` + cat >> confdefs.h <&6 +fi + + + + +echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then +if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + # This must be in double quotes, not single quotes, because CPP may get + # substituted into the Makefile and "${CC-cc}" will confuse make. + CPP="${CC-cc} -E" + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. + cat > conftest.$ac_ext < +Syntax Error +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP="${CC-cc} -E -traditional-cpp" + cat > conftest.$ac_ext < +Syntax Error +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + rm -rf conftest* + CPP=/lib/cpp +fi +rm -f conftest* +fi +rm -f conftest* + ac_cv_prog_CPP="$CPP" +fi +fi +CPP="$ac_cv_prog_CPP" +echo "$ac_t""$CPP" 1>&6 + +for ac_hdr in termios.h termio.h sys/select.h sys/resource.h utmpx.h sac.h +do +ac_safe=`echo "$ac_hdr" | tr './\055' '___'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +EOF +eval "$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | tr '[a-z]./\055' '[A-Z]___'` + cat >> confdefs.h <&6 +fi +done + + +if test "$ac_cv_header_sac_h" = yes ; then + cat >> confdefs.h <<\EOF +#define STREAMSPTY 1 +EOF + +fi + + +### + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + sed -n "s/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=\${\1='\2'}/p" \ + >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS </dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.2" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo Makefile libtelnet/Makefile telnet/Makefile telnetd/Makefile config.h | tr : " "` conftest*; exit 1' 1 2 15 + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g$/@g/; /@g$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g$/%g/' > conftest.subs <<\CEOF +$ac_vpsub +$extrasub +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@CC@%$CC%g +s%@RANLIB@%$RANLIB%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@AUTHENTICATION@%$AUTHENTICATION%g +s%@KRB4@%$KRB4%g +s%@ENCRYPTION@%$ENCRYPTION%g +s%@DES_ENCRYPTION@%$DES_ENCRYPTION%g +s%@USE_IM@%$USE_IM%g +s%@DIAGNOSTICS@%$DIAGNOSTICS%g +s%@KLUDGELINEMODE@%$KLUDGELINEMODE%g +s%@ENV_HACK@%$ENV_HACK%g +s%@OLD_ENVIRON@%$OLD_ENVIRON%g +s%@LIBOBJS@%$LIBOBJS%g +s%@HAVE_LIBTERMCAP@%$HAVE_LIBTERMCAP%g +s%@CPP@%$CPP%g +s%@STREAMSPTY@%$STREAMSPTY%g + +CEOF +EOF +cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust relative srcdir, etc. for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" -f conftest.subs $ac_given_srcdir/$ac_file_in > $ac_file +fi; done +rm -f conftest.subs + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +CONFIG_HEADERS=${CONFIG_HEADERS-"config.h"} +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%.*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + cp $ac_given_srcdir/$ac_file_in conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) \(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. +# Maximum number of lines to put in a single here document. +ac_max_here_lines=12 + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + diff --git a/appl/telnet/kern.diff b/appl/telnet/kern.diff new file mode 100644 index 000000000..3c1153bab --- /dev/null +++ b/appl/telnet/kern.diff @@ -0,0 +1,308 @@ +*** h/ioctl.h.old Tue May 23 14:50:42 1989 +--- h/ioctl.h Tue Aug 29 18:24:49 1989 +*************** +*** 214,219 **** +--- 214,220 ---- + #define TIOCPKT_START 0x08 /* start output */ + #define TIOCPKT_NOSTOP 0x10 /* no more ^S, ^Q */ + #define TIOCPKT_DOSTOP 0x20 /* now do ^S ^Q */ ++ #define TIOCPKT_IOCTL 0x40 /* state change of pty driver */ + #define TIOCSTOP _IO('t', 111) /* stop output, like ^S */ + #define TIOCSTART _IO('t', 110) /* start output, like ^Q */ + #define TIOCMSET _IOW('t', 109, int) /* set all modem bits */ +*************** +*** 226,231 **** +--- 227,235 ---- + #define TIOCUCNTL _IOW('t', 102, int) /* pty: set/clr usr cntl mode */ + #define UIOCCMD(n) _IO('u', n) /* usr cntl op "n" */ + #define TIOCCONS _IO('t', 98) /* become virtual console */ ++ #define TIOCEXT _IOW('t', 97, int) /* pty: external processing */ ++ #define TIOCGSTATE _IOR('t', 96, int) /* pty: get internal state */ ++ #define TIOCSIG _IO('t', 95) /* pty: generate signal */ + + #define OTTYDISC 0 /* old, v7 std tty driver */ + #define NETLDISC 1 /* line discip for berk net */ +*** h/tty.h.old Tue May 23 14:51:01 1989 +--- h/tty.h Wed Aug 23 11:30:40 1989 +*************** +*** 70,75 **** +--- 70,76 ---- + struct ttychars t_chars; /* tty */ + struct winsize t_winsize; /* window size */ + /* be careful of tchars & co. */ ++ #ifndef NO_T_CHARS_DEFINES + #define t_erase t_chars.tc_erase + #define t_kill t_chars.tc_kill + #define t_intrc t_chars.tc_intrc +*************** +*** 84,89 **** +--- 85,91 ---- + #define t_flushc t_chars.tc_flushc + #define t_werasc t_chars.tc_werasc + #define t_lnextc t_chars.tc_lnextc ++ #endif + }; + + #define TTIPRI 28 +*************** +*** 124,129 **** +--- 126,132 ---- + #define TS_LNCH 0x080000 /* next character is literal */ + #define TS_TYPEN 0x100000 /* retyping suspended input (PENDIN) */ + #define TS_CNTTB 0x200000 /* counting tab width; leave FLUSHO alone */ ++ #define TS_EXTPROC 0x400000 /* external processing of data */ + + #define TS_LOCAL (TS_BKSL|TS_QUOT|TS_ERASE|TS_LNCH|TS_TYPEN|TS_CNTTB) + +*** sys/tty.c.old Tue May 23 14:52:28 1989 +--- sys/tty.c Thu Aug 24 09:31:49 1989 +*************** +*** 275,280 **** +--- 275,285 ---- + */ + switch (com) { + ++ /* get internal state - needed for TS_EXTPROC bit */ ++ case TIOCGSTATE: ++ *(int *)data = tp->t_state; ++ break; ++ + /* get discipline number */ + case TIOCGETD: + *(int *)data = tp->t_line; +*************** +*** 752,757 **** +--- 757,763 ---- + */ + if ((tp->t_state&TS_TYPEN) == 0 && (t_flags&PASS8) == 0) + c &= 0177; ++ if ((tp->t_state&TS_EXTPROC) == 0) { + /* + * Check for literal nexting very first + */ +*************** +*** 834,839 **** +--- 840,846 ---- + else if (c == '\\') + tp->t_state |= TS_BKSL; + } ++ } + + /* + * Cbreak mode, don't process line editing +*************** +*** 851,856 **** +--- 858,864 ---- + goto endcase; + } + ++ if ((tp->t_state&TS_EXTPROC) == 0) { + /* + * From here on down cooked mode character + * processing takes place. +*************** +*** 911,916 **** +--- 919,925 ---- + goto endcase; + } + } ++ } + + /* + * Check for input buffer overflow +*************** +*** 933,938 **** +--- 942,948 ---- + } else if (tp->t_rocount++ == 0) + tp->t_rocol = tp->t_col; + tp->t_state &= ~TS_QUOT; ++ if ((tp->t_state&TS_EXTPROC) == 0) { + if (c == '\\') + tp->t_state |= TS_QUOT; + if (tp->t_state&TS_ERASE) { +*************** +*** 948,953 **** +--- 958,964 ---- + i--; + } + } ++ } + } + endcase: + /* +*************** +*** 998,1005 **** + return (-1); + /* + * Turn tabs to spaces as required + */ +! if (c == '\t' && (tp->t_flags&TBDELAY) == XTABS) { + register int s; + + c = 8 - (tp->t_col&7); +--- 1009,1022 ---- + return (-1); + /* + * Turn tabs to spaces as required ++ * ++ * Special case if we have external processing, we don't ++ * do the tab expansion because we'll probably get it ++ * wrong. If tab expansion needs to be done, let it ++ * happen externally. + */ +! if ((tp->t_state&TS_EXTPROC) == 0 && +! c == '\t' && (tp->t_flags&TBDELAY) == XTABS) { + register int s; + + c = 8 - (tp->t_col&7); +*************** +*** 1497,1503 **** + int s; + char *nextc(); + +! if ((tp->t_flags&ECHO) == 0) + return; + tp->t_flags &= ~FLUSHO; + c &= 0377; +--- 1514,1520 ---- + int s; + char *nextc(); + +! if ((tp->t_flags&ECHO) == 0 || (tp->t_state&TS_EXTPROC)) + return; + tp->t_flags &= ~FLUSHO; + c &= 0377; +*************** +*** 1618,1624 **** + + if ((tp->t_state&TS_CNTTB) == 0) + tp->t_flags &= ~FLUSHO; +! if ((tp->t_flags&ECHO) == 0) + return; + c &= 0377; + if (tp->t_flags&RAW) { +--- 1635,1641 ---- + + if ((tp->t_state&TS_CNTTB) == 0) + tp->t_flags &= ~FLUSHO; +! if ((tp->t_flags&ECHO) == 0 || (tp->t_state&TS_EXTPROC)) + return; + c &= 0377; + if (tp->t_flags&RAW) { +*** sys/tty_pty.c.old Tue May 23 14:52:43 1989 +--- sys/tty_pty.c Tue Aug 29 18:48:36 1989 +*************** +*** 208,213 **** +--- 208,214 ---- + return (EIO); + tp->t_oproc = ptsstart; + (void)(*linesw[tp->t_line].l_modem)(tp, 1); ++ tp->t_state &= ~TS_EXTPROC; + pti = &pt_ioctl[minor(dev)]; + pti->pt_flags = 0; + pti->pt_send = 0; +*************** +*** 247,252 **** +--- 248,275 ---- + error = ureadc((int)pti->pt_send, uio); + if (error) + return (error); ++ if (pti->pt_send & TIOCPKT_IOCTL) { ++ struct xx { ++ struct sgttyb a; ++ struct tchars b; ++ struct ltchars c; ++ int d; ++ int e; ++ } cb; ++ cb.a.sg_ispeed = tp->t_ispeed; ++ cb.a.sg_ospeed = tp->t_ospeed; ++ cb.a.sg_erase = tp->t_erase; ++ cb.a.sg_kill = tp->t_kill; ++ cb.a.sg_flags = tp->t_flags; ++ bcopy((caddr_t)&tp->t_intrc, ++ (caddr_t)&cb.b, sizeof(cb.b)); ++ bcopy((caddr_t)&tp->t_suspc, ++ (caddr_t)&cb.c, sizeof(cb.c)); ++ cb.d = tp->t_state; ++ cb.e = ((unsigned)tp->t_flags)>>16; ++ cc = MIN(uio->uio_resid, sizeof(cb)); ++ uiomove(&cb, cc, UIO_READ, uio); ++ } + pti->pt_send = 0; + return (0); + } +*************** +*** 483,488 **** +--- 506,533 ---- + * IF CONTROLLER STTY THEN MUST FLUSH TO PREVENT A HANG. + * ttywflush(tp) will hang if there are characters in the outq. + */ ++ if (cmd == TIOCEXT) { ++ /* ++ * When the TS_EXTPROC bit is being toggled, we need ++ * to send an TIOCPKT_IOCTL if the packet driver ++ * is turned on. ++ */ ++ if (*(int *)data) { ++ if (pti->pt_flags & PF_PKT) { ++ pti->pt_send |= TIOCPKT_IOCTL; ++ ptcwakeup(tp); ++ } ++ tp->t_state |= TS_EXTPROC; ++ } else { ++ if ((tp->t_state & TS_EXTPROC) && ++ (pti->pt_flags & PF_PKT)) { ++ pti->pt_send |= TIOCPKT_IOCTL; ++ ptcwakeup(tp); ++ } ++ tp->t_state &= ~TS_EXTPROC; ++ } ++ return (0); ++ } else + if (cdevsw[major(dev)].d_open == ptcopen) + switch (cmd) { + +*************** +*** 525,530 **** +--- 570,583 ---- + while (getc(&tp->t_outq) >= 0) + ; + break; ++ ++ case TIOCSIG: ++ if (*(unsigned int *)data >= NSIG) ++ return(EINVAL); ++ if ((tp->t_flags&NOFLSH) == 0) ++ ttyflush(tp, FREAD|FWRITE); ++ gsignal(tp->t_pgrp, *(unsigned int *)data); ++ return(0); + } + error = ttioctl(tp, cmd, data, flag); + /* +*************** +*** 549,554 **** +--- 602,624 ---- + return (0); + } + error = ENOTTY; ++ } ++ /* ++ * If external processing and packet mode send ioctl packet. ++ */ ++ if ((tp->t_state & TS_EXTPROC) && (pti->pt_flags & PF_PKT)) { ++ switch(cmd) { ++ case TIOCSETP: ++ case TIOCSETN: ++ case TIOCSETC: ++ case TIOCSLTC: ++ case TIOCLBIS: ++ case TIOCLBIC: ++ case TIOCLSET: ++ pti->pt_send |= TIOCPKT_IOCTL; ++ default: ++ break; ++ } + } + stop = (tp->t_flags & RAW) == 0 && + tp->t_stopc == CTRL('s') && tp->t_startc == CTRL('q'); diff --git a/appl/telnet/libtelnet/Makefile.4.4 b/appl/telnet/libtelnet/Makefile.4.4 new file mode 100644 index 000000000..495dd73c5 --- /dev/null +++ b/appl/telnet/libtelnet/Makefile.4.4 @@ -0,0 +1,33 @@ +# @(#)Makefile 8.2 (Berkeley) 12/15/93 + +LIB= telnet +SRCS= auth.c encrypt.c genget.c getent.c misc.c +SRCS+= kerberos.c enc_des.c +#SRCS+= kerberos5.c +CFLAGS+= -DENCRYPTION -DAUTHENTICATION -DHAS_CGETENT +CFLAGS+= -DKRB4 -DDES_ENCRYPTION -I/usr/include/kerberosIV + +# These are the sources that have encryption stuff in them. +CRYPT_SRC= auth.c enc-proto.h enc_des.c encrypt.c +CRYPT_SRC+= encrypt.h kerberos.c kerberos5.c krb4encpwd.c +CRYPT_SRC+= misc.c spx.c Makefile +NOCRYPT_DIR=${.CURDIR}/Nocrypt + +.include + +nocrypt: +#ifdef ENCRYPTION + @for i in ${CRYPT_SRC}; do \ + if [ ! -d ${NOCRYPT_DIR} ]; then \ + echo Creating subdirectory ${NOCRYPT_DIR}; \ + mkdir ${NOCRYPT_DIR}; \ + fi; \ + echo ${NOCRYPT_DIR}/$$i; \ + unifdef -UENCRYPTION ${.CURDIR}/$$i | \ + sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \ + done + +placeholder: +#else /* ENCRYPTION */ + @echo "Encryption code already removed." +#endif /* ENCRYPTION */ diff --git a/appl/telnet/libtelnet/Makefile.ORIG b/appl/telnet/libtelnet/Makefile.ORIG new file mode 100644 index 000000000..46597306c --- /dev/null +++ b/appl/telnet/libtelnet/Makefile.ORIG @@ -0,0 +1,45 @@ +# +# Copyright (c) 1991 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted provided +# that: (1) source distributions retain this entire copyright notice and +# comment, and (2) distributions including binaries display the following +# acknowledgement: ``This product includes software developed by the +# University of California, Berkeley and its contributors'' in the +# documentation or other materials provided with the distribution and in +# all advertising materials mentioning features or use of this software. +# Neither the name of the University nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)Makefile 5.5 (Berkeley) 3/1/91 +# + +# +# Everything happens in ../Makefile.config and Makefile.generic +# +SHELL=/bin/sh + +all: + @-if test -f ../Config.local; \ + then \ + echo make -f ../Config.local WHAT=${WHAT} CC="${CC}"; \ + make -f ../Config.local WHAT=${WHAT} CC="${CC}"; \ + else \ + echo make -f ../Config.generic WHAT=${WHAT} CC="${CC}"; \ + make -f ../Config.generic WHAT=${WHAT} CC="${CC}"; \ + fi + +.DEFAULT: + @-if test -f ../Config.local; \ + then \ + echo make -f ../Config.local WHAT=${WHAT} CC="${CC}" $@; \ + make -f ../Config.local WHAT=${WHAT} CC="${CC}" $@; \ + else \ + echo make -f ../Config.generic WHAT=${WHAT} CC="${CC}" $@; \ + make -f ../Config.generic WHAT=${WHAT} CC="${CC}" $@; \ + fi diff --git a/appl/telnet/libtelnet/auth-proto.h b/appl/telnet/libtelnet/auth-proto.h new file mode 100644 index 000000000..6dd24b1e7 --- /dev/null +++ b/appl/telnet/libtelnet/auth-proto.h @@ -0,0 +1,114 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)auth-proto.h 8.1 (Berkeley) 6/4/93 + */ + +/* + * Copyright (C) 1990 by the Massachusetts Institute of Technology + * + * Export of this software from the United States of America is assumed + * to require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + */ + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +#if defined(AUTHENTICATION) +Authenticator *findauthenticator P((int, int)); + +void auth_init P((char *, int)); +int auth_cmd P((int, char **)); +void auth_request P((void)); +void auth_send P((unsigned char *, int)); +void auth_send_retry P((void)); +void auth_is P((unsigned char *, int)); +void auth_reply P((unsigned char *, int)); +void auth_finished P((Authenticator *, int)); +int auth_wait P((char *)); +void auth_disable_name P((char *)); +void auth_gen_printsub P((unsigned char *, int, unsigned char *, int)); + +#ifdef UNSAFE +int unsafe_init P((Authenticator *, int)); +int unsafe_send P((Authenticator *)); +void unsafe_is P((Authenticator *, unsigned char *, int)); +void unsafe_reply P((Authenticator *, unsigned char *, int)); +int unsafe_status P((Authenticator *, char *, int)); +void unsafe_printsub P((unsigned char *, int, unsigned char *, int)); +#endif + +#ifdef SRA +int sra_init P((Authenticator *, int)); +int sra_send P((Authenticator *)); +void sra_is P((Authenticator *, unsigned char *, int)); +void sra_reply P((Authenticator *, unsigned char *, int)); +int sra_status P((Authenticator *, char *, int)); +void sra_printsub P((unsigned char *, int, unsigned char *, int)); +#endif + +#ifdef KRB4 +int kerberos4_init P((Authenticator *, int)); +int kerberos4_send P((Authenticator *)); +void kerberos4_is P((Authenticator *, unsigned char *, int)); +void kerberos4_reply P((Authenticator *, unsigned char *, int)); +int kerberos4_status P((Authenticator *, char *, int)); +void kerberos4_printsub P((unsigned char *, int, unsigned char *, int)); +#endif + +#ifdef KRB5 +int kerberos5_init P((Authenticator *, int)); +int kerberos5_send P((Authenticator *)); +void kerberos5_is P((Authenticator *, unsigned char *, int)); +void kerberos5_reply P((Authenticator *, unsigned char *, int)); +int kerberos5_status P((Authenticator *, char *, int)); +void kerberos5_printsub P((unsigned char *, int, unsigned char *, int)); +#endif +#endif diff --git a/appl/telnet/libtelnet/auth.h b/appl/telnet/libtelnet/auth.h new file mode 100644 index 000000000..615e8a07b --- /dev/null +++ b/appl/telnet/libtelnet/auth.h @@ -0,0 +1,87 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)auth.h 8.1 (Berkeley) 6/4/93 + */ + +/* + * Copyright (C) 1990 by the Massachusetts Institute of Technology + * + * Export of this software from the United States of America is assumed + * to require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + */ + +#ifndef __AUTH__ +#define __AUTH__ + +#define AUTH_REJECT 0 /* Rejected */ +#define AUTH_UNKNOWN 1 /* We don't know who he is, but he's okay */ +#define AUTH_OTHER 2 /* We know him, but not his name */ +#define AUTH_USER 3 /* We know he name */ +#define AUTH_VALID 4 /* We know him, and he needs no password */ + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +typedef struct XauthP { + int type; + int way; + int (*init) P((struct XauthP *, int)); + int (*send) P((struct XauthP *)); + void (*is) P((struct XauthP *, unsigned char *, int)); + void (*reply) P((struct XauthP *, unsigned char *, int)); + int (*status) P((struct XauthP *, char *, int)); + void (*printsub) P((unsigned char *, int, unsigned char *, int)); +} Authenticator; + +#include "auth-proto.h" + +extern auth_debug_mode; +#endif diff --git a/appl/telnet/libtelnet/enc-proto.h b/appl/telnet/libtelnet/enc-proto.h new file mode 100644 index 000000000..be4504730 --- /dev/null +++ b/appl/telnet/libtelnet/enc-proto.h @@ -0,0 +1,121 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)enc-proto.h 8.1 (Berkeley) 6/4/93 + * + * @(#)enc-proto.h 5.2 (Berkeley) 3/22/91 + */ + +/* + * Copyright (C) 1990 by the Massachusetts Institute of Technology + * + * Export of this software from the United States of America is assumed + * to require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + */ +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + + +#if defined(ENCRYPTION) +void encrypt_init P((char *, int)); +Encryptions *findencryption P((int)); +void encrypt_send_supprt P((void)); +void encrypt_auto P((int)); +void decrypt_auto P((int)); +void encrypt_is P((unsigned char *, int)); +void encrypt_reply P((unsigned char *, int)); +void encrypt_start_input P((int)); +void encrypt_session_key P((Session_Key *, int)); +void encrypt_end_input P((void)); +void encrypt_start_output P((int)); +void encrypt_end_output P((void)); +void encrypt_send_request_start P((void)); +void encrypt_send_request_end P((void)); +void encrypt_send_end P((void)); +void encrypt_wait P((void)); +void encrypt_send_support P((void)); +void encrypt_send_keyid P((int, unsigned char *, int, int)); +int net_write P((unsigned char *, int)); + +#ifdef TELENTD +void encrypt_wait P((void)); +#else +int encrypt_cmd P((int, char **)); +void encrypt_display P((void)); +#endif + +void cfb64_encrypt P((unsigned char *, int)); +int cfb64_decrypt P((int)); +void cfb64_init P((int)); +int cfb64_start P((int, int)); +int cfb64_is P((unsigned char *, int)); +int cfb64_reply P((unsigned char *, int)); +void cfb64_session P((Session_Key *, int)); +int cfb64_keyid P((int, unsigned char *, int *)); +void cfb64_printsub P((unsigned char *, int, unsigned char *, int)); + +void ofb64_encrypt P((unsigned char *, int)); +int ofb64_decrypt P((int)); +void ofb64_init P((int)); +int ofb64_start P((int, int)); +int ofb64_is P((unsigned char *, int)); +int ofb64_reply P((unsigned char *, int)); +void ofb64_session P((Session_Key *, int)); +int ofb64_keyid P((int, unsigned char *, int *)); +void ofb64_printsub P((unsigned char *, int, unsigned char *, int)); + +#if OLD +int des_new_random_key P((Block)); +void des_set_random_generator_seed P((Block)); +void des_key_sched P((Block, Schedule)); +void des_ecb_encrypt P((Block, Block, Schedule, int)); +int des_string_to_key P((char *, Block)); +#endif +#endif diff --git a/appl/telnet/libtelnet/encrypt.h b/appl/telnet/libtelnet/encrypt.h new file mode 100644 index 000000000..cf783c845 --- /dev/null +++ b/appl/telnet/libtelnet/encrypt.h @@ -0,0 +1,109 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)encrypt.h 8.1 (Berkeley) 6/4/93 + * + * @(#)encrypt.h 5.2 (Berkeley) 3/22/91 + */ + +/* + * Copyright (C) 1990 by the Massachusetts Institute of Technology + * + * Export of this software from the United States of America is assumed + * to require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + */ + + +#ifndef __ENCRYPT__ +#define __ENCRYPT__ + +#define DIR_DECRYPT 1 +#define DIR_ENCRYPT 2 + +typedef unsigned char Block[8]; +typedef unsigned char *BlockT; +typedef struct { Block _B; } Schedule[16]; + +#define VALIDKEY(key) ( key[0] | key[1] | key[2] | key[3] | \ + key[4] | key[5] | key[6] | key[7]) + +#define SAMEKEY(k1, k2) (!bcmp((void *)k1, (void *)k2, sizeof(Block))) + +typedef struct { + short type; + int length; + unsigned char *data; +} Session_Key; + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +typedef struct { + char *name; + int type; + void (*output) P((unsigned char *, int)); + int (*input) P((int)); + void (*init) P((int)); + int (*start) P((int, int)); + int (*is) P((unsigned char *, int)); + int (*reply) P((unsigned char *, int)); + void (*session) P((Session_Key *, int)); + int (*keyid) P((int, unsigned char *, int *)); + void (*printsub) P((unsigned char *, int, unsigned char *, int)); +} Encryptions; + +#define SK_DES 1 /* Matched Kerberos v5 KEYTYPE_DES */ + +#include "enc-proto.h" + +extern int encrypt_debug_mode; +extern int (*decrypt_input) P((int)); +extern void (*encrypt_output) P((unsigned char *, int)); +#endif diff --git a/appl/telnet/libtelnet/forward.c b/appl/telnet/libtelnet/forward.c new file mode 100644 index 000000000..d7223eda3 --- /dev/null +++ b/appl/telnet/libtelnet/forward.c @@ -0,0 +1,636 @@ +/* + * $Source$ + * $Id$ + */ + +#ifndef lint +static char *rcsid_forward_c = + "$Id$"; +#endif /* lint */ +#define LIBC_SCCS + +/*- + * Copyright (c) 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)forward.c 8.2 (Berkeley) 5/30/95"; +#endif /* not lint */ + + +/* General-purpose forwarding routines. These routines may be put into */ +/* libkrb5.a to allow widespread use */ + +#if defined(KRB5) && defined(FORWARD) +#include +#include +#include + +#include +#include +#include +#include +#include + +#define KRB5_DEFAULT_LIFE 60*60*8 /* 8 hours */ +/* helper function: convert flags to necessary KDC options */ +#define flags2options(flags) (flags & KDC_TKT_COMMON_MASK) + + + +/* Get a TGT for use at the remote host */ +krb5_error_code +get_for_creds(etype, sumtype, rhost, client, enc_key, forwardable, outbuf) + const krb5_enctype etype; + const krb5_cksumtype sumtype; + char *rhost; + krb5_principal client; + krb5_keyblock *enc_key; + int forwardable; /* Should forwarded TGT also be forwardable? */ + krb5_data *outbuf; +{ + struct hostent *hp; + krb5_address **addrs; + krb5_error_code retval; + krb5_data *scratch; + krb5_kdc_rep *dec_rep; + krb5_error *err_reply; + krb5_response tgsrep; + krb5_creds creds, tgt; + krb5_ccache cc; + krb5_flags kdcoptions; + krb5_timestamp now; + char *remote_host; + char **hrealms; + int i; + + if (!rhost || !(hp = gethostbyname(rhost))) + return KRB5_ERR_BAD_HOSTNAME; + + remote_host = (char *) malloc(strlen(hp->h_name)+1); + if (!remote_host) + return ENOMEM; + strcpy(remote_host, hp->h_name); + + if (retval = krb5_get_host_realm(remote_host, &hrealms)) { + free(remote_host); + return retval; + } + if (!hrealms[0]) { + free(remote_host); + krb5_xfree(hrealms); + return KRB5_ERR_HOST_REALM_UNKNOWN; + } + + /* Count elements */ + for(i=0; hp->h_addr_list[i]; i++); + + addrs = (krb5_address **) malloc ((i+1)*sizeof(*addrs)); + if (!addrs) + return ENOMEM; + + for(i=0; hp->h_addr_list[i]; i++) { + addrs[i] = (krb5_address *) malloc(sizeof(krb5_address)); + if (addrs[i]) { + addrs[i]->addrtype = hp->h_addrtype; + addrs[i]->length = hp->h_length; + addrs[i]->contents = (unsigned char *)malloc(addrs[i]->length); + if (!addrs[i]->contents) { + krb5_free_addresses(addrs); + return ENOMEM; + } + else + memmove ((char *)addrs[i]->contents, hp->h_addr_list[i], + addrs[i]->length); + } + else { + return ENOMEM; + } + } + addrs[i] = 0; + + memset((char *)&creds, 0, sizeof(creds)); + if (retval = krb5_copy_principal(client, &creds.client)) + return retval; + + if (retval = krb5_build_principal_ext(&creds.server, + strlen(hrealms[0]), + hrealms[0], + KRB5_TGS_NAME_SIZE, + KRB5_TGS_NAME, + client->realm.length, + client->realm.data, + 0)) + return retval; + + creds.times.starttime = 0; + if (retval = krb5_timeofday(&now)) { + return retval; + } + creds.times.endtime = now + KRB5_DEFAULT_LIFE; + creds.times.renew_till = 0; + + if (retval = krb5_cc_default(&cc)) { + return retval; + } + + /* fetch tgt directly from cache */ + if (retval = krb5_cc_retrieve_cred (cc, + KRB5_TC_MATCH_SRV_NAMEONLY, + &creds, + &tgt)) { + return retval; + } + + /* tgt->client must be equal to creds.client */ + if (!krb5_principal_compare(tgt.client, creds.client)) + return KRB5_PRINC_NOMATCH; + + if (!tgt.ticket.length) + return(KRB5_NO_TKT_SUPPLIED); + + kdcoptions = flags2options(tgt.ticket_flags)|KDC_OPT_FORWARDED; + + if (!forwardable) /* Reset KDC_OPT_FORWARDABLE */ + kdcoptions &= ~(KDC_OPT_FORWARDABLE); + + if (retval = krb5_send_tgs(kdcoptions, &creds.times, etype, sumtype, + creds.server, + addrs, + creds.authdata, + 0, /* no padata */ + 0, /* no second ticket */ + &tgt, &tgsrep)) + return retval; + +#undef cleanup +#define cleanup() free(tgsrep.response.data) + + switch (tgsrep.message_type) { + case KRB5_TGS_REP: + break; + case KRB5_ERROR: + default: + if (!krb5_is_krb_error(&tgsrep.response)) { + retval = KRB5KRB_AP_ERR_MSG_TYPE; + } else + retval = decode_krb5_error(&tgsrep.response, &err_reply); + if (retval) { + cleanup(); + return retval; /* neither proper reply nor error! */ + } + + retval = err_reply->error + ERROR_TABLE_BASE_krb5; + + krb5_free_error(err_reply); + cleanup(); + return retval; + } + retval = krb5_decode_kdc_rep(&tgsrep.response, + &tgt.keyblock, + etype, /* enctype */ + &dec_rep); + + cleanup(); + if (retval) + return retval; +#undef cleanup +#define cleanup() {\ + memset((char *)dec_rep->enc_part2->session->contents, 0,\ + dec_rep->enc_part2->session->length);\ + krb5_free_kdc_rep(dec_rep); } + + if (dec_rep->msg_type != KRB5_TGS_REP) { + retval = KRB5KRB_AP_ERR_MSG_TYPE; + cleanup(); + return retval; + } + + /* now it's decrypted and ready for prime time */ + + if (!krb5_principal_compare(dec_rep->client, tgt.client)) { + cleanup(); + return KRB5_KDCREP_MODIFIED; + } + + if (retval = mk_cred(dec_rep, + etype, + enc_key, + 0, + 0, + outbuf)) + return retval; + + krb5_free_kdc_rep(dec_rep); + + return retval; +#undef cleanup +} + + + +/* Create asn.1 encoded KRB-CRED message from the kdc reply. */ +krb5_error_code +mk_cred(dec_rep, etype, key, sender_addr, recv_addr, outbuf) +krb5_kdc_rep *dec_rep; +krb5_enctype etype; +krb5_keyblock *key; +krb5_address *sender_addr; +krb5_address *recv_addr; +krb5_data *outbuf; +{ + krb5_error_code retval; + krb5_encrypt_block eblock; + krb5_cred ret_cred; + krb5_cred_enc_part cred_enc_part; + krb5_data *scratch; + + if (!valid_etype(etype)) + return KRB5_PROG_ETYPE_NOSUPP; + + ret_cred.tickets = (krb5_ticket **) calloc(2, sizeof(*ret_cred.tickets)); + if (!ret_cred.tickets) + return ENOMEM; + ret_cred.tickets[0] = dec_rep->ticket; + ret_cred.tickets[1] = 0; + + ret_cred.enc_part.etype = etype; + ret_cred.enc_part.kvno = 0; + + cred_enc_part.ticket_info = (krb5_cred_info **) + calloc(2, sizeof(*cred_enc_part.ticket_info)); + if (!cred_enc_part.ticket_info) { + krb5_free_tickets(ret_cred.tickets); + return ENOMEM; + } + cred_enc_part.ticket_info[0] = (krb5_cred_info *) + malloc(sizeof(*cred_enc_part.ticket_info[0])); + if (!cred_enc_part.ticket_info[0]) { + krb5_free_tickets(ret_cred.tickets); + krb5_free_cred_enc_part(cred_enc_part); + return ENOMEM; + } + cred_enc_part.nonce = 0; + + if (retval = krb5_us_timeofday(&cred_enc_part.timestamp, + &cred_enc_part.usec)) + return retval; + + cred_enc_part.s_address = (krb5_address *)sender_addr; + cred_enc_part.r_address = (krb5_address *)recv_addr; + + cred_enc_part.ticket_info[0]->session = dec_rep->enc_part2->session; + cred_enc_part.ticket_info[0]->client = dec_rep->client; + cred_enc_part.ticket_info[0]->server = dec_rep->enc_part2->server; + cred_enc_part.ticket_info[0]->flags = dec_rep->enc_part2->flags; + cred_enc_part.ticket_info[0]->times = dec_rep->enc_part2->times; + cred_enc_part.ticket_info[0]->caddrs = dec_rep->enc_part2->caddrs; + + cred_enc_part.ticket_info[1] = 0; + + /* start by encoding to-be-encrypted part of the message */ + + if (retval = encode_krb5_enc_cred_part(&cred_enc_part, &scratch)) + return retval; + +#define cleanup_scratch() { (void) memset(scratch->data, 0, scratch->length); krb5_free_data(scratch); } + + /* put together an eblock for this encryption */ + + krb5_use_cstype(&eblock, etype); + ret_cred.enc_part.ciphertext.length = krb5_encrypt_size(scratch->length, + eblock.crypto_entry); + /* add padding area, and zero it */ + if (!(scratch->data = realloc(scratch->data, + ret_cred.enc_part.ciphertext.length))) { + /* may destroy scratch->data */ + krb5_xfree(scratch); + return ENOMEM; + } + memset(scratch->data + scratch->length, 0, + ret_cred.enc_part.ciphertext.length - scratch->length); + if (!(ret_cred.enc_part.ciphertext.data = + malloc(ret_cred.enc_part.ciphertext.length))) { + retval = ENOMEM; + goto clean_scratch; + } + +#define cleanup_encpart() {\ + (void) memset(ret_cred.enc_part.ciphertext.data, 0, \ + ret_cred.enc_part.ciphertext.length); \ + free(ret_cred.enc_part.ciphertext.data); \ + ret_cred.enc_part.ciphertext.length = 0; \ + ret_cred.enc_part.ciphertext.data = 0;} + + /* do any necessary key pre-processing */ + if (retval = krb5_process_key(&eblock, key)) { + goto clean_encpart; + } + +#define cleanup_prockey() {(void) krb5_finish_key(&eblock);} + + /* call the encryption routine */ + if (retval = krb5_encrypt((krb5_pointer) scratch->data, + (krb5_pointer) + ret_cred.enc_part.ciphertext.data, + scratch->length, &eblock, + 0)) { + goto clean_prockey; + } + + /* private message is now assembled-- do some cleanup */ + cleanup_scratch(); + + if (retval = krb5_finish_key(&eblock)) { + cleanup_encpart(); + return retval; + } + /* encode private message */ + if (retval = encode_krb5_cred(&ret_cred, &scratch)) { + cleanup_encpart(); + return retval; + } + + cleanup_encpart(); + + *outbuf = *scratch; + krb5_xfree(scratch); + return 0; + + clean_prockey: + cleanup_prockey(); + clean_encpart: + cleanup_encpart(); + clean_scratch: + cleanup_scratch(); + + return retval; +#undef cleanup_prockey +#undef cleanup_encpart +#undef cleanup_scratch +} + + + +/* Decode, decrypt and store the forwarded creds in the local ccache. */ +krb5_error_code +rd_and_store_for_creds(inbuf, ticket, lusername) + krb5_data *inbuf; + krb5_ticket *ticket; + char *lusername; +{ + krb5_encrypt_block eblock; + krb5_creds creds; + krb5_error_code retval; + char ccname[35]; + krb5_ccache ccache = NULL; + struct passwd *pwd; + + if (retval = rd_cred(inbuf, ticket->enc_part2->session, + &creds, 0, 0)) { + return(retval); + } + + if (!(pwd = (struct passwd *) getpwnam(lusername))) { + return -1; + } + + sprintf(ccname, "FILE:/tmp/krb5cc_%d", pwd->pw_uid); + + if (retval = krb5_cc_resolve(ccname, &ccache)) { + return(retval); + } + + if (retval = krb5_cc_initialize(ccache, + ticket->enc_part2->client)) { + return(retval); + } + + if (retval = krb5_cc_store_cred(ccache, &creds)) { + return(retval); + } + + if (retval = chown(ccname+5, pwd->pw_uid, -1)) { + return(retval); + } + + return retval; +} + + + +extern krb5_deltat krb5_clockskew; +#define in_clock_skew(date) (abs((date)-currenttime) < krb5_clockskew) + +/* Decode the KRB-CRED message, and return creds */ +krb5_error_code +rd_cred(inbuf, key, creds, sender_addr, recv_addr) +const krb5_data *inbuf; +const krb5_keyblock *key; +krb5_creds *creds; /* Filled in */ +const krb5_address *sender_addr; /* optional */ +const krb5_address *recv_addr; /* optional */ +{ + krb5_error_code retval; + krb5_encrypt_block eblock; + krb5_cred *credmsg; + krb5_cred_enc_part *credmsg_enc_part; + krb5_data *scratch; + krb5_timestamp currenttime; + + if (!krb5_is_krb_cred(inbuf)) + return KRB5KRB_AP_ERR_MSG_TYPE; + + /* decode private message */ + if (retval = decode_krb5_cred(inbuf, &credmsg)) { + return retval; + } + +#define cleanup_credmsg() {(void)krb5_xfree(credmsg->enc_part.ciphertext.data); (void)krb5_xfree(credmsg);} + + if (!(scratch = (krb5_data *) malloc(sizeof(*scratch)))) { + cleanup_credmsg(); + return ENOMEM; + } + +#define cleanup_scratch() {(void)memset(scratch->data, 0, scratch->length); (void)krb5_xfree(scratch->data);} + + if (retval = encode_krb5_ticket(credmsg->tickets[0], &scratch)) { + cleanup_credmsg(); + cleanup_scratch(); + return(retval); + } + + creds->ticket = *scratch; + if (!(creds->ticket.data = malloc(scratch->length))) { + krb5_xfree(creds->ticket.data); + return ENOMEM; + } + memmove((char *)creds->ticket.data, (char *) scratch->data, scratch->length); + + cleanup_scratch(); + + if (!valid_etype(credmsg->enc_part.etype)) { + cleanup_credmsg(); + return KRB5_PROG_ETYPE_NOSUPP; + } + + /* put together an eblock for this decryption */ + + krb5_use_cstype(&eblock, credmsg->enc_part.etype); + scratch->length = credmsg->enc_part.ciphertext.length; + + if (!(scratch->data = malloc(scratch->length))) { + cleanup_credmsg(); + return ENOMEM; + } + + /* do any necessary key pre-processing */ + if (retval = krb5_process_key(&eblock, key)) { + cleanup_credmsg(); + cleanup_scratch(); + return retval; + } + +#define cleanup_prockey() {(void) krb5_finish_key(&eblock);} + + /* call the decryption routine */ + if (retval = krb5_decrypt((krb5_pointer) credmsg->enc_part.ciphertext.data, + (krb5_pointer) scratch->data, + scratch->length, &eblock, + 0)) { + cleanup_credmsg(); + cleanup_scratch(); + cleanup_prockey(); + return retval; + } + + /* cred message is now decrypted -- do some cleanup */ + + cleanup_credmsg(); + + if (retval = krb5_finish_key(&eblock)) { + cleanup_scratch(); + return retval; + } + + /* now decode the decrypted stuff */ + if (retval = decode_krb5_enc_cred_part(scratch, &credmsg_enc_part)) { + cleanup_scratch(); + return retval; + } + cleanup_scratch(); + +#define cleanup_mesg() {(void)krb5_xfree(credmsg_enc_part);} + + if (retval = krb5_timeofday(¤ttime)) { + cleanup_mesg(); + return retval; + } + if (!in_clock_skew(credmsg_enc_part->timestamp)) { + cleanup_mesg(); + return KRB5KRB_AP_ERR_SKEW; + } + + if (sender_addr && credmsg_enc_part->s_address && + !krb5_address_compare(sender_addr, + credmsg_enc_part->s_address)) { + cleanup_mesg(); + return KRB5KRB_AP_ERR_BADADDR; + } + if (recv_addr && credmsg_enc_part->r_address && + !krb5_address_compare(recv_addr, + credmsg_enc_part->r_address)) { + cleanup_mesg(); + return KRB5KRB_AP_ERR_BADADDR; + } + + if (credmsg_enc_part->r_address) { + krb5_address **our_addrs; + + if (retval = krb5_os_localaddr(&our_addrs)) { + cleanup_mesg(); + return retval; + } + if (!krb5_address_search(credmsg_enc_part->r_address, + our_addrs)) { + krb5_free_addresses(our_addrs); + cleanup_mesg(); + return KRB5KRB_AP_ERR_BADADDR; + } + krb5_free_addresses(our_addrs); + } + + if (retval = krb5_copy_principal(credmsg_enc_part->ticket_info[0]->client, + &creds->client)) { + return(retval); + } + + if (retval = krb5_copy_principal(credmsg_enc_part->ticket_info[0]->server, + &creds->server)) { + return(retval); + } + + if (retval = + krb5_copy_keyblock_contents(credmsg_enc_part->ticket_info[0]->session, + &creds->keyblock)) { + return(retval); + } + +#undef clean +#define clean() {\ + memset((char *)creds->keyblock.contents, 0, creds->keyblock.length);} + + creds->times = credmsg_enc_part->ticket_info[0]->times; + creds->is_skey = FALSE; + creds->ticket_flags = credmsg_enc_part->ticket_info[0]->flags; + + if (retval = krb5_copy_addresses(credmsg_enc_part->ticket_info[0]->caddrs, + &creds->addresses)) { + clean(); + return(retval); + } + + creds->second_ticket.length = 0; + + creds->authdata = 0; + + cleanup_mesg(); + return 0; +#undef clean +#undef cleanup_credmsg +#undef cleanup_scratch +#undef cleanup_prockey +#undef cleanup_mesg +} + +#endif /* defined(KRB5) && defined(FORWARD) */ diff --git a/appl/telnet/libtelnet/genget.c b/appl/telnet/libtelnet/genget.c new file mode 100644 index 000000000..7be384647 --- /dev/null +++ b/appl/telnet/libtelnet/genget.c @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)genget.c 8.2 (Berkeley) 5/30/95"; +#endif /* not lint */ + + +#include + +#define LOWER(x) (isupper(x) ? tolower(x) : (x)) +/* + * The prefix function returns 0 if *s1 is not a prefix + * of *s2. If *s1 exactly matches *s2, the negative of + * the length is returned. If *s1 is a prefix of *s2, + * the length of *s1 is returned. + */ + int +isprefix(s1, s2) + register char *s1, *s2; +{ + register int n = 0; + char *os1; + register char c1, c2; + + if (*s1 == '\0') + return(-1); + os1 = s1; + c1 = *s1; + c2 = *s2; + while (LOWER(c1) == LOWER(c2)) { + if (c1 == '\0') + break; + c1 = *++s1; + c2 = *++s2; + } + return(*s1 ? 0 : (*s2 ? (s1 - os1) : (os1 - s1))); +} + +static char *ambiguous; /* special return value for command routines */ + + char ** +genget(name, table, stlen) + char *name; /* name to match */ + char **table; /* name entry in table */ + int stlen; +{ + register char **c, **found; + register int n; + + if (name == 0) + return 0; + + found = 0; + for (c = table; *c != 0; c = (char **)((char *)c + stlen)) { + if ((n = isprefix(name, *c)) == 0) + continue; + if (n < 0) /* exact match */ + return(c); + if (found) + return(&ambiguous); + found = c; + } + return(found); +} + +/* + * Function call version of Ambiguous() + */ + int +Ambiguous(s) + char *s; +{ + return((char **)s == &ambiguous); +} diff --git a/appl/telnet/libtelnet/key-proto.h b/appl/telnet/libtelnet/key-proto.h new file mode 100644 index 000000000..9668a775b --- /dev/null +++ b/appl/telnet/libtelnet/key-proto.h @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)key-proto.h 8.1 (Berkeley) 6/4/93 + */ + +/* + * Copyright (C) 1990 by the Massachusetts Institute of Technology + * + * Export of this software from the United States of America is assumed + * to require a specific license from the United States Government. + * It is the responsibility of any person or organization contemplating + * export to obtain such a license before exporting. + * + * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and + * distribute this software and its documentation for any purpose and + * without fee is hereby granted, provided that the above copyright + * notice appear in all copies and that both that copyright notice and + * this permission notice appear in supporting documentation, and that + * the name of M.I.T. not be used in advertising or publicity pertaining + * to distribution of the software without specific, written prior + * permission. M.I.T. makes no representations about the suitability of + * this software for any purpose. It is provided "as is" without express + * or implied warranty. + */ + +#ifndef __KEY_PROTO__ +#define __KEY_PROTO__ + +#if !defined(P) +#ifdef __STDC__ +#define P(x) x +#else +#define P(x) () +#endif +#endif + +int key_file_exists P((void)); +void key_lookup P((unsigned char *, Block)); +void key_stream_init P((Block, Block, int)); +unsigned char key_stream P((int, int)); +#endif diff --git a/appl/telnet/libtelnet/misc.h b/appl/telnet/libtelnet/misc.h new file mode 100644 index 000000000..41ffa7f67 --- /dev/null +++ b/appl/telnet/libtelnet/misc.h @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)misc.h 8.1 (Berkeley) 6/4/93 + */ + +extern char *UserNameRequested; +extern char *LocalHostName; +extern char *RemoteHostName; +extern int ConnectedCount; +extern int ReservedPort; + +#include "misc-proto.h" diff --git a/appl/telnet/libtelnet/parsetos.c b/appl/telnet/libtelnet/parsetos.c new file mode 100644 index 000000000..eb34ddf43 --- /dev/null +++ b/appl/telnet/libtelnet/parsetos.c @@ -0,0 +1,41 @@ + +/* + * The routine parsetos() for UNICOS 6.0/6.1 systems. This + * is part of UNICOS 7.0 and later. + */ +#include +#include +#include +#include + + +#define MIN_TOS 0 +#define MAX_TOS 255 + +int +parsetos(name, proto) +char *name; +char *proto; +{ + register char *c; + int tos; + struct tosent *tosp; + + tosp = gettosbyname(name, proto); + if (tosp) { + tos = tosp->t_tos; + } else { + for (c = name; *c; c++) { + if (*c < '0' || *c > '9') { + errno = EINVAL; + return (-1); + } + } + tos = (int)strtol(name, (char **)NULL, 0); + } + if (tos < MIN_TOS || tos > MAX_TOS) { + errno = ERANGE; + return (-1); + } + return (tos); +} diff --git a/appl/telnet/libtelnet/setsid.c b/appl/telnet/libtelnet/setsid.c new file mode 100644 index 000000000..14d32566f --- /dev/null +++ b/appl/telnet/libtelnet/setsid.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)setsid.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +/* + * Emulate the functionality of setsid(), called when forking + * and execing the new process. + */ + +extern char *line; +setsid() +{ +#ifndef convex + if (setpgrp(0, 0) < 0) + return(-1); +#endif + return(0); +} diff --git a/appl/telnet/stty.diff b/appl/telnet/stty.diff new file mode 100644 index 000000000..3c1b02acc --- /dev/null +++ b/appl/telnet/stty.diff @@ -0,0 +1,72 @@ +*** stty.c.old Tue May 23 13:54:29 1989 +--- stty.c Wed Aug 23 13:42:32 1989 +*************** +*** 20,25 **** +--- 20,28 ---- + + #include + #include ++ #include ++ #define NO_T_CHARS_DEFINES ++ #include + + struct + { +*************** +*** 145,150 **** +--- 148,156 ---- + struct winsize win; + int lmode; + int oldisc, ldisc; ++ #ifdef TIOCGSTATE ++ int extproc; ++ #endif + + struct special { + char *name; +*************** +*** 188,193 **** +--- 194,203 ---- + ioctl(1, TIOCLGET, &lmode); + ioctl(1, TIOCGLTC, <c); + ioctl(1, TIOCGWINSZ, &win); ++ #ifdef TIOCGSTATE ++ ioctl(1, TIOCGSTATE, &extproc); ++ extproc &= TS_EXTPROC; ++ #endif + if(argc == 1) { + prmodes(0); + exit(0); +*************** +*** 292,297 **** +--- 302,316 ---- + printf("%d %d\n", win.ws_row, win.ws_col); + exit(0); + } ++ #if defined(TIOCEXT) ++ if (eq("extproc") || eq("-extproc")) { ++ if (**argv == '-') ++ extproc = 0; ++ else ++ extproc = 1; ++ ioctl(1, TIOCEXT, &extproc); ++ } ++ #endif + for(i=0; speeds[i].string; i++) + if(eq(speeds[i].string)) { + mode.sg_ispeed = mode.sg_ospeed = speeds[i].speed; +*************** +*** 438,443 **** +--- 457,468 ---- + lpit(LPENDIN, "-pendin "); + lpit(LDECCTQ, "-decctlq "); + lpit(LNOFLSH, "-noflsh "); ++ #ifdef TIOCGSTATE ++ if (all==2||extproc) { ++ fprintf(stderr,"-extproc"+(extproc!=0)); ++ any++; ++ } ++ #endif + if (any || nothing) + fprintf(stderr,"\n"); + } else if (!all) diff --git a/appl/telnet/telnet.state b/appl/telnet/telnet.state new file mode 100644 index 000000000..1927a2b4b --- /dev/null +++ b/appl/telnet/telnet.state @@ -0,0 +1,80 @@ + + Three pieces of state need to be kept for each side of each option. + (You need the localside, sending WILL/WONT & receiving DO/DONT, and + the remoteside, sending DO/DONT and receiving WILL/WONT) + + MY_STATE: What state am I in? + WANT_STATE: What state do I want? + WANT_RESP: How many requests have I initiated? + + Default values: + MY_STATE = WANT_STATE = DONT + WANT_RESP = 0 + + The local setup will change based on the state of the Telnet + variables. When we are the originator, we can either make the + local setup changes at option request time (in which case if + the option is denied we need to change things back) or when + the option is acknowledged. + + To initiate a switch to NEW_STATE: + + if ((WANT_RESP == 0 && NEW_STATE == MY_STATE) || + WANT_STATE == NEW_STATE) { + do nothing; + } else { + /* + * This is where the logic goes to change the local setup + * if we are doing so at request initiation + */ + WANT_STATE = NEW_STATE; + send NEW_STATE; + WANT_RESP += 1; + } + + When receiving NEW_STATE: + + if (WANT_RESP) { + --WANT_RESP; + if (WANT_RESP && (NEW_STATE == MY_STATE)) + --WANT_RESP; + } + if (WANT_RESP == 0) { + if (NEW_STATE != WANT_STATE) { + /* + * This is where the logic goes to decide if it is ok + * to switch to NEW_STATE, and if so, do any necessary + * local setup changes. + */ + if (ok_to_switch_to NEW_STATE) + WANT_STATE = NEW_STATE; + else + WANT_RESP++; +* if (MY_STATE != WANT_STATE) + reply with WANT_STATE; + } else { + /* + * This is where the logic goes to change the local setup + * if we are doing so at request acknowledgment + */ + } + } + MY_STATE = NEW_STATE; + +* This if() line is not needed, it should be ok to always do the + "reply with WANT_STATE". With the if() line, asking to turn on + an option that the other side doesn't understand is: + Send DO option + Recv WONT option + Without the if() line, it is: + Send DO option + Recv WONT option + Send DONT option + If the other side does not expect to receive the latter case, + but generates the latter case, then there is a potential for + option negotiation loops. An implementation that does not expect + to get the second case should not generate it, an implementation + that does expect to get it may or may not generate it, and things + will still work. Being conservative in what we send, we have the + if() statement in, but we expect the other side to generate the + last response. diff --git a/appl/telnet/telnet/Makefile.4.4 b/appl/telnet/telnet/Makefile.4.4 new file mode 100644 index 000000000..2e38a2880 --- /dev/null +++ b/appl/telnet/telnet/Makefile.4.4 @@ -0,0 +1,73 @@ +# +# Copyright (c) 1990 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. All advertising materials mentioning features or use of this software +# must display the following acknowledgement: +# This product includes software developed by the University of +# California, Berkeley and its contributors. +# 4. Neither the name of the University nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# @(#)Makefile 8.1 (Berkeley) 6/6/93 +# + +PROG= telnet + +CFLAGS+=-DTERMCAP -DKLUDGELINEMODE -DUSE_TERMIO -DAUTHENTICATION -DENCRYPTION +CFLAGS+=-DENV_HACK +CFLAGS+=-I${.CURDIR}/../../lib + +CFLAGS+= -DKRB4 + +LDADD= -ltermcap -ltelnet +LDADD+= -lkrb -ldes +DPADD= ${LIBTERMCAP} + +SRCS= authenc.c commands.c main.c network.c ring.c sys_bsd.c telnet.c \ + terminal.c tn3270.c utilities.c + +# These are the sources that have encryption stuff in them. +CRYPT_SRC= authenc.c commands.c externs.h main.c network.c +CRYPT_SRC+= ring.c ring.h telnet.c terminal.c utilities.c Makefile +NOCRYPT_DIR=${.CURDIR}/Nocrypt + +.include + +nocrypt: +#ifdef ENCRYPTION + @for i in ${CRYPT_SRC}; do \ + if [ ! -d ${NOCRYPT_DIR} ]; then \ + echo Creating subdirectory ${NOCRYPT_DIR}; \ + mkdir ${NOCRYPT_DIR}; \ + fi; \ + echo ${NOCRYPT_DIR}/$$i; \ + unifdef -UENCRYPTION ${.CURDIR}/$$i | \ + sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \ + done + +placeholder: +#else /* ENCRYPTION */ + @echo "Encryption code already removed." +#endif /* ENCRYPTION */ diff --git a/appl/telnet/telnet/Makefile.ORIG b/appl/telnet/telnet/Makefile.ORIG new file mode 100644 index 000000000..46597306c --- /dev/null +++ b/appl/telnet/telnet/Makefile.ORIG @@ -0,0 +1,45 @@ +# +# Copyright (c) 1991 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted provided +# that: (1) source distributions retain this entire copyright notice and +# comment, and (2) distributions including binaries display the following +# acknowledgement: ``This product includes software developed by the +# University of California, Berkeley and its contributors'' in the +# documentation or other materials provided with the distribution and in +# all advertising materials mentioning features or use of this software. +# Neither the name of the University nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)Makefile 5.5 (Berkeley) 3/1/91 +# + +# +# Everything happens in ../Makefile.config and Makefile.generic +# +SHELL=/bin/sh + +all: + @-if test -f ../Config.local; \ + then \ + echo make -f ../Config.local WHAT=${WHAT} CC="${CC}"; \ + make -f ../Config.local WHAT=${WHAT} CC="${CC}"; \ + else \ + echo make -f ../Config.generic WHAT=${WHAT} CC="${CC}"; \ + make -f ../Config.generic WHAT=${WHAT} CC="${CC}"; \ + fi + +.DEFAULT: + @-if test -f ../Config.local; \ + then \ + echo make -f ../Config.local WHAT=${WHAT} CC="${CC}" $@; \ + make -f ../Config.local WHAT=${WHAT} CC="${CC}" $@; \ + else \ + echo make -f ../Config.generic WHAT=${WHAT} CC="${CC}" $@; \ + make -f ../Config.generic WHAT=${WHAT} CC="${CC}" $@; \ + fi diff --git a/appl/telnet/telnet/Makefile.generic b/appl/telnet/telnet/Makefile.generic new file mode 100644 index 000000000..5b6ea2651 --- /dev/null +++ b/appl/telnet/telnet/Makefile.generic @@ -0,0 +1,89 @@ +# +# Copyright (c) 1991 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted provided +# that: (1) source distributions retain this entire copyright notice and +# comment, and (2) distributions including binaries display the following +# acknowledgement: ``This product includes software developed by the +# University of California, Berkeley and its contributors'' in the +# documentation or other materials provided with the distribution and in +# all advertising materials mentioning features or use of this software. +# Neither the name of the University nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)Makefile.generic 5.5 (Berkeley) 3/1/91 +# + +INCLUDES= -I.. +ARPA_TELNET= ../arpa/telnet.h + +SRCS= commands.c main.c network.c ring.c \ + sys_bsd.c telnet.c terminal.c \ + utilities.c ${GETOPT_SRC} + +CFLAGS= ${LCCFLAGS} ${INCLUDES} ${DEFINES} + +ALLHC= ${SRCS} \ + defines.h externs.h fdset.h general.h \ + ring.h types.h + +OBJS= authenc.o commands.o main.o network.o ring.o sys_bsd.o \ + telnet.o terminal.o utilities.o ${GETOPT_OBJ} +MAN= telnet.0 + +# +# These next three lines are not needed in 4.4BSD +# +.SUFFIXES: .0 .1 +.1.0: + nroff -man -h $< > $@ + +all: telnet + +telnet: ${OBJS} ${LIBPATH} + ${CC} -o $@ ${CFLAGS} ${OBJS} ${LIBS} + +clean: FRC + rm -f ${OBJS} core errs l.errs telnet + +cleandir: clean + rm -f ${MAN} tags .depend + +clist: FRC ${SRCS} + @for i in ${SRCS} ; \ + do (echo ${DIRPATH}$$i); done + +hclist: FRC ${ALLHC} + @for i in ${ALLHC} ; \ + do (echo ${DIRPATH}$$i); done + +depend: FRC ${SRCS} + mkdep ${CFLAGS} `make clist` + +install: ${MAN} FRC + install -s -o bin -g bin -m 755 telnet ${DEST} + install -c -o bin -g bin -m 444 telnet.0 ${DESTDIR}/usr/man/cat1 + +lint: FRC ${SRCS} + lint ${CFLAGS} `make clist` + +tags: FRC ${SRCS} + ctags `make hclist` + +FRC: + +authenc.o: defines.h externs.h general.h ring.h types.h ${ARPA_TELNET} +commands.o: defines.h externs.h general.h ring.h types.h ${ARPA_TELNET} +main.o: defines.h externs.h ring.h +network.o: defines.h externs.h fdset.h ring.h ${ARPA_TELNET} +ring.o: general.h ring.h +sys_bsd.o: defines.h externs.h fdset.h ring.h types.h ${ARPA_TELNET} +telnet.o: defines.h externs.h general.h ring.h types.h ${ARPA_TELNET} +terminal.o: externs.h ring.h types.h ${ARPA_TELNET} +tn3270.o: defines.h externs.h fdset.h general.h ring.h ${ARPA_TELNET} +utilities.o: defines.h externs.h fdset.h general.h ring.h ${ARPA_TELNET} diff --git a/appl/telnet/telnet/defines.h b/appl/telnet/telnet/defines.h new file mode 100644 index 000000000..0978173ea --- /dev/null +++ b/appl/telnet/telnet/defines.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)defines.h 8.1 (Berkeley) 6/6/93 + */ + +#define settimer(x) clocks.x = clocks.system++ + +#if !defined(TN3270) + +#define SetIn3270() + +#endif /* !defined(TN3270) */ + +#define NETADD(c) { *netoring.supply = c; ring_supplied(&netoring, 1); } +#define NET2ADD(c1,c2) { NETADD(c1); NETADD(c2); } +#define NETBYTES() (ring_full_count(&netoring)) +#define NETROOM() (ring_empty_count(&netoring)) + +#define TTYADD(c) if (!(SYNCHing||flushout)) { \ + *ttyoring.supply = c; \ + ring_supplied(&ttyoring, 1); \ + } +#define TTYBYTES() (ring_full_count(&ttyoring)) +#define TTYROOM() (ring_empty_count(&ttyoring)) + +/* Various modes */ +#define MODE_LOCAL_CHARS(m) ((m)&(MODE_EDIT|MODE_TRAPSIG)) +#define MODE_LOCAL_ECHO(m) ((m)&MODE_ECHO) +#define MODE_COMMAND_LINE(m) ((m)==-1) + +#define CONTROL(x) ((x)&0x1f) /* CTRL(x) is not portable */ diff --git a/appl/telnet/telnet/fdset.h b/appl/telnet/telnet/fdset.h new file mode 100644 index 000000000..045bb7221 --- /dev/null +++ b/appl/telnet/telnet/fdset.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)fdset.h 8.1 (Berkeley) 6/6/93 + */ + +/* + * The following is defined just in case someone should want to run + * this telnet on a 4.2 system. + * + */ + +#ifndef FD_SETSIZE + +#define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n))) +#define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n))) +#define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n))) +#define FD_ZERO(p) ((p)->fds_bits[0] = 0) + +#endif diff --git a/appl/telnet/telnet/general.h b/appl/telnet/telnet/general.h new file mode 100644 index 000000000..4efa95194 --- /dev/null +++ b/appl/telnet/telnet/general.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)general.h 8.1 (Berkeley) 6/6/93 + */ + +/* + * Some general definitions. + */ + + +#define numberof(x) (sizeof x/sizeof x[0]) +#define highestof(x) (numberof(x)-1) + +#define ClearElement(x) memset((char *)&x, 0, sizeof x) +#define ClearArray(x) memset((char *)x, 0, sizeof x) diff --git a/appl/telnet/telnet/main.c.foodiff b/appl/telnet/telnet/main.c.foodiff new file mode 100644 index 000000000..9753c40b4 --- /dev/null +++ b/appl/telnet/telnet/main.c.foodiff @@ -0,0 +1,86 @@ +*** main.c 1995/09/02 12:18:50 1.5 +--- main.c 1995/10/03 15:40:58 +*************** +*** 137,147 **** + rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE; + + /* +! * if AUTHENTICATION and ENCRYPTION is set autologin will be +! * se to true after the getopt switch; unless the -K option is +! * passed + */ +! autologin = -1; + + while ((ch = getopt(argc, argv, "8EKLS:X:acde:fFk:l:n:rt:x")) != EOF) { + switch(ch) { +--- 137,152 ---- + rlogin = (strncmp(prompt, "rlog", 4) == 0) ? '~' : _POSIX_VDISABLE; + + /* +! * Default is automatic authentication and encryption. +! * Use -K to dissable it and -Ka to only use authentication. + */ +! #ifdef AUTHENTICATION +! autologin = 1; +! #ifdef ENCRYPTION +! encrypt_auto(1); +! decrypt_auto(1); +! #endif +! #endif + + while ((ch = getopt(argc, argv, "8EKLS:X:acde:fFk:l:n:rt:x")) != EOF) { + switch(ch) { +*************** +*** 154,160 **** +--- 159,169 ---- + case 'K': + #ifdef AUTHENTICATION + autologin = 0; ++ #ifdef ENCRYPTION ++ encrypt_auto(0); ++ decrypt_auto(0); + #endif ++ #endif + break; + case 'L': + eight |= 2; /* binary output only */ +*************** +*** 239,248 **** + #endif + break; + case 'l': +! if(autologin == 0){ +! fprintf(stderr, "%s: Warning: -K ignored\n", prompt); +! autologin = -1; +! } + user = optarg; + break; + case 'n': +--- 248,254 ---- + #endif + break; + case 'l': +! autologin = 1; + user = optarg; + break; + case 'n': +*************** +*** 290,306 **** + /* NOTREACHED */ + } + } +- +- if (autologin == -1) { /* esc@magic.fi; force */ +- #if defined(AUTHENTICATION) +- autologin = 1; +- #endif +- #if defined(ENCRYPTION) +- encrypt_auto(1); +- decrypt_auto(1); +- #endif +- } +- + if (autologin == -1) + autologin = (rlogin == _POSIX_VDISABLE) ? 0 : 1; + +--- 296,301 ---- diff --git a/appl/telnet/telnet/ring.h b/appl/telnet/telnet/ring.h new file mode 100644 index 000000000..fb9adcf48 --- /dev/null +++ b/appl/telnet/telnet/ring.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)ring.h 8.1 (Berkeley) 6/6/93 + */ + +#if defined(P) +# undef P +#endif + +#if defined(__STDC__) || defined(LINT_ARGS) +# define P(x) x +#else +# define P(x) () +#endif + +/* + * This defines a structure for a ring buffer. + * + * The circular buffer has two parts: + *((( + * full: [consume, supply) + * empty: [supply, consume) + *]]] + * + */ +typedef struct { + unsigned char *consume, /* where data comes out of */ + *supply, /* where data comes in to */ + *bottom, /* lowest address in buffer */ + *top, /* highest address+1 in buffer */ + *mark; /* marker (user defined) */ +#if defined(ENCRYPTION) + unsigned char *clearto; /* Data to this point is clear text */ + unsigned char *encryyptedto; /* Data is encrypted to here */ +#endif + int size; /* size in bytes of buffer */ + u_long consumetime, /* help us keep straight full, empty, etc. */ + supplytime; +} Ring; + +/* Here are some functions and macros to deal with the ring buffer */ + +/* Initialization routine */ +extern int + ring_init P((Ring *ring, unsigned char *buffer, int count)); + +/* Data movement routines */ +extern void + ring_supply_data P((Ring *ring, unsigned char *buffer, int count)); +#ifdef notdef +extern void + ring_consume_data P((Ring *ring, unsigned char *buffer, int count)); +#endif + +/* Buffer state transition routines */ +extern void + ring_supplied P((Ring *ring, int count)), + ring_consumed P((Ring *ring, int count)); + +/* Buffer state query routines */ +extern int + ring_empty_count P((Ring *ring)), + ring_empty_consecutive P((Ring *ring)), + ring_full_count P((Ring *ring)), + ring_full_consecutive P((Ring *ring)); + +#if defined(ENCRYPTION) +extern void + ring_encrypt P((Ring *ring, void (*func)())), + ring_clearto P((Ring *ring)); +#endif + +extern void + ring_clear_mark(), + ring_mark(); diff --git a/appl/telnet/telnet/telnet.0.ps b/appl/telnet/telnet/telnet.0.ps new file mode 100644 index 000000000..9edd0b321 --- /dev/null +++ b/appl/telnet/telnet/telnet.0.ps @@ -0,0 +1,1008 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.08 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Courier-Bold +%%+ font Courier-Oblique +%%+ font Courier +%%+ font Symbol +%%+ font Times-Italic +%%DocumentSuppliedResources: procset grops 1.08 0 +%%Pages: 10 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.08 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Courier-Bold +%%IncludeResource: font Courier-Oblique +%%IncludeResource: font Courier +%%IncludeResource: font Symbol +%%IncludeResource: font Times-Italic +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL +792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron +/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space +/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft +/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four +/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C +/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash +/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q +/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase +/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger +/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar +/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus +/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu +/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright +/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde +/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute +/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute +/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve +/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex +/udieresis/yacute/thorn/ydieresis]def/Times-Italic@0 ENC0/Times-Italic RE +/Courier@0 ENC0/Courier RE/Courier-Oblique@0 ENC0/Courier-Oblique RE +/Courier-Bold@0 ENC0/Courier-Bold RE/Times-Bold@0 ENC0/Times-Bold RE +/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R/F1 10/Times-Bold@0 SF -.2(NA)72 +108 S(ME).2 E/F2 10/Courier-Bold@0 SF(telnet)102 120 Q F0 2.52.5 G +(ser interf)153.64 120 Q(ace to the)-.1 E/F3 9/Times-Roman@0 SF(TELNET)2.5 E F0 +(protocol)2.5 E F1(SYNOPSIS)72 144 Q F2(telnet)102 156 Q F0([)3.333 E F2 +2.499 E F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 G F2-.834 E +F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 G F2-.834 E F0 3.333 +(][).833 G F2-.834 E/F4 10/Courier-Oblique@0 SF(tos)6 E F0 3.333(][).833 +G F2-.834 E F4(authtype)6 E F0 3.333(][).833 G F2-.834 E F0 3.333 +(][).833 G F2-.834 E F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 +G F2-.834 E F4(escapechar)144 168 Q F0 3.333(][).833 G F2-.834 E F0 +3.333(][).833 G F2-.834 E F4(realm)6 E F0 3.333(][).833 G F2-.834 E +F4(user)6 E F0 3.333(][).833 G F2-.834 E F4(tracefile)6 E F0 3.333(][) +.833 G F2-.834 E F0 3.333(][).833 G F2-.834 E F0 2.5(][).833 G F4 +(host)491.943 168 Q F0 .833([p)144.833 180 S -1.667(ort ]])-.833 F F1 +(DESCRIPTION)72 204 Q F0(The)102 216 Q F2(telnet)2.523 E F0 .023 +(command is used to communicate with another host using the)2.523 F F3(TELNET) +2.523 E F0 2.523(protocol. If)2.523 F F2(telnet)2.523 E F0(is)2.522 E(in)102 +228 Q -.2(vo)-.4 G -.1(ke).2 G 2.693(dw).1 G .193(ithout the)143.433 228 R F4 +(host)2.693 E F0(ar)2.693 E .194 +(gument, it enters command mode, indicated by its prompt)-.18 F(\()4.36 E F2 +(telnet>)1.666 E F0 -3.138 1.666(\). I)1.666 H 2.694(nt)-1.666 G(his)528.33 228 +Q 1.07(mode, it accepts and e)102 240 R -.15(xe)-.15 G 1.07 +(cutes the commands listed belo).15 F 4.87 -.65(w. I)-.25 H 3.57(fi).65 G 3.57 +(ti)361.18 240 S 3.57(si)370.31 240 S -1.9 -.4(nv o)380.55 240 T -.1(ke).4 G +3.57(dw).1 G 1.07(ith ar)420.08 240 R 1.07(guments, it performs an)-.18 F F2 +(open)102 252 Q F0(command with those ar)2.5 E(guments.)-.18 E(Options:)102 270 +Q F2103.666 288 Q F0 .352(Speci\214es an 8-bit data path.)143 288 R .353 +(This causes an attempt to ne)5.352 F .353(gotiate the)-.15 F/F5 10/Courier@0 +SF .353(TELNET BINARY)2.853 F F0 .353(option on)2.853 F(both input and output.) +143 300 Q F2103.666 318 Q F0(Stops an)143 318 Q 2.5(yc)-.15 G +(haracter from being recognized as an escape character)188.96 318 Q(.)-.55 E F2 +103.666 336 Q F0 .691(If K)143 336 R .691 +(erberos V5 authentication is being used, the)-.25 F F24.856 E F0 .69 +(option allo)3.19 F .69(ws the local credentials to be for)-.25 F(-)-.2 E -.1 +(wa)143 348 S .615(rded to the remote system, including an).1 F 3.116(yc)-.15 G +.616(redentials that ha)328.698 348 R .916 -.15(ve a)-.2 H .616 +(lready been forw).15 F .616(arded into the)-.1 F(local en)143 360 Q +(vironment.)-.4 E F2103.666 378 Q F0 +(Speci\214es no automatic login to the remote system.)143 378 Q F2103.666 +396 Q F0 .147(Speci\214es an 8-bit data path on output.)143 396 R .146 +(This causes the BIN)5.146 F(AR)-.35 E 2.646(Yo)-.65 G .146(ption to be ne) +409.42 396 R .146(gotiated on output.)-.15 F F2103.666 414 Q F4(tos)6 E +F0 .288(Sets the IP type-of-service \(T)143 426 R .288 +(OS\) option for the telnet connection to the v)-.18 F(alue)-.25 E F4(tos,) +2.788 E F0 .289(which can be)2.788 F 3.12(an)143 438 S .62(umeric T)155.56 438 +R .62(OS v)-.18 F .62(alue or)-.25 F 3.12(,o)-.4 G 3.12(ns)251.36 438 S .619 +(ystems that support it, a symbolic T)263.37 438 R .619 +(OS name found in the /etc/iptos)-.18 F(\214le.)143 450 Q F2103.666 468 Q +F4(atype)6 E F0(Disables the)143 480 Q F4(atype)2.5 E F0 +(type of authentication.)2.5 E F2103.666 498 Q F0 2.562 +(Attempt automatic login.)143 498 R(Currently)7.563 E 5.063(,t)-.65 G 2.563 +(his sends the user name via the)303.99 498 R F5(USER)5.063 E F0 -.25(va)5.063 +G 2.563(riable of the).25 F F5(ENVIRON)143 510 Q F0 .444 +(option if supported by the remote system.)2.945 F .444 +(The name used is that of the current user as)5.444 F .168(returned by)143 522 +R F5(getlogin)2.668 E F0 .168(\(2\) if it agrees with the current user ID, oth\ +erwise it is the name associated)B(with the user ID.)143 534 Q F2103.666 +552 Q F0 .022(Disables the reading of the user')143 552 R(s)-.55 E F5 +(.telnetrc)2.522 E F0 2.522(\214le. \(See)2.522 F(the)2.522 E F2 .022 +(toggle skiprc)2.522 F F0 .022(command on this)2.522 F(man page.\))143 564 Q F2 +103.666 582 Q F0(Sets the initial v)143 582 Q(alue of the)-.25 E F2 +(debug)2.5 E F0(toggle to)2.5 E F5(TRUE)2.5 E F2103.666 600 Q F4 +(escape char)6 E F0 1.759(Sets the initial)143 612 R F2 -1.741(telnet telnet) +4.259 F F0 1.759(escape character to)4.259 F F4 1.759(escape char.)4.259 F F0 +(If)4.259 E F4 1.76(escape char)4.26 F F0(is)4.26 E +(omitted, then there will be no escape character)143 624 Q(.)-.55 E F2 +103.666 642 Q F0 .691(If K)143 642 R .691 +(erberos V5 authentication is being used, the)-.25 F F24.856 E F0 .69 +(option allo)3.19 F .69(ws the local credentials to be for)-.25 F(-)-.2 E -.1 +(wa)143 654 S(rded to the remote system.).1 E F2103.666 672 Q F4(realm)6 +E F0 .008(If K)143 684 R .008(erberos authentication is being used, the)-.25 F +F24.174 E F0 .009(option requests that telnet obtain tick)2.508 F .009 +(ets for the re-)-.1 F 6.61 +(mote host in realm realm instead of the remote host')143 696 R 9.11(sr)-.55 G +6.61(ealm, as determined by)427.41 696 R(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD) +-.15 G(istrib)132.57 750 Q 95.71(ution February)-.2 F(3, 1994)2.5 E(1)535 750 Q +EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R/F1 10/Courier@0 SF +(krb_realmofhost)143 96 Q F0(\(3\).)A/F2 10/Courier-Bold@0 SF103.666 114 +Q/F3 10/Courier-Oblique@0 SF(user)6 E F0 1.135 +(When connecting to the remote system, if the remote system understands the)143 +126 R F1(ENVIRON)3.636 E F0(option,)3.636 E(then)143 138 Q F3(user)2.974 E F0 +.474(will be sent to the remote system as the v)2.974 F .474(alue for the v) +-.25 F .474(ariable USER.)-.25 F .473(This option im-)5.474 F(plies the)143 150 +Q F24.166 E F0 2.5(option. This)2.5 F(option may also be used with the) +2.5 E F2(open)2.5 E F0(command.)2.5 E F2103.666 168 Q F3(tracefile)6 E F0 +(Opens)143 180 Q F3(tracefile)2.561 E F0 .062(for recording trace information.) +2.561 F .062(See the)5.062 F F2 .062(set tracefile)2.562 F F0 .062 +(command belo)2.562 F -.65(w.)-.25 G F2103.666 198 Q F0 .936 +(Speci\214es a user interf)143 198 R .936(ace similar to)-.1 F F1(rlogin)3.435 +E F0 4.37(\(1\). In)B .935(this mode, the escape character is set to the)3.435 +F(tilde \(~\) character)143 210 Q 2.5(,u)-.4 G +(nless modi\214ed by the -e option.)222.01 210 Q F2103.666 228 Q F0 -.45 +(Tu)143 228 S .123(rns on encryption of the data stream if possible.).45 F .124 +(This option is not a)5.124 F -.25(va)-.2 G .124(ilable outside of the Unit-) +.25 F(ed States and Canada.)143 240 Q F3(host)102 258 Q F0(Indicates the of)143 +258 Q(\214cial name, an alias, or the Internet address of a remote host.)-.25 E +F3(port)102 276 Q F0 1.96 +(Indicates a port number \(address of an application\).)143 276 R 1.96 +(If a number is not speci\214ed, the def)6.96 F(ault)-.1 E F2(telnet)143 288 Q +F0(port is used.)2.5 E .237(When in rlogin mode, a line of the form ~.)102 306 +R .238(disconnects from the remote host; ~ is the telnet escape character)5.237 +F(.)-.55 E(Similarly)102 318 Q 2.5(,t)-.65 G +(he line ~^Z suspends the telnet session.)146.36 318 Q +(The line ~^] escapes to the normal telnet escape prompt.)5 E 1.008 +(Once a connection has been opened,)102 336 R F2(telnet)3.507 E F0 1.007 +(will attempt to enable the)3.507 F F1 1.007(TELNET LINEMODE)3.507 F F0 3.507 +(option. If)3.507 F .73(this f)102 348 R .73(ails, then)-.1 F F2(telnet)3.23 E +F0 .73(will re)3.23 F -.15(ve)-.25 G .73(rt to one of tw).15 F 3.23(oi)-.1 G +.731(nput modes: either `)308.3 348 R .731(`character at a time')-.74 F 3.231 +('o)-.74 G 3.231(r`)483.277 348 S .731(`old line by)492.428 348 R(line')102 360 +Q 2.5('d)-.74 G(epending on what the remote system supports.)130.42 360 Q(When) +102 378 Q F1(LINEMODE)3.143 E F0 .642(is enabled, character processing is done\ + on the local system, under the control of the re-)3.143 F .123(mote system.) +102 390 R .123(When input editing or character echoing is to be disabled, the \ +remote system will relay that in-)5.123 F 3.397(formation. The)102 402 R .897 +(remote system will also relay changes to an)3.397 F 3.397(ys)-.15 G .897 +(pecial characters that happen on the remote)361.34 402 R(system, so that the) +102 414 Q 2.5(yc)-.15 G(an tak)187.68 414 Q 2.5(ee)-.1 G -.25(ff)223.12 414 S +(ect on the local system.).25 E(In `)102 432 Q(`character at a time')-.74 E 2.5 +('m)-.74 G(ode, most te)208.53 432 Q +(xt typed is immediately sent to the remote host for processing.)-.15 E .323 +(In `)102 450 R .323(`old line by line')-.74 F 2.823('m)-.74 G .323 +(ode, all te)196.845 450 R .323(xt is echoed locally)-.15 F 2.823(,a)-.65 G +.323(nd \(normally\) only completed lines are sent to the re-)324.073 450 R +.757(mote host.)102 462 R .757(The `)5.757 F .757(`local echo character')-.74 F +3.257('\()-.74 G .756(initially `)268.892 462 R(`^E')-.74 E .756 +('\) may be used to turn of)-.74 F 3.256(fa)-.25 G .756 +(nd on the local echo \(this)435.4 462 R -.1(wo)102 474 S +(uld mostly be used to enter passw).1 E(ords without the passw)-.1 E +(ord being echoed\).)-.1 E 1.076(If the)102 492 R F1(LINEMODE)3.576 E F0 1.076 +(option is enabled, or if the)3.576 F F2(localchars)3.577 E F0 1.077(toggle is) +3.577 F F1(TRUE)3.577 E F0 1.077(\(the def)3.577 F 1.077(ault for `)-.1 F 1.077 +(`old line by)-.74 F(line`)102 504 Q .866(`; see belo)-.74 F .866 +(w\), the user')-.25 F(s)-.55 E F2(quit)3.366 E F0(,)A F2(intr)3.366 E F0 3.366 +(,a)C(nd)285.042 504 Q F2(flush)3.365 E F0 .865(characters are trapped locally) +3.365 F 3.365(,a)-.65 G .865(nd sent as)461.472 504 R/F4 9/Times-Roman@0 SF +(TELNET)3.365 E F0 .368(protocol sequences to the remote side.)102 516 R(If) +5.368 E F1(LINEMODE)2.868 E F0 .368(has e)2.868 F -.15(ve)-.25 G 2.868(rb).15 G +.368(een enabled, then the user')363.23 516 R(s)-.55 E F2(susp)2.869 E F0(and) +2.869 E F2(eof)2.869 E F0 1.308(are also sent as)102 528 R F4(TELNET)3.808 E F0 +1.308(protocol sequences, and)3.808 F F2(quit)3.808 E F0 1.307(is sent as a) +3.807 F F1 1.307(TELNET ABORT)3.807 F F0 1.307(instead of)3.807 F F1(BREAK) +3.807 E F0 .474(There are options \(see)102 540 R F2 -3.026(toggle autoflush) +2.974 F F0(and)2.974 E F2 -3.026(toggle autosynch)2.974 F F0(belo)2.974 E .475 +(w\) which cause this action to)-.25 F .194 +(\215ush subsequent output to the terminal \(until the remote host ackno)102 +552 R .194(wledges the)-.25 F F4(TELNET)2.694 E F0 .193(sequence\) and \215ush) +2.693 F(pre)102 564 Q(vious terminal input \(in the case of)-.25 E F2(quit)2.5 +E F0(and)2.5 E F2(intr)2.5 E F0(\).)A .235(While connected to a remote host,) +102 582 R F2(telnet)2.735 E F0 .235(command mode may be entered by typing the) +2.735 F F2(telnet)2.735 E F0 -.74(``)2.735 G(escape).74 E(character')102 594 Q +2.5('\()-.74 G(initially `)150.39 594 Q(`^]')-.74 E 2.5('\). When)-.74 F +(in command mode, the normal terminal editing con)2.5 E -.15(ve)-.4 G +(ntions are a).15 E -.25(va)-.2 G(ilable.).25 E .018(The follo)102 612 R(wing) +-.25 E F2(telnet)2.518 E F0 .018(commands are a)2.518 F -.25(va)-.2 G 2.517 +(ilable. Only).25 F .017(enough of each command to uniquely identify it need) +2.517 F 2.478(be typed \(this is also true for ar)102 624 R 2.478 +(guments to the)-.18 F F2(mode)4.978 E F0(,)A F2(set)4.978 E F0(,)A F2(toggle) +4.978 E F0(,)A F2(unset)4.978 E F0(,)A F2(slc)4.978 E F0(,)A F2(environ)4.979 E +F0 4.979(,a)C(nd)530 624 Q F2(display)102 636 Q F0(commands\).)2.5 E F2(auth) +102 654 Q F3(argument ...)6 E F0 .308 +(The auth command manipulates the information sent through the)161 666 R F1 +.308(TELNET AUTHENTICATE)2.808 F F0 2.5(option. V)161 678 R(alid ar)-1.11 E +(guments for the auth command are as follo)-.18 E(ws:)-.25 E(4.2 Berk)72 750 Q +(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71(ution February)-.2 F +(3, 1994)2.5 E(2)535 750 Q EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R/F1 10/Courier-Bold@0 SF(disable) +161 96 Q/F2 10/Courier-Oblique@0 SF(type)6.76 E F0 .76 +(Disables the speci\214ed type of authentication.)5 F 2.36 -.8(To o)5.76 H .76 +(btain a list of a).8 F -.25(va)-.2 G(ilable).25 E(types, use the)238 108 Q F1 +(auth disable ?)2.5 E F0(command.)2.5 E F1(enable)161 126 Q F2(type)6.992 E F0 +.992(Enables the speci\214ed type of authentication.)238.992 126 R 2.592 -.8 +(To o)5.992 H .991(btain a list of a).8 F -.25(va)-.2 G(ilable).25 E +(types, use the)238 138 Q F1(auth enable ?)2.5 E F0(command.)2.5 E F1(status) +161 156 Q F0(Lists the current status of the v)238 156 Q +(arious types of authentication.)-.25 E F1(close)102 174 Q F0(Close a)161 174 Q +/F3 9/Times-Roman@0 SF(TELNET)2.5 E F0(session and return to command mode.)2.5 +E F1(display)102 192 Q F2(argument ...)6 E F0(Displays all, or some, of the)161 +204 Q F1(set)2.5 E F0(and)2.5 E F1(toggle)2.5 E F0 -.25(va)2.5 G +(lues \(see belo).25 E(w\).)-.25 E F1(encrypt)102 222 Q F2(argument ...)6 E F0 +.407(The encrypt command manipulates the information sent through the)161 234 R +/F4 10/Courier@0 SF .408(TELNET ENCRYPT)2.908 F F0(op-)2.908 E(tion.)161 246 Q +2.856(Note: Because)161 264 R .356(of e)2.856 F .356(xport controls, the)-.15 F +F4 .355(TELNET ENCRYPT)2.855 F F0 .355(option is not supported outside of)2.855 +F(the United States and Canada.)161 276 Q -1.11(Va)161 294 S(lid ar)1.11 E +(guments for the encrypt command are as follo)-.18 E(ws:)-.25 E F1(disable)161 +312 Q F2(type)6 E F1([input|output])6 E F0 1.099 +(Disables the speci\214ed type of encryption.)226 324 R 1.099 +(If you omit the input and output,)6.099 F .357 +(both input and output are disabled.)226 336 R 1.957 -.8(To o)5.357 H .357 +(btain a list of a).8 F -.25(va)-.2 G .357(ilable types, use the).25 F F1 +(encrypt disable ?)226 348 Q F0(command.)2.5 E F1(enable)161 366 Q F2(type)6 E +F1([input|output])6 E F0 .867(Enables the speci\214ed type of encryption.)226 +378 R .868(If you omit input and output, both)5.867 F 2.117 +(input and output are enabled.)226 390 R 3.716 -.8(To o)7.116 H 2.116 +(btain a list of a).8 F -.25(va)-.2 G 2.116(ilable types, use the).25 F F1 +(encrypt enable ?)226 402 Q F0(command.)2.5 E F1(input)161 420 Q F0 +(This is the same as the)226 420 Q F1(encrypt start input)2.5 E F0(command.)2.5 +E F1(-input)161 438 Q F0(This is the same as the)226 438 Q F1 +(encrypt stop input)2.5 E F0(command.)2.5 E F1(output)161 456 Q F0 +(This is the same as the)226 456 Q F1(encrypt start output)2.5 E F0(command.) +2.5 E F1(-output)161 474 Q F0(This is the same as the)226 474 Q F1 +(encrypt stop output)2.5 E F0(command.)2.5 E F1(start [input|output])161 492 Q +F0 1.116(Attempts to start encryption.)226 504 R 1.116(If you omit)6.116 F F1 +(input)3.616 E F0(and)3.617 E F1(output,)3.617 E F0 1.117(both input)3.617 F +.467(and output are enabled.)226 516 R 2.067 -.8(To o)5.467 H .467 +(btain a list of a).8 F -.25(va)-.2 G .467(ilable types, use the).25 F F1 +(encrypt)2.966 E(enable ?)226 528 Q F0(command.)2.5 E F1(status)161 546 Q F0 +(Lists the current status of encryption.)226 546 Q F1(stop [input|output])161 +564 Q F0 1.096(Stops encryption.)226 576 R 1.097 +(If you omit input and output, encryption is on both input)6.096 F(and output.) +226 588 Q F1(type)161 606 Q F2(type)6.121 E F0 .121(Sets the def)226.121 606 R +.121(ault type of encryption to be used with later)-.1 F F1 .12(encrypt start) +2.62 F F0(or)2.62 E F1(encrypt stop)226 618 Q F0(commands.)2.5 E F1(environ)102 +636 Q F2(arguments...)6 E F0(The)161 648 Q F1(environ)3.189 E F0 .689 +(command is used to manipulate the the v)3.189 F .69 +(ariables that my be sent through the)-.25 F F4 .552(TELNET ENVIRON)161 660 R +F0 3.052(option. The)3.052 F .552(initial set of v)3.052 F .551 +(ariables is tak)-.25 F .551(en from the users en)-.1 F(vironment,)-.4 E .501 +(with only the)161 672 R F4(DISPLAY)3.001 E F0(and)3.001 E F4(PRINTER)3.001 E +F0 -.25(va)3.001 G .502(riables being e).25 F .502(xported by def)-.15 F 3.002 +(ault. The)-.1 F F4(USER)3.002 E F0 -.25(va)3.002 G(ri-).25 E(able is also e) +161 684 Q(xported if the)-.15 E F14.166 E F0(or)2.5 E F14.166 E F0 +(options are used.)2.5 E(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib) +132.57 750 Q 95.71(ution February)-.2 F(3, 1994)2.5 E(3)535 750 Q EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R -1.11(Va)161 96 S(lid ar)1.11 E +(guments for the)-.18 E/F1 10/Courier-Bold@0 SF(environ)2.5 E F0(command are:) +2.5 E F1(define)161 114 Q/F2 10/Courier-Oblique@0 SF(variable value)6 E F0 +1.082(De\214ne the v)216 126 R(ariable)-.25 E F2(variable)3.582 E F0 1.082 +(to ha)3.582 F 1.382 -.15(ve a v)-.2 H 1.082(alue of)-.1 F F2(value.)3.581 E F0 +(An)3.581 E 3.581(yv)-.15 G 1.081(ariables de-)492.549 126 R 1.922 +(\214ned by this command are automatically e)216 138 R 4.422(xported. The)-.15 +F F2(value)4.422 E F0 1.922(may be en-)4.422 F +(closed in single or double quotes so that tabs and spaces may be included.)216 +150 Q F1(undefine)161 168 Q F2(variable)6 E F0(Remo)216 180 Q -.15(ve)-.15 G F2 +(variable)2.65 E F0(from the list of en)2.5 E(vironment v)-.4 E(ariables.)-.25 +E F1(export)161 198 Q F2(variable)6 E F0(Mark the v)216 210 Q(ariable)-.25 E F2 +(variable)2.5 E F0(to be e)2.5 E(xported to the remote side.)-.15 E F1 +(unexport)161 228 Q F2(variable)6 E F0 .697(Mark the v)216 240 R(ariable)-.25 E +F2(variable)3.197 E F0 .697(to not be e)3.197 F .697(xported unless e)-.15 F +.696(xplicitly ask)-.15 F .696(ed for by)-.1 F(the remote side.)216 252 Q F1 +(list)161 270 Q F0 1.416(List the current set of en)216 270 R 1.416 +(vironment v)-.4 F 3.916(ariables. Those)-.25 F(mark)3.916 E 1.416(ed with a) +-.1 F/F3 10/Symbol SF(*)3.916 E F0 1.417(will be)3.917 F(sent automatically)216 +282 Q 2.5(,o)-.65 G(ther v)298.4 282 Q(ariables will only be sent if e)-.25 E +(xplicitly requested.)-.15 E F1(?)161 300 Q F0 +(Prints out help information for the)216 300 Q F1(environ)2.5 E F0(command.)2.5 +E F1(logout)102 318 Q F0 .104(Sends the)161 318 R/F4 10/Courier@0 SF .104 +(TELNET LOGOUT)2.604 F F0 .104(option to the remote side.)2.604 F .104 +(This command is similar to a)5.104 F F1(close)2.604 E F0 .228(command; ho)161 +330 R(we)-.25 E -.15(ve)-.25 G 1.028 -.4(r, i).15 H 2.728(ft).4 G .228 +(he remote side does not support the)256.174 330 R F4(LOGOUT)2.729 E F0 .229 +(option, nothing happens.)2.729 F .233(If, ho)161 342 R(we)-.25 E -.15(ve)-.25 +G 1.033 -.4(r, t).15 H .233(he remote side does support the).4 F F4(LOGOUT) +2.733 E F0 .233(option, this command should cause the)2.733 F .652 +(remote side to close the)161 354 R/F5 9/Times-Roman@0 SF(TELNET)3.152 E F0 +3.152(connection. If)3.152 F .653(the remote side also supports the concept of) +3.152 F 1.904(suspending a user')161 366 R 4.404(ss)-.55 G 1.903 +(ession for later reattachment, the logout ar)250.872 366 R 1.903 +(gument indicates that you)-.18 F(should terminate the session immediately)161 +378 Q(.)-.65 E F1(mode)102 396 Q F2 -1(type Type)6.889 F F0 .889(is one of se) +3.389 F -.15(ve)-.25 G .889(ral options, depending on the state of the).15 F F5 +(TELNET)3.389 E F0 3.39(session. The)3.39 F(remote)3.39 E .882(host is ask)161 +408 R .881(ed for permission to go into the requested mode.)-.1 F .881 +(If the remote host is capable of)5.881 F +(entering that mode, the requested mode will be entered.)161 420 Q F1 +(character)161 438 Q F0 .715(Disable the)226 438 R F4 .716(TELNET LINEMODE) +3.215 F F0 .716(option, or)3.216 F 3.216(,i)-.4 G 3.216(ft)416.834 438 S .716 +(he remote side does not un-)426.16 438 R(derstand the)226 450 Q F4(LINEMODE) +2.5 E F0(option, then enter `)2.5 E(`character at a time`)-.74 E 2.5(`m)-.74 G +(ode.)496.07 450 Q F1(line)161 468 Q F0 .948(Enable the)226 468 R F4 .948 +(TELNET LINEMODE)3.448 F F0 .948(option, or)3.448 F 3.448(,i)-.4 G 3.447(ft) +415.448 468 S .947(he remote side does not un-)425.005 468 R 2.78(derstand the) +226 480 R F4(LINEMODE)5.28 E F0 2.78(option, then attempt to enter `)5.28 F +(`old-line-by-line`)-.74 E(`)-.74 E(mode.)226 492 Q F1(isig)161 510 Q F0(\() +7.666 E F1(\255isig)1.666 E F0(\))1.666 E 1.43 +(Attempt to enable \(disable\) the)226 522 R F4(TRAPSIG)3.93 E F0 1.43 +(mode of the)3.93 F F4(LINEMODE)3.93 E F0(option.)3.93 E +(This requires that the)226 534 Q F4(LINEMODE)2.5 E F0(option be enabled.)2.5 E +F1(edit)161 552 Q F0(\()7.666 E F1(\255edit)1.666 E F0(\))1.666 E .865 +(Attempt to enable \(disable\) the)226 564 R F4(EDIT)3.365 E F0 .866 +(mode of the)3.365 F F4(LINEMODE)3.366 E F0 3.366(option. This)3.366 F +(requires that the)226 576 Q F4(LINEMODE)2.5 E F0(option be enabled.)2.5 E F1 +(softtabs)161 594 Q F0(\()7.666 E F1(\255softtabs)1.666 E F0(\))1.666 E .83 +(Attempt to enable \(disable\) the)226 606 R F4(SOFT_TAB)3.33 E F0 .83 +(mode of the)3.33 F F4(LINEMODE)3.33 E F0(option.)3.33 E +(This requires that the)226 618 Q F4(LINEMODE)2.5 E F0(option be enabled.)2.5 E +F1(litecho)161 636 Q F0(\()7.666 E F1(\255litecho)1.666 E F0(\))1.666 E .83 +(Attempt to enable \(disable\) the)226 648 R F4(LIT_ECHO)3.33 E F0 .83 +(mode of the)3.33 F F4(LINEMODE)3.33 E F0(option.)3.33 E +(This requires that the)226 660 Q F4(LINEMODE)2.5 E F0(option be enabled.)2.5 E +F1(?)161 678 Q F0(Prints out help information for the)226 678 Q F1(mode)2.5 E +F0(command.)2.5 E(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q +95.71(ution February)-.2 F(3, 1994)2.5 E(4)535 750 Q EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R/F1 10/Courier-Bold@0 SF(open)102 +102 Q/F2 10/Courier-Oblique@0 SF(host)6 E F0 .833([[)2.5 G F11.666 E F0 +(]).833 E F2(user)6 E F0(][)A F11.666 E F2(port)A F0(])A .207 +(Open a connection to the named host.)161 114 R .207 +(If no port number is speci\214ed,)5.207 F F1(telnet)2.707 E F0 .206 +(will attempt to)2.707 F .263(contact a)161 126 R/F3 9/Times-Roman@0 SF(TELNET) +2.763 E F0(serv)2.763 E .263(er at the def)-.15 F .263(ault port.)-.1 F .264 +(The host speci\214cation may be either a host name)5.264 F(\(see)161 138 Q/F4 +10/Courier@0 SF(hosts)3.531 E F0 4.562(\(5\)\) or)B 1.031 +(an Internet address speci\214ed in the `)3.531 F 1.03(`dot notation')-.74 F +3.53('\()-.74 G(see)459.6 138 Q F4(inet)3.53 E F0 4.56(\(3\)\). The)B([)161.833 +150 Q F12.499 E F0 3.03(]o).833 G .531(ption may be used to specify the \ +user name to be passed to the remote system via the)191.855 150 R F4(ENVIRON) +161 162 Q F0 3.971(option. When)3.971 F 1.471 +(connecting to a non-standard port,)3.971 F F1(telnet)3.971 E F0 1.471 +(omits an)3.971 F 3.97(ya)-.15 G(utomatic)505 162 Q .631(initiation of)161 174 +R F3(TELNET)3.131 E F0 3.131(options. When)3.131 F .631 +(the port number is preceded by a minus sign, the initial)3.131 F .441 +(option ne)161 186 R .441(gotiation is done.)-.15 F .441 +(After establishing a connection, the \214le)5.441 F F4(.telnetrc)2.941 E F0 +.44(in the users)2.94 F .928(home directory is opened.)161 198 R .928(Lines be) +5.928 F .928(ginning with a # are comment lines.)-.15 F .928 +(Blank lines are ig-)5.928 F 3.255(nored. Lines)161 210 R .755(that be)3.255 F +.755(gin without white space are the start of a machine entry)-.15 F 5.755(.T) +-.65 G .755(he \214rst thing)487.93 210 R .022 +(on the line is the name of the machine that is being connected to.)161 222 R +.023(The rest of the line, and suc-)5.023 F(cessi)161 234 Q .856 -.15(ve l)-.25 +H .556(ines that be).15 F .556(gin with white space are assumed to be)-.15 F F1 +(telnet)3.056 E F0 .556(commands and are pro-)3.056 F(cessed as if the)161 246 +Q 2.5(yh)-.15 G(ad been typed in manually to the)233.61 246 Q F1(telnet)2.5 E +F0(command prompt.)2.5 E F1(quit)102 264 Q F0 .114(Close an)161 264 R 2.614(yo) +-.15 G(pen)208.298 264 Q F3(TELNET)2.614 E F0 .115(session and e)2.615 F(xit) +-.15 E F1(telnet)2.615 E F0 2.615(.A)C 2.615(ne)376.32 264 S .115 +(nd of \214le \(in command mode\) will al-)388.375 264 R +(so close a session and e)161 276 Q(xit.)-.15 E F1(send)102 294 Q F2(arguments) +6 E F0 .024(Sends one or more special character sequences to the remote host.) +161 306 R .024(The follo)5.024 F .024(wing are the ar)-.25 F(gu-)-.18 E +(ments which may be speci\214ed \(more than one ar)161 318 Q +(gument may be speci\214ed at a time\):)-.18 E F1(abort)161 336 Q F0(Sends the) +202 336 Q F4(TELNET ABORT)2.5 E F0(\(Abort processes\) sequence.)2.5 E F1(ao) +161 354 Q F0 1.15(Sends the)202 354 R F4 1.151(TELNET AO)3.651 F F0 1.151 +(\(Abort Output\) sequence, which should cause the remote)3.651 F +(system to \215ush all output)202 366 Q/F5 10/Times-Italic@0 SF(fr)2.5 E(om) +-.45 E F0(the remote system)2.5 E F5(to)2.5 E F0(the user')2.5 E 2.5(st)-.55 G +(erminal.)454.89 366 Q F1(ayt)161 384 Q F0 1.18(Sends the)202 384 R F4 1.18 +(TELNET AYT)3.68 F F0 1.18(\(Are Y)3.68 F 1.18 +(ou There\) sequence, to which the remote system)-1.1 F +(may or may not choose to respond.)202 396 Q F1(brk)161 414 Q F0 .47(Sends the) +202 414 R F4 .47(TELNET BRK)2.97 F F0 .47(\(Break\) sequence, which may ha)2.97 +F .77 -.15(ve s)-.2 H .47(igni\214cance to the re-).15 F(mote system.)202 426 Q +F1(ec)161 444 Q F0 .245(Sends the)202 444 R F4 .245(TELNET EC)2.745 F F0 .244 +(\(Erase Character\) sequence, which should cause the remote)2.745 F +(system to erase the last character entered.)202 456 Q F1(el)161 474 Q F0 .385 +(Sends the)202 474 R F4 .385(TELNET EL)2.885 F F0 .385 +(\(Erase Line\) sequence, which should cause the remote sys-)2.885 F +(tem to erase the line currently being entered.)202 486 Q F1(eof)161 504 Q F0 +(Sends the)202 504 Q F4(TELNET EOF)2.5 E F0(\(End Of File\) sequence.)2.5 E F1 +(eor)161 522 Q F0(Sends the)202 522 Q F4(TELNET EOR)2.5 E F0 +(\(End of Record\) sequence.)2.5 E F1(escape)161 540 Q F0(Sends the current)5 E +F1(telnet)2.5 E F0(escape character \(initially `)2.5 E(`^')-.74 E('\).)-.74 E +F1(ga)161 558 Q F0 .855(Sends the)202 558 R F4 .855(TELNET GA)3.355 F F0 .855 +(\(Go Ahead\) sequence, which lik)3.355 F .855(ely has no signi\214cance to)-.1 +F(the remote system.)202 570 Q F1(getstatus)161 588 Q F0 1.713 +(If the remote side supports the)202 600 R F4 1.713(TELNET STATUS)4.213 F F0 +(command,)4.213 E F1(getstatus)4.213 E F0(will)4.213 E(send the subne)202 612 Q +(gotiation to request that the serv)-.15 E(er send its current option status.) +-.15 E F1(ip)161 630 Q F0 1.355(Sends the)202 630 R F4 1.355(TELNET IP)3.855 F +F0 1.354(\(Interrupt Process\) sequence, which should cause the re-)3.855 F +(mote system to abort the currently running process.)202 642 Q F1(nop)161 660 Q +F0(Sends the)202 660 Q F4(TELNET NOP)2.5 E F0(\(No OPeration\) sequence.)2.5 E +F1(susp)161 678 Q F0(Sends the)202 678 Q F4(TELNET SUSP)2.5 E F0 +(\(SUSPend process\) sequence.)2.5 E(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G +(istrib)132.57 750 Q 95.71(ution February)-.2 F(3, 1994)2.5 E(5)535 750 Q EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R/F1 10/Courier-Bold@0 SF(synch) +161 96 Q F0 .65(Sends the)202 96 R/F2 10/Courier@0 SF .651(TELNET SYNCH)3.151 F +F0 3.151(sequence. This)3.151 F .651(sequence causes the remote system to)3.151 +F .777(discard all pre)202 108 R .777(viously typed \(b)-.25 F .777 +(ut not yet read\) input.)-.2 F .776(This sequence is sent as)5.777 F/F3 9 +/Times-Roman@0 SF(TCP)3.276 E F0(ur)202 120 Q 1.665(gent data \(and may not w) +-.18 F 1.665(ork if the remote system is a 4.2)-.1 F F3(BSD)A F0 1.666 +(system -- if it)4.166 F(doesn')202 132 Q 2.5(tw)-.18 G(ork, a lo)240.88 132 Q +(wer case `)-.25 E(`r')-.74 E 2.5('m)-.74 G(ay be echoed on the terminal\).) +336.33 132 Q F1(do)161 150 Q/F4 10/Courier-Oblique@0 SF(cmd)6 E F1(dont)161 168 +Q F4(cmd)6 E F1(will)161 186 Q F4(cmd)6 E F1(wont)161 204 Q F4(cmd)6 E F0 1.134 +(Sends the)202 216 R F2 1.133(TELNET DO)3.633 F F4(cmd)3.633 E F0(sequence.) +3.633 E F4(Cmd)6.133 E F0 1.133(can be either a decimal number be-)3.633 F .865 +(tween 0 and 255, or a symbolic name for a speci\214c)202 228 R F2(TELNET)3.365 +E F0(command.)3.365 E F4(Cmd)5.865 E F0(can)3.365 E 1.181(also be either)202 +240 R F1(help)3.681 E F0(or)3.681 E F1(?)3.681 E F0 1.18 +(to print out help information, including a list of kno)3.681 F(wn)-.25 E +(symbolic names.)202 252 Q F1(?)161 270 Q F0 +(Prints out help information for the)202 270 Q F1(send)2.5 E F0(command.)2.5 E +F1(set)102 288 Q F4(argument value)6 E F1(unset)102 306 Q F4(argument value)6 E +F0(The)161 318 Q F1(set)2.601 E F0 .101(command will set an)2.601 F 2.601(yo) +-.15 G .101(ne of a number of)295.556 318 R F1(telnet)2.601 E F0 -.25(va)2.601 +G .101(riables to a speci\214c v).25 F .102(alue or to)-.25 F F2(TRUE)161 330 Q +F0 2.722(.T)C .222(he special v)196.332 330 R(alue)-.25 E F1(off)2.722 E F0 +.222(turns of)2.722 F 2.722(ft)-.25 G .222(he function associated with the v) +323.474 330 R .222(ariable, this is equi)-.25 F(v-)-.25 E .37 +(alent to using the)161 342 R F1(unset)2.87 E F0 2.871(command. The)2.87 F F1 +(unset)2.871 E F0 .371(command will disable or set to)2.871 F F2(FALSE)2.871 E +F0(an)2.871 E(y)-.15 E 1.248(of the speci\214ed functions.)161 354 R 1.248 +(The v)6.248 F 1.248(alues of v)-.25 F 1.248(ariables may be interrog)-.25 F +1.247(ated with the)-.05 F F1(display)3.747 E F0 2.886(command. The)161 366 R +-.25(va)2.886 G .386(riables which may be set or unset, b).25 F .386 +(ut not toggled, are listed here.)-.2 F .387(In addi-)5.387 F .763(tion, an)161 +378 R 3.263(yo)-.15 G 3.263(ft)204.876 378 S .763(he v)214.249 378 R .763 +(ariables for the)-.25 F F1(toggle)3.263 E F0 .762(command may be e)3.263 F +.762(xplicitly set or unset using the)-.15 F F1(set)161 390 Q F0(and)2.5 E F1 +(unset)2.5 E F0(commands.)2.5 E F1(ayt)161 408 Q F0(If)202 408 Q F3(TELNET) +2.689 E F0 .189(is in localchars mode, or)2.689 F F2(LINEMODE)2.689 E F0 .189 +(is enabled, and the status character)2.689 F 1.056(is typed, a)202 420 R F2 +1.056(TELNET AYT)3.556 F F0 1.056(sequence \(see)3.556 F F1 1.056(send ayt) +3.556 F F0 1.055(preceding\) is sent to the re-)3.556 F .327(mote host.)202 432 +R .328(The initial v)5.327 F .328(alue for the "Are Y)-.25 F .328 +(ou There" character is the terminal')-1.1 F 2.828(ss)-.55 G(ta-)529.45 432 Q +(tus character)202 444 Q(.)-.55 E F1(echo)161 462 Q F0 .805(This is the v)202 +462 R .805(alue \(initially `)-.25 F(`^E')-.74 E .804('\) which, when in `)-.74 +F .804(`line by line')-.74 F 3.304('m)-.74 G .804(ode, toggles be-)474.792 462 +R .988(tween doing local echoing of entered characters \(for normal processing\ +\), and sup-)202 474 R +(pressing echoing of entered characters \(for entering, say)202 486 Q 2.5(,ap) +-.65 G(assw)442.66 486 Q(ord\).)-.1 E F1(eof)161 504 Q F0(If)202 504 Q F1 +(telnet)3.864 E F0 1.364(is operating in)3.864 F F2(LINEMODE)3.864 E F0 1.364 +(or `)3.864 F 1.364(`old line by line')-.74 F 3.864('m)-.74 G 1.363 +(ode, entering this)468.114 504 R .199(character as the \214rst character on a\ + line will cause this character to be sent to the re-)202 516 R .12 +(mote system.)202 528 R .12(The initial v)5.12 F .119 +(alue of the eof character is tak)-.25 F .119(en to be the terminal')-.1 F(s) +-.55 E F1(eof)2.619 E F0(character)202 540 Q(.)-.55 E F1(erase)161 558 Q F0(If) +202 558 Q F1(telnet)3.12 E F0 .62(is in)3.12 F F1(localchars)3.12 E F0 .62 +(mode \(see)3.12 F F1 -2.88(toggle localchars)3.12 F F0(belo)3.12 E(w\),)-.25 E +/F5 10/Times-Bold@0 SF(and)3.12 E F0(if)3.12 E F1(telnet)202 570 Q F0 1.385 +(is operating in `)3.885 F 1.385(`character at a time')-.74 F 3.885('m)-.74 G +1.384(ode, then when this character is)407 570 R .417(typed, a)202 582 R F2 +.418(TELNET EC)2.917 F F0 .418(sequence \(see)2.918 F F1 -3.082(send ec)2.918 F +F0(abo)2.918 E -.15(ve)-.15 G 2.918(\)i).15 G 2.918(ss)427.36 582 S .418 +(ent to the remote system.)438.058 582 R .325(The initial v)202 594 R .325 +(alue for the erase character is tak)-.25 F .325(en to be the terminal')-.1 F +(s)-.55 E F1(erase)2.825 E F0(charac-)2.825 E(ter)202 606 Q(.)-.55 E F1(escape) +161 624 Q F0 2.873(This is the)5 F F1(telnet)5.373 E F0 2.874 +(escape character \(initially `)5.373 F(`^[')-.74 E 2.874 +('\) which causes entry into)-.74 F F1(telnet)202 636 Q F0 +(command mode \(when connected to a remote system\).)2.5 E F1(flushoutput)161 +654 Q F0(If)202 666 Q F1(telnet)2.945 E F0 .445(is in)2.945 F F1(localchars) +2.945 E F0 .445(mode \(see)2.945 F F1 -3.056(toggle localchars)2.944 F F0(belo) +2.944 E .444(w\) and the)-.25 F F1(flushoutput)202 678 Q F0 .442 +(character is typed, a)2.942 F F2 .443(TELNET AO)2.943 F F0 .443 +(sequence \(see)2.943 F F1 -3.057(send ao)2.943 F F0(abo)2.943 E -.15(ve)-.15 G +(\)).15 E .314(is sent to the remote host.)202 690 R .314(The initial v)5.314 F +.314(alue for the \215ush character is tak)-.25 F .314(en to be the)-.1 F +(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71 +(ution February)-.2 F(3, 1994)2.5 E(6)535 750 Q EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R(terminal')202 96 Q(s)-.55 E/F1 +10/Courier-Bold@0 SF(flush)2.5 E F0(character)2.5 E(.)-.55 E F1(forw1)161 114 Q +(forw2)161 132 Q F0(If)202 132 Q/F2 9/Times-Roman@0 SF(TELNET)3.769 E F0 1.269 +(is operating in)3.769 F/F3 10/Courier@0 SF(LINEMODE)3.77 E F0 3.77(,t)C 1.27 +(hese are the characters that, when typed,)370.77 132 R .958 +(cause partial lines to be forw)202 144 R .958(arded to the remote system.)-.1 +F .958(The initial v)5.958 F .957(alue for the)-.25 F(forw)202 156 Q +(arding characters are tak)-.1 E(en from the terminal')-.1 E 2.5(se)-.55 G +(ol and eol2 characters.)414.23 156 Q F1(interrupt)161 174 Q F0(If)202 186 Q F1 +(telnet)2.944 E F0 .444(is in)2.944 F F1(localchars)2.944 E F0 .445(mode \(see) +2.944 F F1 -3.055(toggle localchars)2.945 F F0(belo)2.945 E .445(w\) and the) +-.25 F F1(interrupt)202 198 Q F0 .642(character is typed, a)3.142 F F3 .642 +(TELNET IP)3.142 F F0 .642(sequence \(see)3.142 F F1 -2.859(send ip)3.141 F F0 +(abo)3.141 E -.15(ve)-.15 G 3.141(\)i).15 G(s)536.11 198 Q .949 +(sent to the remote host.)202 210 R .949(The initial v)5.949 F .949 +(alue for the interrupt character is tak)-.25 F .95(en to be)-.1 F +(the terminal')202 222 Q(s)-.55 E F1(intr)2.5 E F0(character)2.5 E(.)-.55 E F1 +(kill)161 240 Q F0(If)202 240 Q F1(telnet)2.95 E F0 .449(is in)2.949 F F1 +(localchars)2.949 E F0 .449(mode \(see)2.949 F F1 -3.051(toggle localchars) +2.949 F F0(belo)2.949 E(w\),)-.25 E F1(and)2.949 E F0(if)2.949 E F1(telnet)202 +252 Q F0 1.384(is operating in `)3.884 F 1.385(`character at a time')-.74 F +3.885('m)-.74 G 1.385(ode, then when this character is)406.995 252 R .418 +(typed, a)202 264 R F3 .418(TELNET EL)2.918 F F0 .418(sequence \(see)2.918 F F1 +-3.082(send el)2.918 F F0(abo)2.918 E -.15(ve)-.15 G 2.918(\)i).15 G 2.918(ss) +427.362 264 S .418(ent to the remote system.)438.06 264 R(The initial v)202 276 +Q(alue for the kill character is tak)-.25 E(en to be the terminal')-.1 E(s)-.55 +E F1(kill)2.5 E F0(character)2.5 E(.)-.55 E F1(lnext)161 294 Q F0(If)202 294 Q +F1(telnet)2.597 E F0 .097(is operating in)2.597 F F3(LINEMODE)2.597 E F0 .097 +(or `)2.597 F .097(`old line by line`)-.74 F 2.597(`m)-.74 G .098 +(ode, then this charac-)454.177 294 R 1.405(ter is tak)202 306 R 1.405 +(en to be the terminal')-.1 F(s)-.55 E F1(lnext)3.904 E F0(character)3.904 E +6.404(.T)-.55 G 1.404(he initial v)422.56 306 R 1.404(alue for the lne)-.25 F +(xt)-.15 E(character is tak)202 318 Q(en to be the terminal')-.1 E(s)-.55 E F1 +(lnext)2.5 E F0(character)2.5 E(.)-.55 E F1(quit)161 336 Q F0(If)202 336 Q F1 +(telnet)2.944 E F0 .444(is in)2.944 F F1(localchars)2.944 E F0 .445(mode \(see) +2.944 F F1 -3.055(toggle localchars)2.945 F F0(belo)2.945 E .445(w\) and the) +-.25 F F1(quit)202 348 Q F0 .546(character is typed, a)3.046 F F3 .545 +(TELNET BRK)3.046 F F0 .545(sequence \(see)3.045 F F1 -2.955(send brk)3.045 F +F0(abo)3.045 E -.15(ve)-.15 G 3.045(\)i).15 G 3.045(ss)516.955 348 S(ent)527.78 +348 Q .629(to the remote host.)202 360 R .629(The initial v)5.629 F .629 +(alue for the quit character is tak)-.25 F .63(en to be the termi-)-.1 F(nal') +202 372 Q(s)-.55 E F1(quit)2.5 E F0(character)2.5 E(.)-.55 E F1(reprint)161 390 +Q F0(If)202 402 Q F1(telnet)2.598 E F0 .097(is operating in)2.598 F F3 +(LINEMODE)2.597 E F0 .097(or `)2.597 F .097(`old line by line`)-.74 F 2.597(`m) +-.74 G .097(ode, then this charac-)454.179 402 R .06(ter is tak)202 414 R .06 +(en to be the terminal')-.1 F(s)-.55 E F1(reprint)2.561 E F0(character)2.561 E +5.061(.T)-.55 G .061(he initial v)422.465 414 R .061(alue for the reprint)-.25 +F(character is tak)202 426 Q(en to be the terminal')-.1 E(s)-.55 E F1(reprint) +2.5 E F0(character)2.5 E(.)-.55 E F1(rlogin)161 444 Q F0 .956 +(This is the rlogin escape character)5 F 5.956(.I)-.55 G 3.456(fs)354.366 444 S +.956(et, the normal)365.042 444 R F2(TELNET)3.456 E F0 .956 +(escape character is)3.456 F .357 +(ignored unless it is preceded by this character at the be)202 456 R .358 +(ginning of a line.)-.15 F .358(This char)5.358 F(-)-.2 E(acter)202 468 Q 3.14 +(,a)-.4 G 3.14(tt)231.11 468 S .64(he be)239.81 468 R .64 +(ginning of a line follo)-.15 F .639(wed by a ".")-.25 F .639 +(closes the connection; when fol-)5.639 F(lo)202 480 Q 1.31 +(wed by a ^Z it suspends the telnet command.)-.25 F 1.311 +(The initial state is to disable the)6.311 F(rlogin escape character)202 492 Q +(.)-.55 E F1(start)161 510 Q F0 2.232(If the)202 510 R F3 2.231 +(TELNET TOGGLE-FLOW-CONTROL)4.731 F F0 2.231 +(option has been enabled, then this)4.731 F .005(character is tak)202 522 R +.005(en to be the terminal')-.1 F(s)-.55 E F1(start)2.506 E F0(character)2.506 +E 5.006(.T)-.55 G .006(he initial v)436.06 522 R .006(alue for the kill)-.25 F +(character is tak)202 534 Q(en to be the terminal')-.1 E(s)-.55 E F1(start)2.5 +E F0(character)2.5 E(.)-.55 E F1(stop)161 552 Q F0 2.232(If the)202 552 R F3 +2.231(TELNET TOGGLE-FLOW-CONTROL)4.731 F F0 2.231 +(option has been enabled, then this)4.731 F .434(character is tak)202 564 R +.434(en to be the terminal')-.1 F(s)-.55 E F1(stop)2.934 E F0(character)2.934 E +5.434(.T)-.55 G .434(he initial v)433.916 564 R .435(alue for the kill)-.25 F +(character is tak)202 576 Q(en to be the terminal')-.1 E(s)-.55 E F1(stop)2.5 E +F0(character)2.5 E(.)-.55 E F1(susp)161 594 Q F0(If)202 594 Q F1(telnet)2.576 E +F0 .076(is in)2.576 F F1(localchars)2.576 E F0 .076(mode, or)2.576 F F3 +(LINEMODE)2.576 E F0 .076(is enabled, and the)2.576 F F1(suspend)2.575 E F0 .87 +(character is typed, a)202 606 R F3 .87(TELNET SUSP)3.37 F F0 .87 +(sequence \(see)3.37 F F1 -2.63(send susp)3.37 F F0(abo)3.37 E -.15(ve)-.15 G +3.37(\)i).15 G 3.37(ss)505.48 606 S .87(ent to)516.63 606 R .246 +(the remote host.)202 618 R .246(The initial v)5.246 F .246 +(alue for the suspend character is tak)-.25 F .246(en to be the termi-)-.1 F +(nal')202 630 Q(s)-.55 E F1(suspend)2.5 E F0(character)2.5 E(.)-.55 E F1 +(tracefile)161 648 Q F0 .537(This is the \214le to which the output, caused by) +202 660 R F1(netdata)3.037 E F0(or)3.037 E F1(option)3.037 E F0 .538 +(tracing being)3.038 F F3(TRUE)202 672 Q F0 3.079(,w)C .579(ill be written.) +238.799 672 R .579(If it is set to `)5.579 F(`)-.74 E F11.666 E F0 -.74('') +1.666 G 3.078(,t).74 G .578(hen tracing information will be written)381.85 672 +R(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71 +(ution February)-.2 F(3, 1994)2.5 E(7)535 750 Q EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R(to standard output \(the def)202 +96 Q(ault\).)-.1 E/F1 10/Courier-Bold@0 SF(worderase)161 114 Q F0(If)202 126 Q +F1(telnet)2.597 E F0 .097(is operating in)2.597 F/F2 10/Courier@0 SF(LINEMODE) +2.597 E F0 .097(or `)2.597 F .097(`old line by line`)-.74 F 2.597(`m)-.74 G +.098(ode, then this charac-)454.177 126 R 1.386(ter is tak)202 138 R 1.386 +(en to be the terminal')-.1 F(s)-.55 E F1(worderase)3.885 E F0(character)3.885 +E 6.385(.T)-.55 G 1.385(he initial v)446.39 138 R 1.385(alue for the)-.25 F -.1 +(wo)202 150 S(rderase character is tak).1 E(en to be the terminal')-.1 E(s)-.55 +E F1(worderase)2.5 E F0(character)2.5 E(.)-.55 E F1(?)161 168 Q F0 +(Displays the le)202 168 Q -.05(ga)-.15 G(l).05 E F1(set)2.5 E F0(\()4.166 E F1 +(unset)1.666 E F0 4.166(\)c)1.666 G(ommands.)346.724 168 Q F1(slc)102 186 Q/F3 +10/Courier-Oblique@0 SF(state)6.383 E F0(The)5 E F1(slc)2.883 E F0 .384(comman\ +d \(Set Local Characters\) is used to set or change the state of the the speci\ +al)2.884 F 1.231(characters when the)161 198 R F2 1.231(TELNET LINEMODE)3.731 F +F0 1.231(option has been enabled.)3.731 F 1.231(Special characters are)6.231 F +.139(characters that get mapped to)161 210 R/F4 9/Times-Roman@0 SF(TELNET)2.639 +E F0 .139(commands sequences \(lik)2.639 F(e)-.1 E F1(ip)2.639 E F0(or)2.639 E +F1(quit)2.639 E F0 2.639(\)o)C 2.639(rl)488.611 210 S .14(ine editing)497.36 +210 R(characters \(lik)161 222 Q(e)-.1 E F1(erase)2.5 E F0(and)2.5 E F1(kill) +2.5 E F0(\). By def)A(ault, the local special characters are e)-.1 E(xported.) +-.15 E F1(check)161 240 Q F0 -1.11(Ve)216 240 S .526 +(rify the current settings for the current special characters.)1.11 F .525 +(The remote side is)5.526 F .925(requested to send all the current special cha\ +racter settings, and if there are an)216 252 R(y)-.15 E +(discrepancies with the local side, the local side will switch to the remote v) +216 264 Q(alue.)-.25 E F1(export)161 282 Q F0 .497(Switch to the local def)216 +282 R .497(aults for the special characters.)-.1 F .496(The local def)5.496 F +.496(ault charac-)-.1 F(ters are those of the local terminal at the time when) +216 294 Q F1(telnet)2.5 E F0 -.1(wa)2.5 G 2.5(ss).1 G(tarted.)483.8 294 Q F1 +(import)161 312 Q F0 1.929(Switch to the remote def)216 312 R 1.929 +(aults for the special characters.)-.1 F 1.929(The remote def)6.929 F(ault)-.1 +E .37(characters are those of the remote system at the time when the)216 324 R +F4(TELNET)2.869 E F0(connec-)2.869 E(tion w)216 336 Q(as established.)-.1 E F1 +(?)161 354 Q F0(Prints out help information for the)216 354 Q F1(slc)2.5 E F0 +(command.)2.5 E F1(status)102 372 Q F0(Sho)161 372 Q 2.808(wt)-.25 G .308 +(he current status of)189.118 372 R F1(telnet)2.809 E F0 2.809(.T)C .309 +(his includes the peer one is connected to, as well as the)316.641 372 R +(current mode.)161 384 Q F1(toggle)102 402 Q F3(arguments ...)6 E F0 -.8(To)161 +414 S 2.112(ggle \(between).8 F F2(TRUE)4.612 E F0(and)4.612 E F2(FALSE)4.612 E +F0 4.612(\)v)C 2.112(arious \215ags that control ho)324.76 414 R(w)-.25 E F1 +(telnet)4.611 E F0 2.111(responds to)4.611 F -2.15 -.25(ev e)161 426 T 2.73 +(nts. These).25 F .23(\215ags may be set e)2.73 F .231(xplicitly to)-.15 F F2 +(TRUE)2.731 E F0(or)2.731 E F2(FALSE)2.731 E F0 .231(using the)2.731 F F1(set) +2.731 E F0(and)2.731 E F1(unset)2.731 E F0(com-)2.731 E .544(mands listed abo) +161 438 R -.15(ve)-.15 G 5.544(.M).15 G .544(ore than one ar)255.382 438 R .543 +(gument may be speci\214ed.)-.18 F .543(The state of these \215ags may)5.543 F +(be interrog)161 450 Q(ated with the)-.05 E F1(display)2.5 E F0 2.5(command. V) +2.5 F(alid ar)-1.11 E(guments are:)-.18 E F1(authdebug)161 468 Q F0 -.45(Tu)226 +468 S(rns on deb).45 E(ugging information for the authentication code.)-.2 E F1 +(autoflush)161 486 Q F0(If)226 486 Q F1(autoflush)4.407 E F0(and)4.407 E F1 +(localchars)4.407 E F0 1.907(are both)4.407 F F2(TRUE)4.407 E F0 4.407(,t)C +1.907(hen when the)451.219 486 R F1(ao)4.408 E F0 4.408(,o)C(r)536.67 486 Q F1 +(quit)226 498 Q F0 1.803(characters are recognized \(and transformed into)4.304 +F F4(TELNET)4.303 E F0(sequences;)4.303 E(see)226 510 Q F1(set)2.966 E F0(abo) +2.966 E .766 -.15(ve f)-.15 H .466(or details\),).15 F F1(telnet)2.966 E F0 +.466(refuses to display an)2.966 F 2.966(yd)-.15 G .467(ata on the user')473.89 +510 R(s)-.55 E 2.241(terminal until the remote system ackno)226 522 R 2.241 +(wledges \(via a)-.25 F F2 2.241(TELNET TIMING)4.741 F(MARK)226 534 Q F0 .496 +(option\) that it has processed those)2.996 F F4(TELNET)2.996 E F0 2.996 +(sequences. The)2.996 F .497(initial v)2.996 F(al-)-.25 E .754 +(ue for this toggle is)226 546 R F2(TRUE)3.254 E F0 .753 +(if the terminal user had not done an "stty no\215sh",)3.253 F(otherwise)226 +558 Q F2(FALSE)2.5 E F0(\(see)2.5 E F2(stty)2.5 E F0(\(1\)\).)A F1(autodecrypt) +161 576 Q F0 .556(When the)226 588 R F2 .556(TELNET ENCRYPT)3.056 F F0 .556 +(option is ne)3.056 F .556(gotiated, by def)-.15 F .557(ault the actual en-)-.1 +F .403(cryption \(decryption\) of the data stream does not start automatically) +226 600 R 5.402(.T)-.65 G .402(he au-)514.888 600 R .789(toencrypt \(autodecry\ +pt\) command states that encryption of the output \(input\))226 612 R +(stream should be enabled as soon as possible.)226 624 Q 2.87(Note: Because)226 +642 R .369(of e)2.869 F .369(xport controls, the)-.15 F F2 .369(TELNET ENCRYPT) +2.869 F F0 .369(option is not sup-)2.869 F +(ported outside the United States and Canada.)226 654 Q F1(autologin)161 672 Q +F0 4.509(If the remote side supports the)226 672 R F2 4.509 +(TELNET AUTHENTICATION)7.009 F F0(option)7.009 E F4(TELNET)226 684 Q F0 3.448 +(attempts to use it to perform automatic authentication.)5.948 F 3.447(If the) +8.447 F F2(AUTHENTICATION)226 696 Q F0 .197(option is not supported, the user') +2.697 F 2.697(sl)-.55 G .197(ogin name are propa-)454.159 696 R -.05(ga)226 708 +S .41(ted through the).05 F F2 .41(TELNET ENVIRON)2.91 F F0 2.91(option. This) +2.91 F .41(command is the same as)2.91 F(4.2 Berk)72 756 Q(ele)-.1 E 2.5(yD) +-.15 G(istrib)132.57 756 Q 95.71(ution February)-.2 F(3, 1994)2.5 E(8)535 756 Q +EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R(specifying)226 96 Q/F1 10 +/Courier-Oblique@0 SF(a)2.5 E F0(option on the)2.5 E/F2 10/Courier-Bold@0 SF +(open)2.5 E F0(command.)2.5 E F2(autosynch)161 114 Q F0(If)226 114 Q F2 +(autosynch)4.854 E F0(and)4.854 E F2(localchars)4.854 E F0 2.354(are both)4.854 +F/F3 10/Courier@0 SF(TRUE)4.854 E F0 4.854(,t)C 2.354(hen when either the) +454.348 114 R F2(intr)226 126 Q F0(or)4.17 E F2(quit)4.17 E F0 1.669 +(characters is typed \(see)4.169 F F2(set)4.169 E F0(abo)4.169 E 1.969 -.15 +(ve f)-.15 H 1.669(or descriptions of the).15 F F2(intr)226 138 Q F0(and)2.925 +E F2(quit)2.925 E F0 .426(characters\), the resulting)2.925 F/F4 9 +/Times-Roman@0 SF(TELNET)2.926 E F0 .426(sequence sent is follo)2.926 F(wed) +-.25 E 1.634(by the)226 150 R F3 1.634(TELNET SYNCH)4.134 F F0 4.134 +(sequence. This)4.134 F(procedure)4.134 E F2(should)4.134 E F0 1.634 +(cause the re-)4.134 F .871(mote system to be)226 162 R .871(gin thro)-.15 F +.872(wing a)-.25 F -.1(wa)-.15 G 3.372(ya).1 G .872(ll pre)385.008 162 R .872 +(viously typed input until both of)-.25 F(the)226 174 Q F4(TELNET)3.622 E F0 +1.122(sequences ha)3.622 F 1.422 -.15(ve b)-.2 H 1.121 +(een read and acted upon.).15 F 1.121(The initial v)6.121 F 1.121(alue of)-.25 +F(this toggle is)226 186 Q F3(FALSE)2.5 E F0(.)A F2(binary)161 204 Q F0 +(Enable or disable the)226 204 Q F3(TELNET BINARY)2.5 E F0 +(option on both input and output.)2.5 E F2(inbinary)161 222 Q F0 +(Enable or disable the)226 222 Q F3(TELNET BINARY)2.5 E F0(option on input.)2.5 +E F2(outbinary)161 240 Q F0(Enable or disable the)226 240 Q F3(TELNET BINARY) +2.5 E F0(option on output.)2.5 E F2(crlf)161 258 Q F0 1.415(If this is)226 258 +R F3(TRUE)3.915 E F0 3.915(,t)C 1.415(hen carriage returns will be sent as) +298.72 258 R F3()3.915 E F0 3.915(.I)C 3.915(ft)507.72 258 S 1.415 +(his is)517.745 258 R F3(FALSE)226 270 Q F0 3.26(,t)C .759 +(hen carriage returns will be send as)264.54 270 R F3()3.259 E F0 +3.259(.T)C .759(he initial v)479.292 270 R(alue)-.25 E(for this toggle is)226 +282 Q F3(FALSE)2.5 E F0(.)A F2(crmod)161 300 Q F0 -.8(To)226 300 S 1.1 +(ggle carriage return mode.).8 F 1.1 +(When this mode is enabled, most carriage re-)6.1 F .745(turn characters recei) +226 312 R -.15(ve)-.25 G 3.244(df).15 G .744 +(rom the remote host will be mapped into a carriage)329.174 312 R 1.492 +(return follo)226 324 R 1.492(wed by a line feed.)-.25 F 1.493 +(This mode does not af)6.492 F 1.493(fect those characters)-.25 F .207 +(typed by the user)226 336 R 2.707(,o)-.4 G .207(nly those recei)305.028 336 R +-.15(ve)-.25 G 2.706(df).15 G .206(rom the remote host.)383.838 336 R .206 +(This mode is not)5.206 F -.15(ve)226 348 S 1.026 +(ry useful unless the remote host only sends carriage return, b).15 F 1.026 +(ut ne)-.2 F -.15(ve)-.25 G 3.526(rl).15 G(ine)527.78 348 Q 2.5(feed. The)226 +360 R(initial v)2.5 E(alue for this toggle is)-.25 E F3(FALSE)2.5 E F0(.)A F2 +(debug)161 378 Q F0 -.8(To)226 378 S .073(ggles sock).8 F .073(et le)-.1 F -.15 +(ve)-.25 G 2.573(ld).15 G(eb)314.629 378 Q .073(ugging \(useful only to the)-.2 +F F2 .072(super user)2.573 F F0 .072(\). The initial)B -.25(va)226 390 S +(lue for this toggle is).25 E F3(FALSE)2.5 E F0(.)A F2(encdebug)161 408 Q F0 +-.45(Tu)226 408 S(rns on deb).45 E(ugging information for the encryption code.) +-.2 E F2(localchars)161 426 Q F0 1.485(If this is)5 F F3(TRUE)3.985 E F0 3.985 +(,t)C 1.485(hen the)299 426 R F2(flush)3.985 E F0(,)A F2(interrupt)3.986 E F0 +(,)A F2(quit)3.986 E F0(,)A F2(erase)3.986 E F0 3.986(,a)C(nd)502.014 426 Q F2 +(kill)3.986 E F0 2.944(characters \(see)226 438 R F2(set)5.444 E F0(abo)5.444 E +-.15(ve)-.15 G 5.443(\)a).15 G 2.943(re recognized locally)353.755 438 R 5.443 +(,a)-.65 G 2.943(nd transformed into)455.234 438 R 3.265 +(\(hopefully\) appropriate)226 450 R F4(TELNET)5.765 E F0 3.265 +(control sequences \(respecti)5.765 F -.15(ve)-.25 G(ly).15 E F2(ao)5.766 E F0 +(,)A F2(ip)5.766 E F0(,)A F2(brk)226 462 Q F0(,)A F2(ec)2.788 E F0 2.788(,a)C +(nd)271.016 462 Q F2(el)2.787 E F0 2.787(;s)C(ee)305.26 462 Q F2(send)2.787 E +F0(abo)2.787 E -.15(ve)-.15 G 2.787(\). The).15 F .287(initial v)2.787 F .287 +(alue for this toggle is)-.25 F F3(TRUE)2.787 E F0 .045(in `)226 474 R .045 +(`old line by line')-.74 F 2.546('m)-.74 G .046(ode, and)318.906 474 R F3 +(FALSE)2.546 E F0 .046(in `)2.546 F .046(`character at a time')-.74 F 2.546('m) +-.74 G 2.546(ode. When)494.134 474 R(the)226 486 Q F3(LINEMODE)2.894 E F0 .394 +(option is enabled, the v)2.894 F .394(alue of)-.25 F F2(localchars)2.893 E F0 +.393(is ignored, and)2.893 F 2.388(assumed to al)226 498 R -.1(wa)-.1 G 2.388 +(ys be).1 F F3(TRUE)4.888 E F0 4.888(.I)C(f)359.5 498 Q F3(LINEMODE)4.888 E F0 +2.388(has e)4.888 F -.15(ve)-.25 G 4.888(rb).15 G 2.389(een enabled, then) +465.522 498 R F2(quit)226 510 Q F0 1.574(is sent as)4.074 F F2(abort)4.074 E F0 +4.074(,a)C(nd)338.42 510 Q F2 1.574(eof and)4.074 F F0 1.573(are sent as)4.074 +F F2 1.573(eof and)4.073 F(susp)4.073 E F0 4.073(,s)C(ee)531.12 510 Q F2(send) +226 522 Q F0(abo)2.5 E -.15(ve)-.15 G(\).).15 E F2(netdata)161 540 Q F0 -.8(To) +226 540 S .993(ggles the display of all netw).8 F .994(ork data \(in he)-.1 F +.994(xadecimal format\).)-.15 F .994(The initial)5.994 F -.25(va)226 552 S +(lue for this toggle is).25 E F3(FALSE)2.5 E F0(.)A F2(options)161 570 Q F0 -.8 +(To)226 570 S .625(ggles the display of some internal).8 F F2(telnet)3.125 E F0 +.625(protocol processing \(ha)3.125 F .625(ving to)-.2 F(do with)226 582 Q F4 +(TELNET)2.5 E F0 2.5(options\). The)2.5 F(initial v)2.5 E +(alue for this toggle is)-.25 E F3(FALSE)2.5 E F0(.)A F2(prettydump)161 600 Q +F0 .133(When the)5 F F2(netdata)2.633 E F0 .134(toggle is enabled, if)2.633 F +F2(prettydump)2.634 E F0 .134(is enabled the output)2.634 F .745(from the)226 +612 R F2(netdata)3.245 E F0 .744 +(command will be formatted in a more user readable for)3.244 F(-)-.2 E 3.199 +(mat. Spaces)226 624 R .699 +(are put between each character in the output, and the be)3.199 F(ginning)-.15 +E(of an)226 636 Q(y)-.15 E F4(TELNET)2.5 E F0 +(escape sequence is preceded by a ')2.5 E/F5 10/Symbol SF(*)A F0 2.5('t)C 2.5 +(oa)442.553 636 S(id in locating them.)454.493 636 Q F2(skiprc)161 654 Q F0 +4.589(When the skiprc toggle is)226 654 R F3(TRUE)7.089 E F0(,)A F4(TELNET) +7.089 E F0 4.589(skips the reading of the)7.089 F F3(.telnetrc)226 666 Q F0 +1.033(\214le in the users home directory when connections are opened.)3.533 F +(The initial v)226 678 Q(alue for this toggle is)-.25 E F3(FALSE.)2.5 E F0 +(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71 +(ution February)-.2 F(3, 1994)2.5 E(9)535 750 Q EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNET \( 1 \))72 48 R(BSD Reference Manual) +258.235 48 Q -.834(TELNET \( 1 \))485.572 48 R/F1 10/Courier-Bold@0 SF +(termdata)161 96 Q F0 -.8(To)226 96 S .934 +(ggles the display of all terminal data \(in he).8 F .933(xadecimal format\).) +-.15 F .933(The initial)5.933 F -.25(va)226 108 S(lue for this toggle is).25 E +/F2 10/Courier@0 SF(FALSE)2.5 E F0(.)A F1(verbose_encrypt)161 126 Q F0 1.129 +(When the)226 138 R F1(verbose_encrypt)3.629 E F0 1.13(toggle is)3.629 F F2 +(TRUE)3.63 E F0(,)A/F3 9/Times-Roman@0 SF(TELNET)3.63 E F0 1.13 +(prints out a mes-)3.63 F 1.377 +(sage each time encryption is enabled or disabled.)226 150 R 1.376 +(The initial v)6.377 F 1.376(alue for this)-.25 F 1.223(toggle is)226 162 R F2 +(FALSE.)3.723 E F0 3.723(Note: Because)3.723 F 1.224(of e)3.724 F 1.224 +(xport controls, data encryption is not)-.15 F +(supported outside of the United States and Canada.)226 174 Q F1(?)161 192 Q F0 +(Displays the le)226 192 Q -.05(ga)-.15 G(l).05 E F1(toggle)2.5 E F0(commands.) +2.5 E F1(z)102 210 Q F0(Suspend)161 210 Q F1(telnet)2.5 E F0 2.5(.T)C +(his command only w)244.5 210 Q(orks when the user is using the)-.1 E F2(csh) +2.5 E F0(\(1\).)A F1(!)102 228 Q F0([)6.833 E/F4 10/Courier-Oblique@0 SF +(command).833 E F0(]).833 E(Ex)161 240 Q .293 +(ecute a single command in a subshell on the local system.)-.15 F(If)5.292 E F1 +(command)2.792 E F0 .292(is omitted, then an)2.792 F(interacti)161 252 Q .3 +-.15(ve s)-.25 H(ubshell is in).15 E -.2(vo)-.4 G -.1(ke).2 G(d.).1 E F1(?)102 +270 Q F0([)6.833 E F4(command).833 E F0(]).833 E 1.177(Get help.)161 282 R -.4 +(Wi)6.177 G 1.178(th no ar).4 F(guments,)-.18 E F1(telnet)3.678 E F0 1.178 +(prints a help summary)3.678 F 6.178(.I)-.65 G 3.678(fac)433.358 282 S 1.178 +(ommand is speci\214ed,)452.924 282 R F1(telnet)161 294 Q F0 +(will print the help information for just that command.)2.5 E/F5 10 +/Times-Bold@0 SF(ENVIR)72 318 Q(ONMENT)-.3 E F1(Telnet)102 330 Q F0 .666 +(uses at least the)3.166 F F2(HOME)3.166 E F0(,)A F2(SHELL)3.165 E F0(,)A F2 +(DISPLAY)3.165 E F0 3.165(,a)C(nd)326.255 330 Q F2(TERM)3.165 E F0(en)3.165 E +.665(vironment v)-.4 F 3.165(ariables. Other)-.25 F(en)3.165 E(vironment)-.4 E +-.25(va)102 342 S(riables may be propag).25 E(ated to the other side via the) +-.05 E F2(TELNET ENVIRON)2.5 E F0(option.)2.5 E F5(FILES)72 366 Q F2 +(~/.telnetrc)102 378 Q F0(user customized telnet startup v)5 E(alues)-.25 E F5 +(HIST)72 402 Q(OR)-.18 E(Y)-.35 E F0(The)102 414 Q F1(Telnet)2.5 E F0 +(command appeared in 4.2)2.5 E F3(BSD)A F0(.)A F5(NO)72 438 Q(TES)-.4 E F0 +(On some remote systems, echo has to be turned of)102 450 Q 2.5(fm)-.25 G +(anually when in `)316.44 450 Q(`old line by line')-.74 E 2.5('m)-.74 G(ode.) +465.22 450 Q .691(In `)102 468 R .691(`old line by line')-.74 F 3.191('m)-.74 G +.691(ode or)198.685 468 R F2(LINEMODE)3.191 E F0 .691(the terminal')3.191 F(s) +-.55 E F1(eof)3.191 E F0 .691(character is only recognized \(and sent to the) +3.191 F(remote system\) when it is the \214rst character on a line.)102 480 Q +(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71 +(ution February)-.2 F(3, 1994)2.5 E(10)530 750 Q EP +%%Trailer +end +%%EOF diff --git a/appl/telnet/telnet/telnet.0.txt b/appl/telnet/telnet/telnet.0.txt new file mode 100644 index 000000000..0d644d307 --- /dev/null +++ b/appl/telnet/telnet/telnet.0.txt @@ -0,0 +1,722 @@ +TELNET(1) BSD Reference Manual TELNET(1) + +NNAAMMEE + tteellnneett - user interface to the TELNET protocol + +SSYYNNOOPPSSIISS + tteellnneett [--88EEFFKKLLaaccddffrrxx] [--SS _t_o_s] [--XX _a_u_t_h_t_y_p_e] [--ee _e_s_c_a_p_e_c_h_a_r] [--kk _r_e_a_l_m] + [--ll _u_s_e_r] [--nn _t_r_a_c_e_f_i_l_e] [_h_o_s_t [port]] + +DDEESSCCRRIIPPTTIIOONN + The tteellnneett command is used to communicate with another host using the + TELNET protocol. If tteellnneett is invoked without the _h_o_s_t argument, it en- + ters command mode, indicated by its prompt (tteellnneett>>). In this mode, it + accepts and executes the commands listed below. If it is invoked with + arguments, it performs an ooppeenn command with those arguments. + + Options: + + --88 Specifies an 8-bit data path. This causes an attempt to negoti- + ate the TELNET BINARY option on both input and output. + + --EE Stops any character from being recognized as an escape character. + + --FF If Kerberos V5 authentication is being used, the --FF option allows + the local credentials to be forwarded to the remote system, in- + cluding any credentials that have already been forwarded into the + local environment. + + --KK Specifies no automatic login to the remote system. + + --LL Specifies an 8-bit data path on output. This causes the BINARY + option to be negotiated on output. + + --SS _t_o_s Sets the IP type-of-service (TOS) option for the telnet connec- + tion to the value _t_o_s_, which can be a numeric TOS value or, on + systems that support it, a symbolic TOS name found in the + /etc/iptos file. + + --XX _a_t_y_p_e + Disables the _a_t_y_p_e type of authentication. + + --aa Attempt automatic login. Currently, this sends the user name via + the USER variable of the ENVIRON option if supported by the re- + mote system. The name used is that of the current user as re- + turned by getlogin(2) if it agrees with the current user ID, oth- + erwise it is the name associated with the user ID. + + --cc Disables the reading of the user's _._t_e_l_n_e_t_r_c file. (See the + ttooggggllee sskkiipprrcc command on this man page.) + + --dd Sets the initial value of the ddeebbuugg toggle to TRUE + + --ee _e_s_c_a_p_e _c_h_a_r + Sets the initial tteellnneett tteellnneett escape character to _e_s_c_a_p_e _c_h_a_r_. + If _e_s_c_a_p_e _c_h_a_r is omitted, then there will be no escape charac- + ter. + + --ff If Kerberos V5 authentication is being used, the --ff option allows + the local credentials to be forwarded to the remote system. + + --kk _r_e_a_l_m + If Kerberos authentication is being used, the --kk option requests + that telnet obtain tickets for the remote host in realm realm in- + stead of the remote host's realm, as determined by + + krb_realmofhost(3). + + --ll _u_s_e_r + When connecting to the remote system, if the remote system under- + stands the ENVIRON option, then _u_s_e_r will be sent to the remote + system as the value for the variable USER. This option implies + the --aa option. This option may also be used with the ooppeenn com- + mand. + + --nn _t_r_a_c_e_f_i_l_e + Opens _t_r_a_c_e_f_i_l_e for recording trace information. See the sseett + ttrraacceeffiillee command below. + + --rr Specifies a user interface similar to rlogin(1). In this mode, + the escape character is set to the tilde (~) character, unless + modified by the -e option. + + --xx Turns on encryption of the data stream if possible. This option + is not available outside of the United States and Canada. + + _h_o_s_t Indicates the official name, an alias, or the Internet address of + a remote host. + + _p_o_r_t Indicates a port number (address of an application). If a number + is not specified, the default tteellnneett port is used. + + When in rlogin mode, a line of the form ~. disconnects from the remote + host; ~ is the telnet escape character. Similarly, the line ~^Z suspends + the telnet session. The line ~^] escapes to the normal telnet escape + prompt. + + Once a connection has been opened, tteellnneett will attempt to enable the + TELNET LINEMODE option. If this fails, then tteellnneett will revert to one of + two input modes: either ``character at a time'' or ``old line by line'' + depending on what the remote system supports. + + When LINEMODE is enabled, character processing is done on the local sys- + tem, under the control of the remote system. When input editing or char- + acter echoing is to be disabled, the remote system will relay that infor- + mation. The remote system will also relay changes to any special charac- + ters that happen on the remote system, so that they can take effect on + the local system. + + In ``character at a time'' mode, most text typed is immediately sent to + the remote host for processing. + + In ``old line by line'' mode, all text is echoed locally, and (normally) + only completed lines are sent to the remote host. The ``local echo char- + acter'' (initially ``^E'') may be used to turn off and on the local echo + (this would mostly be used to enter passwords without the password being + echoed). + + If the LINEMODE option is enabled, or if the llooccaallcchhaarrss toggle is TRUE + (the default for ``old line by line``; see below), the user's qquuiitt, iinnttrr, + and fflluusshh characters are trapped locally, and sent as TELNET protocol se- + quences to the remote side. If LINEMODE has ever been enabled, then the + user's ssuusspp and eeooff are also sent as TELNET protocol sequences, and qquuiitt + is sent as a TELNET ABORT instead of BREAK There are options (see ttooggggllee + aauuttoofflluusshh and ttooggggllee aauuttoossyynncchh below) which cause this action to flush + subsequent output to the terminal (until the remote host acknowledges the + TELNET sequence) and flush previous terminal input (in the case of qquuiitt + and iinnttrr). + + While connected to a remote host, tteellnneett command mode may be entered by + typing the tteellnneett ``escape character'' (initially ``^]''). When in com- + mand mode, the normal terminal editing conventions are available. + + The following tteellnneett commands are available. Only enough of each command + to uniquely identify it need be typed (this is also true for arguments to + the mmooddee, sseett, ttooggggllee, uunnsseett, ssllcc, eennvviirroonn, and ddiissppllaayy commands). + + aauutthh _a_r_g_u_m_e_n_t _._._. + The auth command manipulates the information sent through the + TELNET AUTHENTICATE option. Valid arguments for the auth com- + mand are as follows: + + ddiissaabbllee _t_y_p_e Disables the specified type of authentication. + To obtain a list of available types, use the + aauutthh ddiissaabbllee ?? command. + + eennaabbllee _t_y_p_e Enables the specified type of authentication. + To obtain a list of available types, use the + aauutthh eennaabbllee ?? command. + + ssttaattuuss Lists the current status of the various types of + authentication. + + cclloossee Close a TELNET session and return to command mode. + + ddiissppllaayy _a_r_g_u_m_e_n_t _._._. + Displays all, or some, of the sseett and ttooggggllee values (see be- + low). + + eennccrryypptt _a_r_g_u_m_e_n_t _._._. + The encrypt command manipulates the information sent through + the TELNET ENCRYPT option. + + Note: Because of export controls, the TELNET ENCRYPT option + is not supported outside of the United States and Canada. + + Valid arguments for the encrypt command are as follows: + + ddiissaabbllee _t_y_p_e [[iinnppuutt||oouuttppuutt]] + Disables the specified type of encryption. If + you omit the input and output, both input and + output are disabled. To obtain a list of avail- + able types, use the eennccrryypptt ddiissaabbllee ?? command. + + eennaabbllee _t_y_p_e [[iinnppuutt||oouuttppuutt]] + Enables the specified type of encryption. If + you omit input and output, both input and output + are enabled. To obtain a list of available + types, use the eennccrryypptt eennaabbllee ?? command. + + iinnppuutt This is the same as the eennccrryypptt ssttaarrtt iinnppuutt com- + mand. + + --iinnppuutt This is the same as the eennccrryypptt ssttoopp iinnppuutt com- + mand. + + oouuttppuutt This is the same as the eennccrryypptt ssttaarrtt oouuttppuutt + command. + + --oouuttppuutt This is the same as the eennccrryypptt ssttoopp oouuttppuutt com- + mand. + + ssttaarrtt [[iinnppuutt||oouuttppuutt]] + Attempts to start encryption. If you omit iinnppuutt + and oouuttppuutt,, both input and output are enabled. + To obtain a list of available types, use the + + + eennccrryypptt eennaabbllee ?? command. + + ssttaattuuss Lists the current status of encryption. + + ssttoopp [[iinnppuutt||oouuttppuutt]] + Stops encryption. If you omit input and output, + encryption is on both input and output. + + ttyyppee _t_y_p_e Sets the default type of encryption to be used + with later eennccrryypptt ssttaarrtt or eennccrryypptt ssttoopp com- + mands. + + eennvviirroonn _a_r_g_u_m_e_n_t_s_._._. + The eennvviirroonn command is used to manipulate the the variables + that my be sent through the TELNET ENVIRON option. The ini- + tial set of variables is taken from the users environment, + with only the DISPLAY and PRINTER variables being exported by + default. The USER variable is also exported if the --aa or --ll + options are used. + Valid arguments for the eennvviirroonn command are: + + ddeeffiinnee _v_a_r_i_a_b_l_e _v_a_l_u_e + Define the variable _v_a_r_i_a_b_l_e to have a value of + _v_a_l_u_e_. Any variables defined by this command are + automatically exported. The _v_a_l_u_e may be enclosed + in single or double quotes so that tabs and spaces + may be included. + + uunnddeeffiinnee _v_a_r_i_a_b_l_e + Remove _v_a_r_i_a_b_l_e from the list of environment vari- + ables. + + eexxppoorrtt _v_a_r_i_a_b_l_e + Mark the variable _v_a_r_i_a_b_l_e to be exported to the + remote side. + + uunneexxppoorrtt _v_a_r_i_a_b_l_e + Mark the variable _v_a_r_i_a_b_l_e to not be exported un- + less explicitly asked for by the remote side. + + lliisstt List the current set of environment variables. + Those marked with a ** will be sent automatically, + other variables will only be sent if explicitly + requested. + + ?? Prints out help information for the eennvviirroonn com- + mand. + + llooggoouutt Sends the TELNET LOGOUT option to the remote side. This com- + mand is similar to a cclloossee command; however, if the remote + side does not support the LOGOUT option, nothing happens. If, + however, the remote side does support the LOGOUT option, this + command should cause the remote side to close the TELNET con- + nection. If the remote side also supports the concept of sus- + pending a user's session for later reattachment, the logout + argument indicates that you should terminate the session imme- + diately. + + mmooddee _t_y_p_e _T_y_p_e is one of several options, depending on the state of the + TELNET session. The remote host is asked for permission to go + into the requested mode. If the remote host is capable of en- + tering that mode, the requested mode will be entered. + + cchhaarraacctteerr Disable the TELNET LINEMODE option, or, if the + remote side does not understand the LINEMODE op- + + tion, then enter ``character at a time`` mode. + + lliinnee Enable the TELNET LINEMODE option, or, if the + remote side does not understand the LINEMODE op- + tion, then attempt to enter ``old-line-by-line`` + mode. + + iissiigg (--iissiigg) Attempt to enable (disable) the TRAPSIG mode of + the LINEMODE option. This requires that the + LINEMODE option be enabled. + + eeddiitt (--eeddiitt) Attempt to enable (disable) the EDIT mode of the + LINEMODE option. This requires that the + LINEMODE option be enabled. + + ssooffttttaabbss (--ssooffttttaabbss) + Attempt to enable (disable) the SOFT_TAB mode of + the LINEMODE option. This requires that the + LINEMODE option be enabled. + + lliitteecchhoo (--lliitteecchhoo) + Attempt to enable (disable) the LIT_ECHO mode of + the LINEMODE option. This requires that the + LINEMODE option be enabled. + + ?? Prints out help information for the mmooddee com- + mand. + + ooppeenn _h_o_s_t [[--ll] _u_s_e_r][--_p_o_r_t] + Open a connection to the named host. If no port number is + specified, tteellnneett will attempt to contact a TELNET server at + the default port. The host specification may be either a host + name (see hosts(5)) or an Internet address specified in the + ``dot notation'' (see inet(3)). The [--ll] option may be used + to specify the user name to be passed to the remote system via + the ENVIRON option. When connecting to a non-standard port, + tteellnneett omits any automatic initiation of TELNET options. When + the port number is preceded by a minus sign, the initial op- + tion negotiation is done. After establishing a connection, + the file _._t_e_l_n_e_t_r_c in the users home directory is opened. + Lines beginning with a # are comment lines. Blank lines are + ignored. Lines that begin without white space are the start + of a machine entry. The first thing on the line is the name + of the machine that is being connected to. The rest of the + line, and successive lines that begin with white space are as- + sumed to be tteellnneett commands and are processed as if they had + been typed in manually to the tteellnneett command prompt. + + qquuiitt Close any open TELNET session and exit tteellnneett. An end of file + (in command mode) will also close a session and exit. + + sseenndd _a_r_g_u_m_e_n_t_s + Sends one or more special character sequences to the remote + host. The following are the arguments which may be specified + (more than one argument may be specified at a time): + + aabboorrtt Sends the TELNET ABORT (Abort processes) sequence. + + aaoo Sends the TELNET AO (Abort Output) sequence, which + should cause the remote system to flush all output + _f_r_o_m the remote system _t_o the user's terminal. + + aayytt Sends the TELNET AYT (Are You There) sequence, to + which the remote system may or may not choose to re- + + + spond. + + bbrrkk Sends the TELNET BRK (Break) sequence, which may have + significance to the remote system. + + eecc Sends the TELNET EC (Erase Character) sequence, which + should cause the remote system to erase the last char- + acter entered. + + eell Sends the TELNET EL (Erase Line) sequence, which + should cause the remote system to erase the line cur- + rently being entered. + + eeooff Sends the TELNET EOF (End Of File) sequence. + + eeoorr Sends the TELNET EOR (End of Record) sequence. + + eessccaappee Sends the current tteellnneett escape character (initially + ``^''). + + ggaa Sends the TELNET GA (Go Ahead) sequence, which likely + has no significance to the remote system. + + ggeettssttaattuuss + If the remote side supports the TELNET STATUS command, + ggeettssttaattuuss will send the subnegotiation to request that + the server send its current option status. + + iipp Sends the TELNET IP (Interrupt Process) sequence, + which should cause the remote system to abort the cur- + rently running process. + + nnoopp Sends the TELNET NOP (No OPeration) sequence. + + ssuusspp Sends the TELNET SUSP (SUSPend process) sequence. + + ssyynncchh Sends the TELNET SYNCH sequence. This sequence causes + the remote system to discard all previously typed (but + not yet read) input. This sequence is sent as TCP ur- + gent data (and may not work if the remote system is a + 4.2BSD system -- if it doesn't work, a lower case + ``r'' may be echoed on the terminal). + + ddoo _c_m_d + + ddoonntt _c_m_d + + wwiillll _c_m_d + + wwoonntt _c_m_d + Sends the TELNET DO _c_m_d sequence. _C_m_d can be either a + decimal number between 0 and 255, or a symbolic name + for a specific TELNET command. _C_m_d can also be either + hheellpp or ?? to print out help information, including a + list of known symbolic names. + + ?? Prints out help information for the sseenndd command. + + sseett _a_r_g_u_m_e_n_t _v_a_l_u_e + + uunnsseett _a_r_g_u_m_e_n_t _v_a_l_u_e + The sseett command will set any one of a number of tteellnneett vari- + ables to a specific value or to TRUE. The special value ooffff + turns off the function associated with the variable, this is + equivalent to using the uunnsseett command. The uunnsseett command will + disable or set to FALSE any of the specified functions. The + values of variables may be interrogated with the ddiissppllaayy com- + mand. The variables which may be set or unset, but not tog- + gled, are listed here. In addition, any of the variables for + the ttooggggllee command may be explicitly set or unset using the + sseett and uunnsseett commands. + + aayytt If TELNET is in localchars mode, or LINEMODE is en- + abled, and the status character is typed, a TELNET AYT + sequence (see sseenndd aayytt preceding) is sent to the re- + mote host. The initial value for the "Are You There" + character is the terminal's status character. + + eecchhoo This is the value (initially ``^E'') which, when in + ``line by line'' mode, toggles between doing local + echoing of entered characters (for normal processing), + and suppressing echoing of entered characters (for en- + tering, say, a password). + + eeooff If tteellnneett is operating in LINEMODE or ``old line by + line'' mode, entering this character as the first + character on a line will cause this character to be + sent to the remote system. The initial value of the + eof character is taken to be the terminal's eeooff char- + acter. + + eerraassee If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss + below), aanndd if tteellnneett is operating in ``character at a + time'' mode, then when this character is typed, a + TELNET EC sequence (see sseenndd eecc above) is sent to the + remote system. The initial value for the erase char- + acter is taken to be the terminal's eerraassee character. + + eessccaappee This is the tteellnneett escape character (initially ``^['') + which causes entry into tteellnneett command mode (when con- + nected to a remote system). + + fflluusshhoouuttppuutt + If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss + below) and the fflluusshhoouuttppuutt character is typed, a + TELNET AO sequence (see sseenndd aaoo above) is sent to the + remote host. The initial value for the flush charac- + ter is taken to be the terminal's fflluusshh character. + + ffoorrww11 + + ffoorrww22 If TELNET is operating in LINEMODE, these are the + characters that, when typed, cause partial lines to be + forwarded to the remote system. The initial value for + the forwarding characters are taken from the termi- + nal's eol and eol2 characters. + + iinntteerrrruupptt + If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss + below) and the iinntteerrrruupptt character is typed, a TELNET + IP sequence (see sseenndd iipp above) is sent to the remote + host. The initial value for the interrupt character + is taken to be the terminal's iinnttrr character. + + kkiillll If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss + below), aanndd if tteellnneett is operating in ``character at a + time'' mode, then when this character is typed, a + TELNET EL sequence (see sseenndd eell above) is sent to the + remote system. The initial value for the kill charac- + ter is taken to be the terminal's kkiillll character. + + llnneexxtt If tteellnneett is operating in LINEMODE or ``old line by + line`` mode, then this character is taken to be the + terminal's llnneexxtt character. The initial value for the + lnext character is taken to be the terminal's llnneexxtt + character. + + qquuiitt If tteellnneett is in llooccaallcchhaarrss mode (see ttooggggllee llooccaallcchhaarrss + below) and the qquuiitt character is typed, a TELNET BRK + sequence (see sseenndd bbrrkk above) is sent to the remote + host. The initial value for the quit character is + taken to be the terminal's qquuiitt character. + + rreepprriinntt + If tteellnneett is operating in LINEMODE or ``old line by + line`` mode, then this character is taken to be the + terminal's rreepprriinntt character. The initial value for + the reprint character is taken to be the terminal's + rreepprriinntt character. + + rrllooggiinn This is the rlogin escape character. If set, the nor- + mal TELNET escape character is ignored unless it is + preceded by this character at the beginning of a line. + This character, at the beginning of a line followed by + a "." closes the connection; when followed by a ^Z it + suspends the telnet command. The initial state is to + disable the rlogin escape character. + + ssttaarrtt If the TELNET TOGGLE-FLOW-CONTROL option has been en- + abled, then this character is taken to be the termi- + nal's ssttaarrtt character. The initial value for the kill + character is taken to be the terminal's ssttaarrtt charac- + ter. + + ssttoopp If the TELNET TOGGLE-FLOW-CONTROL option has been en- + abled, then this character is taken to be the termi- + nal's ssttoopp character. The initial value for the kill + character is taken to be the terminal's ssttoopp charac- + ter. + + ssuusspp If tteellnneett is in llooccaallcchhaarrss mode, or LINEMODE is en- + abled, and the ssuussppeenndd character is typed, a TELNET + SUSP sequence (see sseenndd ssuusspp above) is sent to the re- + mote host. The initial value for the suspend charac- + ter is taken to be the terminal's ssuussppeenndd character. + + ttrraacceeffiillee + This is the file to which the output, caused by + nneettddaattaa or ooppttiioonn tracing being TRUE, will be written. + If it is set to ``--'', then tracing information will + be written to standard output (the default). + + wwoorrddeerraassee + If tteellnneett is operating in LINEMODE or ``old line by + line`` mode, then this character is taken to be the + terminal's wwoorrddeerraassee character. The initial value for + the worderase character is taken to be the terminal's + wwoorrddeerraassee character. + + ?? Displays the legal sseett (uunnsseett) commands. + + ssllcc _s_t_a_t_e The ssllcc command (Set Local Characters) is used to set or + change the state of the the special characters when the TELNET + LINEMODE option has been enabled. Special characters are + characters that get mapped to TELNET commands sequences (like + iipp or qquuiitt) or line editing characters (like eerraassee and kkiillll). + + + By default, the local special characters are exported. + + cchheecckk Verify the current settings for the current spe- + cial characters. The remote side is requested to + send all the current special character settings, + and if there are any discrepancies with the local + side, the local side will switch to the remote + value. + + eexxppoorrtt Switch to the local defaults for the special char- + acters. The local default characters are those of + the local terminal at the time when tteellnneett was + started. + + iimmppoorrtt Switch to the remote defaults for the special + characters. The remote default characters are + those of the remote system at the time when the + TELNET connection was established. + + ?? Prints out help information for the ssllcc command. + + ssttaattuuss Show the current status of tteellnneett. This includes the peer one + is connected to, as well as the current mode. + + ttooggggllee _a_r_g_u_m_e_n_t_s _._._. + Toggle (between TRUE and FALSE) various flags that control how + tteellnneett responds to events. These flags may be set explicitly + to TRUE or FALSE using the sseett and uunnsseett commands listed + above. More than one argument may be specified. The state of + these flags may be interrogated with the ddiissppllaayy command. + Valid arguments are: + + aauutthhddeebbuugg Turns on debugging information for the authenti- + cation code. + + aauuttoofflluusshh If aauuttoofflluusshh and llooccaallcchhaarrss are both TRUE, then + when the aaoo, or qquuiitt characters are recognized + (and transformed into TELNET sequences; see sseett + above for details), tteellnneett refuses to display + any data on the user's terminal until the remote + system acknowledges (via a TELNET TIMING MARK + option) that it has processed those TELNET se- + quences. The initial value for this toggle is + TRUE if the terminal user had not done an "stty + noflsh", otherwise FALSE (see stty(1)). + + aauuttooddeeccrryypptt When the TELNET ENCRYPT option is negotiated, by + default the actual encryption (decryption) of + the data stream does not start automatically. + The autoencrypt (autodecrypt) command states + that encryption of the output (input) stream + should be enabled as soon as possible. + + + Note: Because of export controls, the TELNET + ENCRYPT option is not supported outside the + United States and Canada. + + aauuttoollooggiinn If the remote side supports the TELNET + AUTHENTICATION option TELNET attempts to use it + to perform automatic authentication. If the + AUTHENTICATION option is not supported, the us- + er's login name are propagated through the + TELNET ENVIRON option. This command is the same + + + as specifying _a option on the ooppeenn command. + + aauuttoossyynncchh If aauuttoossyynncchh and llooccaallcchhaarrss are both TRUE, then + when either the iinnttrr or qquuiitt characters is typed + (see sseett above for descriptions of the iinnttrr and + qquuiitt characters), the resulting TELNET sequence + sent is followed by the TELNET SYNCH sequence. + This procedure sshhoouulldd cause the remote system to + begin throwing away all previously typed input + until both of the TELNET sequences have been + read and acted upon. The initial value of this + toggle is FALSE. + + bbiinnaarryy Enable or disable the TELNET BINARY option on + both input and output. + + iinnbbiinnaarryy Enable or disable the TELNET BINARY option on + input. + + oouuttbbiinnaarryy Enable or disable the TELNET BINARY option on + output. + + ccrrllff If this is TRUE, then carriage returns will be + sent as . If this is FALSE, then car- + riage returns will be send as . The + initial value for this toggle is FALSE. + + ccrrmmoodd Toggle carriage return mode. When this mode is + enabled, most carriage return characters re- + ceived from the remote host will be mapped into + a carriage return followed by a line feed. This + mode does not affect those characters typed by + the user, only those received from the remote + host. This mode is not very useful unless the + remote host only sends carriage return, but nev- + er line feed. The initial value for this toggle + is FALSE. + + ddeebbuugg Toggles socket level debugging (useful only to + the ssuuppeerr uusseerr). The initial value for this tog- + gle is FALSE. + + eennccddeebbuugg Turns on debugging information for the encryp- + tion code. + + llooccaallcchhaarrss If this is TRUE, then the fflluusshh, iinntteerrrruupptt, + qquuiitt, eerraassee, and kkiillll characters (see sseett above) + are recognized locally, and transformed into + (hopefully) appropriate TELNET control sequences + (respectively aaoo, iipp, bbrrkk, eecc, and eell; see sseenndd + above). The initial value for this toggle is + TRUE in ``old line by line'' mode, and FALSE in + ``character at a time'' mode. When the LINEMODE + option is enabled, the value of llooccaallcchhaarrss is + ignored, and assumed to always be TRUE. If + LINEMODE has ever been enabled, then qquuiitt is + sent as aabboorrtt, and eeooff aanndd are sent as eeooff aanndd + ssuusspp, see sseenndd above). + + nneettddaattaa Toggles the display of all network data (in hex- + adecimal format). The initial value for this + toggle is FALSE. + + ooppttiioonnss Toggles the display of some internal tteellnneett pro- + tocol processing (having to do with TELNET op- + tions). The initial value for this toggle is + + FALSE. + + pprreettttyydduummpp When the nneettddaattaa toggle is enabled, if + pprreettttyydduummpp is enabled the output from the + nneettddaattaa command will be formatted in a more user + readable format. Spaces are put between each + character in the output, and the beginning of + any TELNET escape sequence is preceded by a '*' + to aid in locating them. + + sskkiipprrcc When the skiprc toggle is TRUE, TELNET skips the + reading of the _._t_e_l_n_e_t_r_c file in the users home + directory when connections are opened. The ini- + tial value for this toggle is FALSE. + + tteerrmmddaattaa Toggles the display of all terminal data (in + hexadecimal format). The initial value for this + toggle is FALSE. + + vveerrbboossee__eennccrryypptt + When the vveerrbboossee__eennccrryypptt toggle is TRUE, TELNET + prints out a message each time encryption is en- + abled or disabled. The initial value for this + toggle is FALSE. Note: Because of export con- + trols, data encryption is not supported outside + of the United States and Canada. + + ?? Displays the legal ttooggggllee commands. + + zz Suspend tteellnneett. This command only works when the user is using + the csh(1). + + !! [_c_o_m_m_a_n_d] + Execute a single command in a subshell on the local system. + If ccoommmmaanndd is omitted, then an interactive subshell is in- + voked. + + ?? [_c_o_m_m_a_n_d] + Get help. With no arguments, tteellnneett prints a help summary. + If a command is specified, tteellnneett will print the help informa- + tion for just that command. + +EENNVVIIRROONNMMEENNTT + TTeellnneett uses at least the HOME, SHELL, DISPLAY, and TERM environment vari- + ables. Other environment variables may be propagated to the other side + via the TELNET ENVIRON option. + +FFIILLEESS + ~/.telnetrc user customized telnet startup values + +HHIISSTTOORRYY + The TTeellnneett command appeared in 4.2BSD. + +NNOOTTEESS + On some remote systems, echo has to be turned off manually when in ``old + line by line'' mode. + + In ``old line by line'' mode or LINEMODE the terminal's eeooff character is + only recognized (and sent to the remote system) when it is the first + character on a line. + +4.2 Berkeley Distribution June 1, 1994 11 diff --git a/appl/telnet/telnet/telnet.1 b/appl/telnet/telnet/telnet.1 new file mode 100644 index 000000000..b996fea3b --- /dev/null +++ b/appl/telnet/telnet/telnet.1 @@ -0,0 +1,1366 @@ +.\" Copyright (c) 1983, 1990, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)telnet.1 8.6 (Berkeley) 6/1/94 +.\" +.Dd June 1, 1994 +.Dt TELNET 1 +.Os BSD 4.2 +.Sh NAME +.Nm telnet +.Nd user interface to the +.Tn TELNET +protocol +.Sh SYNOPSIS +.Nm telnet +.Op Fl 8EFKLacdfrx +.Op Fl S Ar tos +.Op Fl X Ar authtype +.Op Fl e Ar escapechar +.Op Fl k Ar realm +.Op Fl l Ar user +.Op Fl n Ar tracefile +.Oo +.Ar host +.Op port +.Oc +.Sh DESCRIPTION +The +.Nm telnet +command +is used to communicate with another host using the +.Tn TELNET +protocol. +If +.Nm telnet +is invoked without the +.Ar host +argument, it enters command mode, +indicated by its prompt +.Pq Nm telnet\&> . +In this mode, it accepts and executes the commands listed below. +If it is invoked with arguments, it performs an +.Ic open +command with those arguments. +.Pp +Options: +.Bl -tag -width indent +.It Fl 8 +Specifies an 8-bit data path. This causes an attempt to +negotiate the +.Dv TELNET BINARY +option on both input and output. +.It Fl E +Stops any character from being recognized as an escape character. +.It Fl F +If Kerberos V5 authentication is being used, the +.Fl F +option allows the local credentials to be forwarded +to the remote system, including any credentials that +have already been forwarded into the local environment. +.It Fl K +Specifies no automatic login to the remote system. +.It Fl L +Specifies an 8-bit data path on output. This causes the +BINARY option to be negotiated on output. +.It Fl S Ar tos +Sets the IP type-of-service (TOS) option for the telnet +connection to the value +.Ar tos, +which can be a numeric TOS value +or, on systems that support it, a symbolic +TOS name found in the /etc/iptos file. +.It Fl X Ar atype +Disables the +.Ar atype +type of authentication. +.It Fl a +Attempt automatic login. +Currently, this sends the user name via the +.Ev USER +variable +of the +.Ev ENVIRON +option if supported by the remote system. +The name used is that of the current user as returned by +.Xr getlogin 2 +if it agrees with the current user ID, +otherwise it is the name associated with the user ID. +.It Fl c +Disables the reading of the user's +.Pa \&.telnetrc +file. (See the +.Ic toggle skiprc +command on this man page.) +.It Fl d +Sets the initial value of the +.Ic debug +toggle to +.Dv TRUE +.It Fl e Ar escape char +Sets the initial +.Nm +.Nm telnet +escape character to +.Ar escape char. +If +.Ar escape char +is omitted, then +there will be no escape character. +.It Fl f +If Kerberos V5 authentication is being used, the +.Fl f +option allows the local credentials to be forwarded to the remote system. +.ne 1i +.It Fl k Ar realm +If Kerberos authentication is being used, the +.Fl k +option requests that telnet obtain tickets for the remote host in +realm realm instead of the remote host's realm, as determined +by +.Xr krb_realmofhost 3 . +.It Fl l Ar user +When connecting to the remote system, if the remote system +understands the +.Ev ENVIRON +option, then +.Ar user +will be sent to the remote system as the value for the variable USER. +This option implies the +.Fl a +option. +This option may also be used with the +.Ic open +command. +.It Fl n Ar tracefile +Opens +.Ar tracefile +for recording trace information. +See the +.Ic set tracefile +command below. +.It Fl r +Specifies a user interface similar to +.Xr rlogin 1 . +In this +mode, the escape character is set to the tilde (~) character, +unless modified by the -e option. +.It Fl x +Turns on encryption of the data stream if possible. This +option is not available outside of the United States and +Canada. +.It Ar host +Indicates the official name, an alias, or the Internet address +of a remote host. +.It Ar port +Indicates a port number (address of an application). If a number is +not specified, the default +.Nm telnet +port is used. +.El +.Pp +When in rlogin mode, a line of the form ~. disconnects from the +remote host; ~ is the telnet escape character. +Similarly, the line ~^Z suspends the telnet session. +The line ~^] escapes to the normal telnet escape prompt. +.Pp +Once a connection has been opened, +.Nm telnet +will attempt to enable the +.Dv TELNET LINEMODE +option. +If this fails, then +.Nm telnet +will revert to one of two input modes: +either \*(Lqcharacter at a time\*(Rq +or \*(Lqold line by line\*(Rq +depending on what the remote system supports. +.Pp +When +.Dv LINEMODE +is enabled, character processing is done on the +local system, under the control of the remote system. When input +editing or character echoing is to be disabled, the remote system +will relay that information. The remote system will also relay +changes to any special characters that happen on the remote +system, so that they can take effect on the local system. +.Pp +In \*(Lqcharacter at a time\*(Rq mode, most +text typed is immediately sent to the remote host for processing. +.Pp +In \*(Lqold line by line\*(Rq mode, all text is echoed locally, +and (normally) only completed lines are sent to the remote host. +The \*(Lqlocal echo character\*(Rq (initially \*(Lq^E\*(Rq) may be used +to turn off and on the local echo +(this would mostly be used to enter passwords +without the password being echoed). +.Pp +If the +.Dv LINEMODE +option is enabled, or if the +.Ic localchars +toggle is +.Dv TRUE +(the default for \*(Lqold line by line\*(Lq; see below), +the user's +.Ic quit , +.Ic intr , +and +.Ic flush +characters are trapped locally, and sent as +.Tn TELNET +protocol sequences to the remote side. +If +.Dv LINEMODE +has ever been enabled, then the user's +.Ic susp +and +.Ic eof +are also sent as +.Tn TELNET +protocol sequences, +and +.Ic quit +is sent as a +.Dv TELNET ABORT +instead of +.Dv BREAK +There are options (see +.Ic toggle +.Ic autoflush +and +.Ic toggle +.Ic autosynch +below) +which cause this action to flush subsequent output to the terminal +(until the remote host acknowledges the +.Tn TELNET +sequence) and flush previous terminal input +(in the case of +.Ic quit +and +.Ic intr ) . +.Pp +While connected to a remote host, +.Nm telnet +command mode may be entered by typing the +.Nm telnet +\*(Lqescape character\*(Rq (initially \*(Lq^]\*(Rq). +When in command mode, the normal terminal editing conventions are available. +.Pp +The following +.Nm telnet +commands are available. +Only enough of each command to uniquely identify it need be typed +(this is also true for arguments to the +.Ic mode , +.Ic set , +.Ic toggle , +.Ic unset , +.Ic slc , +.Ic environ , +and +.Ic display +commands). +.Pp +.Bl -tag -width "mode type" +.It Ic auth Ar argument ... +The auth command manipulates the information sent through the +.Dv TELNET AUTHENTICATE +option. Valid arguments for the +auth command are as follows: +.Bl -tag -width "disable type" +.It Ic disable Ar type +Disables the specified type of authentication. To +obtain a list of available types, use the +.Ic auth disable \&? +command. +.It Ic enable Ar type +Enables the specified type of authentication. To +obtain a list of available types, use the +.Ic auth enable \&? +command. +.It Ic status +Lists the current status of the various types of +authentication. +.El +.It Ic close +Close a +.Tn TELNET +session and return to command mode. +.It Ic display Ar argument ... +Displays all, or some, of the +.Ic set +and +.Ic toggle +values (see below). +.It Ic encrypt Ar argument ... +The encrypt command manipulates the information sent through the +.Dv TELNET ENCRYPT +option. +.Pp +Note: Because of export controls, the +.Dv TELNET ENCRYPT +option is not supported outside of the United States and Canada. +.Pp +Valid arguments for the encrypt command are as follows: +.Bl -tag -width Ar +.It Ic disable Ar type Ic [input|output] +Disables the specified type of encryption. If you +omit the input and output, both input and output +are disabled. To obtain a list of available +types, use the +.Ic encrypt disable \&? +command. +.It Ic enable Ar type Ic [input|output] +Enables the specified type of encryption. If you +omit input and output, both input and output are +enabled. To obtain a list of available types, use the +.Ic encrypt enable \&? +command. +.It Ic input +This is the same as the +.Ic encrypt start input +command. +.It Ic -input +This is the same as the +.Ic encrypt stop input +command. +.It Ic output +This is the same as the +.Ic encrypt start output +command. +.It Ic -output +This is the same as the +.Ic encrypt stop output +command. +.It Ic start Ic [input|output] +Attempts to start encryption. If you omit +.Ic input +and +.Ic output, +both input and output are enabled. To +obtain a list of available types, use the +.Ic encrypt enable \&? +command. +.It Ic status +Lists the current status of encryption. +.It Ic stop Ic [input|output] +Stops encryption. If you omit input and output, +encryption is on both input and output. +.It Ic type Ar type +Sets the default type of encryption to be used +with later +.Ic encrypt start +or +.Ic encrypt stop +commands. +.El +.It Ic environ Ar arguments... +The +.Ic environ +command is used to manipulate the +the variables that my be sent through the +.Dv TELNET ENVIRON +option. +The initial set of variables is taken from the users +environment, with only the +.Ev DISPLAY +and +.Ev PRINTER +variables being exported by default. +The +.Ev USER +variable is also exported if the +.Fl a +or +.Fl l +options are used. +.br +Valid arguments for the +.Ic environ +command are: +.Bl -tag -width Fl +.It Ic define Ar variable value +Define the variable +.Ar variable +to have a value of +.Ar value. +Any variables defined by this command are automatically exported. +The +.Ar value +may be enclosed in single or double quotes so +that tabs and spaces may be included. +.It Ic undefine Ar variable +Remove +.Ar variable +from the list of environment variables. +.It Ic export Ar variable +Mark the variable +.Ar variable +to be exported to the remote side. +.It Ic unexport Ar variable +Mark the variable +.Ar variable +to not be exported unless +explicitly asked for by the remote side. +.It Ic list +List the current set of environment variables. +Those marked with a +.Cm * +will be sent automatically, +other variables will only be sent if explicitly requested. +.It Ic \&? +Prints out help information for the +.Ic environ +command. +.El +.It Ic logout +Sends the +.Dv TELNET LOGOUT +option to the remote side. +This command is similar to a +.Ic close +command; however, if the remote side does not support the +.Dv LOGOUT +option, nothing happens. +If, however, the remote side does support the +.Dv LOGOUT +option, this command should cause the remote side to close the +.Tn TELNET +connection. +If the remote side also supports the concept of +suspending a user's session for later reattachment, +the logout argument indicates that you +should terminate the session immediately. +.It Ic mode Ar type +.Ar Type +is one of several options, depending on the state of the +.Tn TELNET +session. +The remote host is asked for permission to go into the requested mode. +If the remote host is capable of entering that mode, the requested +mode will be entered. +.Bl -tag -width Ar +.It Ic character +Disable the +.Dv TELNET LINEMODE +option, or, if the remote side does not understand the +.Dv LINEMODE +option, then enter \*(Lqcharacter at a time\*(Lq mode. +.It Ic line +Enable the +.Dv TELNET LINEMODE +option, or, if the remote side does not understand the +.Dv LINEMODE +option, then attempt to enter \*(Lqold-line-by-line\*(Lq mode. +.It Ic isig Pq Ic \-isig +Attempt to enable (disable) the +.Dv TRAPSIG +mode of the +.Dv LINEMODE +option. +This requires that the +.Dv LINEMODE +option be enabled. +.It Ic edit Pq Ic \-edit +Attempt to enable (disable) the +.Dv EDIT +mode of the +.Dv LINEMODE +option. +This requires that the +.Dv LINEMODE +option be enabled. +.It Ic softtabs Pq Ic \-softtabs +Attempt to enable (disable) the +.Dv SOFT_TAB +mode of the +.Dv LINEMODE +option. +This requires that the +.Dv LINEMODE +option be enabled. +.ne 1i +.It Ic litecho Pq Ic \-litecho +Attempt to enable (disable) the +.Dv LIT_ECHO +mode of the +.Dv LINEMODE +option. +This requires that the +.Dv LINEMODE +option be enabled. +.It Ic \&? +Prints out help information for the +.Ic mode +command. +.El +.It Xo +.Ic open Ar host +.Oo Op Fl l +.Ar user +.Oc Ns Oo Fl +.Ar port Oc +.Xc +Open a connection to the named host. +If no port number +is specified, +.Nm telnet +will attempt to contact a +.Tn TELNET +server at the default port. +The host specification may be either a host name (see +.Xr hosts 5 ) +or an Internet address specified in the \*(Lqdot notation\*(Rq (see +.Xr inet 3 ) . +The +.Op Fl l +option may be used to specify the user name +to be passed to the remote system via the +.Ev ENVIRON +option. +When connecting to a non-standard port, +.Nm telnet +omits any automatic initiation of +.Tn TELNET +options. When the port number is preceded by a minus sign, +the initial option negotiation is done. +After establishing a connection, the file +.Pa \&.telnetrc +in the +users home directory is opened. Lines beginning with a # are +comment lines. Blank lines are ignored. Lines that begin +without white space are the start of a machine entry. The +first thing on the line is the name of the machine that is +being connected to. The rest of the line, and successive +lines that begin with white space are assumed to be +.Nm telnet +commands and are processed as if they had been typed +in manually to the +.Nm telnet +command prompt. +.It Ic quit +Close any open +.Tn TELNET +session and exit +.Nm telnet . +An end of file (in command mode) will also close a session and exit. +.It Ic send Ar arguments +Sends one or more special character sequences to the remote host. +The following are the arguments which may be specified +(more than one argument may be specified at a time): +.Pp +.Bl -tag -width escape +.It Ic abort +Sends the +.Dv TELNET ABORT +(Abort +processes) +sequence. +.It Ic ao +Sends the +.Dv TELNET AO +(Abort Output) sequence, which should cause the remote system to flush +all output +.Em from +the remote system +.Em to +the user's terminal. +.It Ic ayt +Sends the +.Dv TELNET AYT +(Are You There) +sequence, to which the remote system may or may not choose to respond. +.It Ic brk +Sends the +.Dv TELNET BRK +(Break) sequence, which may have significance to the remote +system. +.It Ic ec +Sends the +.Dv TELNET EC +(Erase Character) +sequence, which should cause the remote system to erase the last character +entered. +.It Ic el +Sends the +.Dv TELNET EL +(Erase Line) +sequence, which should cause the remote system to erase the line currently +being entered. +.It Ic eof +Sends the +.Dv TELNET EOF +(End Of File) +sequence. +.It Ic eor +Sends the +.Dv TELNET EOR +(End of Record) +sequence. +.It Ic escape +Sends the current +.Nm telnet +escape character (initially \*(Lq^\*(Rq). +.It Ic ga +Sends the +.Dv TELNET GA +(Go Ahead) +sequence, which likely has no significance to the remote system. +.It Ic getstatus +If the remote side supports the +.Dv TELNET STATUS +command, +.Ic getstatus +will send the subnegotiation to request that the server send +its current option status. +.ne 1i +.It Ic ip +Sends the +.Dv TELNET IP +(Interrupt Process) sequence, which should cause the remote +system to abort the currently running process. +.It Ic nop +Sends the +.Dv TELNET NOP +(No OPeration) +sequence. +.It Ic susp +Sends the +.Dv TELNET SUSP +(SUSPend process) +sequence. +.It Ic synch +Sends the +.Dv TELNET SYNCH +sequence. +This sequence causes the remote system to discard all previously typed +(but not yet read) input. +This sequence is sent as +.Tn TCP +urgent +data (and may not work if the remote system is a +.Bx 4.2 +system -- if +it doesn't work, a lower case \*(Lqr\*(Rq may be echoed on the terminal). +.It Ic do Ar cmd +.It Ic dont Ar cmd +.It Ic will Ar cmd +.It Ic wont Ar cmd +Sends the +.Dv TELNET DO +.Ar cmd +sequence. +.Ar Cmd +can be either a decimal number between 0 and 255, +or a symbolic name for a specific +.Dv TELNET +command. +.Ar Cmd +can also be either +.Ic help +or +.Ic \&? +to print out help information, including +a list of known symbolic names. +.It Ic \&? +Prints out help information for the +.Ic send +command. +.El +.It Ic set Ar argument value +.It Ic unset Ar argument value +The +.Ic set +command will set any one of a number of +.Nm telnet +variables to a specific value or to +.Dv TRUE . +The special value +.Ic off +turns off the function associated with +the variable, this is equivalent to using the +.Ic unset +command. +The +.Ic unset +command will disable or set to +.Dv FALSE +any of the specified functions. +The values of variables may be interrogated with the +.Ic display +command. +The variables which may be set or unset, but not toggled, are +listed here. In addition, any of the variables for the +.Ic toggle +command may be explicitly set or unset using +the +.Ic set +and +.Ic unset +commands. +.Bl -tag -width escape +.It Ic ayt +If +.Tn TELNET +is in localchars mode, or +.Dv LINEMODE +is enabled, and the status character is typed, a +.Dv TELNET AYT +sequence (see +.Ic send ayt +preceding) is sent to the +remote host. The initial value for the "Are You There" +character is the terminal's status character. +.It Ic echo +This is the value (initially \*(Lq^E\*(Rq) which, when in +\*(Lqline by line\*(Rq mode, toggles between doing local echoing +of entered characters (for normal processing), and suppressing +echoing of entered characters (for entering, say, a password). +.It Ic eof +If +.Nm telnet +is operating in +.Dv LINEMODE +or \*(Lqold line by line\*(Rq mode, entering this character +as the first character on a line will cause this character to be +sent to the remote system. +The initial value of the eof character is taken to be the terminal's +.Ic eof +character. +.It Ic erase +If +.Nm telnet +is in +.Ic localchars +mode (see +.Ic toggle +.Ic localchars +below), +.Sy and +if +.Nm telnet +is operating in \*(Lqcharacter at a time\*(Rq mode, then when this +character is typed, a +.Dv TELNET EC +sequence (see +.Ic send +.Ic ec +above) +is sent to the remote system. +The initial value for the erase character is taken to be +the terminal's +.Ic erase +character. +.It Ic escape +This is the +.Nm telnet +escape character (initially \*(Lq^[\*(Rq) which causes entry +into +.Nm telnet +command mode (when connected to a remote system). +.It Ic flushoutput +If +.Nm telnet +is in +.Ic localchars +mode (see +.Ic toggle +.Ic localchars +below) +and the +.Ic flushoutput +character is typed, a +.Dv TELNET AO +sequence (see +.Ic send +.Ic ao +above) +is sent to the remote host. +The initial value for the flush character is taken to be +the terminal's +.Ic flush +character. +.It Ic forw1 +.It Ic forw2 +If +.Tn TELNET +is operating in +.Dv LINEMODE , +these are the +characters that, when typed, cause partial lines to be +forwarded to the remote system. The initial value for +the forwarding characters are taken from the terminal's +eol and eol2 characters. +.It Ic interrupt +If +.Nm telnet +is in +.Ic localchars +mode (see +.Ic toggle +.Ic localchars +below) +and the +.Ic interrupt +character is typed, a +.Dv TELNET IP +sequence (see +.Ic send +.Ic ip +above) +is sent to the remote host. +The initial value for the interrupt character is taken to be +the terminal's +.Ic intr +character. +.It Ic kill +If +.Nm telnet +is in +.Ic localchars +mode (see +.Ic toggle +.Ic localchars +below), +.Ic and +if +.Nm telnet +is operating in \*(Lqcharacter at a time\*(Rq mode, then when this +character is typed, a +.Dv TELNET EL +sequence (see +.Ic send +.Ic el +above) +is sent to the remote system. +The initial value for the kill character is taken to be +the terminal's +.Ic kill +character. +.It Ic lnext +If +.Nm telnet +is operating in +.Dv LINEMODE +or \*(Lqold line by line\*(Lq mode, then this character is taken to +be the terminal's +.Ic lnext +character. +The initial value for the lnext character is taken to be +the terminal's +.Ic lnext +character. +.It Ic quit +If +.Nm telnet +is in +.Ic localchars +mode (see +.Ic toggle +.Ic localchars +below) +and the +.Ic quit +character is typed, a +.Dv TELNET BRK +sequence (see +.Ic send +.Ic brk +above) +is sent to the remote host. +The initial value for the quit character is taken to be +the terminal's +.Ic quit +character. +.It Ic reprint +If +.Nm telnet +is operating in +.Dv LINEMODE +or \*(Lqold line by line\*(Lq mode, then this character is taken to +be the terminal's +.Ic reprint +character. +The initial value for the reprint character is taken to be +the terminal's +.Ic reprint +character. +.It Ic rlogin +This is the rlogin escape character. +If set, the normal +.Tn TELNET +escape character is ignored unless it is +preceded by this character at the beginning of a line. +This character, at the beginning of a line followed by +a "." closes the connection; when followed by a ^Z it +suspends the telnet command. The initial state is to +disable the rlogin escape character. +.It Ic start +If the +.Dv TELNET TOGGLE-FLOW-CONTROL +option has been enabled, +then this character is taken to +be the terminal's +.Ic start +character. +The initial value for the kill character is taken to be +the terminal's +.Ic start +character. +.It Ic stop +If the +.Dv TELNET TOGGLE-FLOW-CONTROL +option has been enabled, +then this character is taken to +be the terminal's +.Ic stop +character. +The initial value for the kill character is taken to be +the terminal's +.Ic stop +character. +.It Ic susp +If +.Nm telnet +is in +.Ic localchars +mode, or +.Dv LINEMODE +is enabled, and the +.Ic suspend +character is typed, a +.Dv TELNET SUSP +sequence (see +.Ic send +.Ic susp +above) +is sent to the remote host. +The initial value for the suspend character is taken to be +the terminal's +.Ic suspend +character. +.ne 1i +.It Ic tracefile +This is the file to which the output, caused by +.Ic netdata +or +.Ic option +tracing being +.Dv TRUE , +will be written. If it is set to +.Dq Fl , +then tracing information will be written to standard output (the default). +.It Ic worderase +If +.Nm telnet +is operating in +.Dv LINEMODE +or \*(Lqold line by line\*(Lq mode, then this character is taken to +be the terminal's +.Ic worderase +character. +The initial value for the worderase character is taken to be +the terminal's +.Ic worderase +character. +.It Ic \&? +Displays the legal +.Ic set +.Pq Ic unset +commands. +.El +.It Ic slc Ar state +The +.Ic slc +command (Set Local Characters) is used to set +or change the state of the the special +characters when the +.Dv TELNET LINEMODE +option has +been enabled. Special characters are characters that get +mapped to +.Tn TELNET +commands sequences (like +.Ic ip +or +.Ic quit ) +or line editing characters (like +.Ic erase +and +.Ic kill ) . +By default, the local special characters are exported. +.Bl -tag -width Fl +.It Ic check +Verify the current settings for the current special characters. +The remote side is requested to send all the current special +character settings, and if there are any discrepancies with +the local side, the local side will switch to the remote value. +.It Ic export +Switch to the local defaults for the special characters. The +local default characters are those of the local terminal at +the time when +.Nm telnet +was started. +.It Ic import +Switch to the remote defaults for the special characters. +The remote default characters are those of the remote system +at the time when the +.Tn TELNET +connection was established. +.It Ic \&? +Prints out help information for the +.Ic slc +command. +.El +.It Ic status +Show the current status of +.Nm telnet . +This includes the peer one is connected to, as well +as the current mode. +.It Ic toggle Ar arguments ... +Toggle (between +.Dv TRUE +and +.Dv FALSE ) +various flags that control how +.Nm telnet +responds to events. +These flags may be set explicitly to +.Dv TRUE +or +.Dv FALSE +using the +.Ic set +and +.Ic unset +commands listed above. +More than one argument may be specified. +The state of these flags may be interrogated with the +.Ic display +command. +Valid arguments are: +.Bl -tag -width Ar +.It Ic authdebug +Turns on debugging information for the authentication code. +.It Ic autoflush +If +.Ic autoflush +and +.Ic localchars +are both +.Dv TRUE , +then when the +.Ic ao , +or +.Ic quit +characters are recognized (and transformed into +.Tn TELNET +sequences; see +.Ic set +above for details), +.Nm telnet +refuses to display any data on the user's terminal +until the remote system acknowledges (via a +.Dv TELNET TIMING MARK +option) +that it has processed those +.Tn TELNET +sequences. +The initial value for this toggle is +.Dv TRUE +if the terminal user had not +done an "stty noflsh", otherwise +.Dv FALSE +(see +.Xr stty 1 ) . +.It Ic autodecrypt +When the +.Dv TELNET ENCRYPT +option is negotiated, by +default the actual encryption (decryption) of the data +stream does not start automatically. The autoencrypt +(autodecrypt) command states that encryption of the +output (input) stream should be enabled as soon as +possible. +.sp +.Pp +Note: Because of export controls, the +.Dv TELNET ENCRYPT +option is not supported outside the United States and Canada. +.It Ic autologin +If the remote side supports the +.Dv TELNET AUTHENTICATION +option +.Tn TELNET +attempts to use it to perform automatic authentication. If the +.Dv AUTHENTICATION +option is not supported, the user's login +name are propagated through the +.Dv TELNET ENVIRON +option. +This command is the same as specifying +.Ar a +option on the +.Ic open +command. +.It Ic autosynch +If +.Ic autosynch +and +.Ic localchars +are both +.Dv TRUE , +then when either the +.Ic intr +or +.Ic quit +characters is typed (see +.Ic set +above for descriptions of the +.Ic intr +and +.Ic quit +characters), the resulting +.Tn TELNET +sequence sent is followed by the +.Dv TELNET SYNCH +sequence. +This procedure +.Ic should +cause the remote system to begin throwing away all previously +typed input until both of the +.Tn TELNET +sequences have been read and acted upon. +The initial value of this toggle is +.Dv FALSE . +.It Ic binary +Enable or disable the +.Dv TELNET BINARY +option on both input and output. +.It Ic inbinary +Enable or disable the +.Dv TELNET BINARY +option on input. +.It Ic outbinary +Enable or disable the +.Dv TELNET BINARY +option on output. +.It Ic crlf +If this is +.Dv TRUE , +then carriage returns will be sent as +.Li . +If this is +.Dv FALSE , +then carriage returns will be send as +.Li . +The initial value for this toggle is +.Dv FALSE . +.It Ic crmod +Toggle carriage return mode. +When this mode is enabled, most carriage return characters received from +the remote host will be mapped into a carriage return followed by +a line feed. +This mode does not affect those characters typed by the user, only +those received from the remote host. +This mode is not very useful unless the remote host +only sends carriage return, but never line feed. +The initial value for this toggle is +.Dv FALSE . +.It Ic debug +Toggles socket level debugging (useful only to the +.Ic super user ) . +The initial value for this toggle is +.Dv FALSE . +.It Ic encdebug +Turns on debugging information for the encryption code. +.It Ic localchars +If this is +.Dv TRUE , +then the +.Ic flush , +.Ic interrupt , +.Ic quit , +.Ic erase , +and +.Ic kill +characters (see +.Ic set +above) are recognized locally, and transformed into (hopefully) appropriate +.Tn TELNET +control sequences +(respectively +.Ic ao , +.Ic ip , +.Ic brk , +.Ic ec , +and +.Ic el ; +see +.Ic send +above). +The initial value for this toggle is +.Dv TRUE +in \*(Lqold line by line\*(Rq mode, +and +.Dv FALSE +in \*(Lqcharacter at a time\*(Rq mode. +When the +.Dv LINEMODE +option is enabled, the value of +.Ic localchars +is ignored, and assumed to always be +.Dv TRUE . +If +.Dv LINEMODE +has ever been enabled, then +.Ic quit +is sent as +.Ic abort , +and +.Ic eof and +.B suspend +are sent as +.Ic eof and +.Ic susp , +see +.Ic send +above). +.It Ic netdata +Toggles the display of all network data (in hexadecimal format). +The initial value for this toggle is +.Dv FALSE . +.It Ic options +Toggles the display of some internal +.Nm telnet +protocol processing (having to do with +.Tn TELNET +options). +The initial value for this toggle is +.Dv FALSE . +.ne 1i +.It Ic prettydump +When the +.Ic netdata +toggle is enabled, if +.Ic prettydump +is enabled the output from the +.Ic netdata +command will be formatted in a more user readable format. +Spaces are put between each character in the output, and the +beginning of any +.Tn TELNET +escape sequence is preceded by a '*' to aid in locating them. +.It Ic skiprc +When the skiprc toggle is +.Dv TRUE , +.Tn TELNET +skips the reading of the +.Pa \&.telnetrc +file in the users home +directory when connections are opened. The initial +value for this toggle is +.Dv FALSE. +.It Ic termdata +Toggles the display of all terminal data (in hexadecimal format). +The initial value for this toggle is +.Dv FALSE . +.It Ic verbose_encrypt +When the +.Ic verbose_encrypt +toggle is +.Dv TRUE , +.Tn TELNET +prints out a message each time encryption is enabled or +disabled. The initial value for this toggle is +.Dv FALSE. +Note: Because of export controls, data encryption +is not supported outside of the United States and Canada. +.It Ic \&? +Displays the legal +.Ic toggle +commands. +.El +.It Ic z +Suspend +.Nm telnet . +This command only works when the user is using the +.Xr csh 1 . +.It Ic \&! Op Ar command +Execute a single command in a subshell on the local +system. If +.Ic command +is omitted, then an interactive +subshell is invoked. +.It Ic \&? Op Ar command +Get help. With no arguments, +.Nm telnet +prints a help summary. +If a command is specified, +.Nm telnet +will print the help information for just that command. +.El +.Sh ENVIRONMENT +.Nm Telnet +uses at least the +.Ev HOME , +.Ev SHELL , +.Ev DISPLAY , +and +.Ev TERM +environment variables. +Other environment variables may be propagated +to the other side via the +.Dv TELNET ENVIRON +option. +.Sh FILES +.Bl -tag -width ~/.telnetrc -compact +.It Pa ~/.telnetrc +user customized telnet startup values +.El +.Sh HISTORY +The +.Nm Telnet +command appeared in +.Bx 4.2 . +.Sh NOTES +.Pp +On some remote systems, echo has to be turned off manually when in +\*(Lqold line by line\*(Rq mode. +.Pp +In \*(Lqold line by line\*(Rq mode or +.Dv LINEMODE +the terminal's +.Ic eof +character is only recognized (and sent to the remote system) +when it is the first character on a line. diff --git a/appl/telnet/telnet/tn3270.c b/appl/telnet/telnet/tn3270.c new file mode 100644 index 000000000..a75cd1ecb --- /dev/null +++ b/appl/telnet/telnet/tn3270.c @@ -0,0 +1,411 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +static char sccsid[] = "@(#)tn3270.c 8.2 (Berkeley) 5/30/95"; +#endif /* not lint */ + +#include +#include + +#include "general.h" + +#include "defines.h" +#include "ring.h" +#include "externs.h" +#include "fdset.h" + +#if defined(TN3270) + +#include "../ctlr/screen.h" +#include "../general/globals.h" + +#include "../sys_curses/telextrn.h" +#include "../ctlr/externs.h" + +#if defined(unix) +int + HaveInput, /* There is input available to scan */ + cursesdata, /* Do we dump curses data? */ + sigiocount; /* Number of times we got a SIGIO */ + +char tline[200]; +char *transcom = 0; /* transparent mode command (default: none) */ +#endif /* defined(unix) */ + +char Ibuf[8*BUFSIZ], *Ifrontp, *Ibackp; + +static char sb_terminal[] = { IAC, SB, + TELOPT_TTYPE, TELQUAL_IS, + 'I', 'B', 'M', '-', '3', '2', '7', '8', '-', '2', + IAC, SE }; +#define SBTERMMODEL 13 + +static int + Sent3270TerminalType; /* Have we said we are a 3270? */ + +#endif /* defined(TN3270) */ + + + void +init_3270() +{ +#if defined(TN3270) +#if defined(unix) + HaveInput = 0; + sigiocount = 0; +#endif /* defined(unix) */ + Sent3270TerminalType = 0; + Ifrontp = Ibackp = Ibuf; + init_ctlr(); /* Initialize some things */ + init_keyboard(); + init_screen(); + init_system(); +#endif /* defined(TN3270) */ +} + + +#if defined(TN3270) + +/* + * DataToNetwork - queue up some data to go to network. If "done" is set, + * then when last byte is queued, we add on an IAC EOR sequence (so, + * don't call us with "done" until you want that done...) + * + * We actually do send all the data to the network buffer, since our + * only client needs for us to do that. + */ + + int +DataToNetwork(buffer, count, done) + register char *buffer; /* where the data is */ + register int count; /* how much to send */ + int done; /* is this the last of a logical block */ +{ + register int loop, c; + int origCount; + + origCount = count; + + while (count) { + /* If not enough room for EORs, IACs, etc., wait */ + if (NETROOM() < 6) { + fd_set o; + + FD_ZERO(&o); + netflush(); + while (NETROOM() < 6) { + FD_SET(net, &o); + (void) select(net+1, (fd_set *) 0, &o, (fd_set *) 0, + (struct timeval *) 0); + netflush(); + } + } + c = ring_empty_count(&netoring); + if (c > count) { + c = count; + } + loop = c; + while (loop) { + if (((unsigned char)*buffer) == IAC) { + break; + } + buffer++; + loop--; + } + if ((c = c-loop)) { + ring_supply_data(&netoring, buffer-c, c); + count -= c; + } + if (loop) { + NET2ADD(IAC, IAC); + count--; + buffer++; + } + } + + if (done) { + NET2ADD(IAC, EOR); + netflush(); /* try to move along as quickly as ... */ + } + return(origCount - count); +} + + +#if defined(unix) + void +inputAvailable(signo) + int signo; +{ + HaveInput = 1; + sigiocount++; +} +#endif /* defined(unix) */ + + void +outputPurge() +{ + (void) ttyflush(1); +} + + +/* + * The following routines are places where the various tn3270 + * routines make calls into telnet.c. + */ + +/* + * DataToTerminal - queue up some data to go to terminal. + * + * Note: there are people who call us and depend on our processing + * *all* the data at one time (thus the select). + */ + + int +DataToTerminal(buffer, count) + register char *buffer; /* where the data is */ + register int count; /* how much to send */ +{ + register int c; + int origCount; + + origCount = count; + + while (count) { + if (TTYROOM() == 0) { +#if defined(unix) + fd_set o; + + FD_ZERO(&o); +#endif /* defined(unix) */ + (void) ttyflush(0); + while (TTYROOM() == 0) { +#if defined(unix) + FD_SET(tout, &o); + (void) select(tout+1, (fd_set *) 0, &o, (fd_set *) 0, + (struct timeval *) 0); +#endif /* defined(unix) */ + (void) ttyflush(0); + } + } + c = TTYROOM(); + if (c > count) { + c = count; + } + ring_supply_data(&ttyoring, buffer, c); + count -= c; + buffer += c; + } + return(origCount); +} + + +/* + * Push3270 - Try to send data along the 3270 output (to screen) direction. + */ + + int +Push3270() +{ + int save = ring_full_count(&netiring); + + if (save) { + if (Ifrontp+save > Ibuf+sizeof Ibuf) { + if (Ibackp != Ibuf) { + memmove(Ibuf, Ibackp, Ifrontp-Ibackp); + Ifrontp -= (Ibackp-Ibuf); + Ibackp = Ibuf; + } + } + if (Ifrontp+save < Ibuf+sizeof Ibuf) { + (void)telrcv(); + } + } + return save != ring_full_count(&netiring); +} + + +/* + * Finish3270 - get the last dregs of 3270 data out to the terminal + * before quitting. + */ + + void +Finish3270() +{ + while (Push3270() || !DoTerminalOutput()) { +#if defined(unix) + HaveInput = 0; +#endif /* defined(unix) */ + ; + } +} + + +/* StringToTerminal - output a null terminated string to the terminal */ + + void +StringToTerminal(s) + char *s; +{ + int count; + + count = strlen(s); + if (count) { + (void) DataToTerminal(s, count); /* we know it always goes... */ + } +} + + +#if ((!defined(NOT43)) || defined(PUTCHAR)) +/* _putchar - output a single character to the terminal. This name is so that + * curses(3x) can call us to send out data. + */ + + void +_putchar(c) + char c; +{ +#if defined(sun) /* SunOS 4.0 bug */ + c &= 0x7f; +#endif /* defined(sun) */ + if (cursesdata) { + Dump('>', &c, 1); + } + if (!TTYROOM()) { + (void) DataToTerminal(&c, 1); + } else { + TTYADD(c); + } +} +#endif /* ((!defined(NOT43)) || defined(PUTCHAR)) */ + + void +SetIn3270() +{ + if (Sent3270TerminalType && my_want_state_is_will(TELOPT_BINARY) + && my_want_state_is_do(TELOPT_BINARY) && !donebinarytoggle) { + if (!In3270) { + In3270 = 1; + Init3270(); /* Initialize 3270 functions */ + /* initialize terminal key mapping */ + InitTerminal(); /* Start terminal going */ + setconnmode(0); + } + } else { + if (In3270) { + StopScreen(1); + In3270 = 0; + Stop3270(); /* Tell 3270 we aren't here anymore */ + setconnmode(0); + } + } +} + +/* + * tn3270_ttype() + * + * Send a response to a terminal type negotiation. + * + * Return '0' if no more responses to send; '1' if a response sent. + */ + + int +tn3270_ttype() +{ + /* + * Try to send a 3270 type terminal name. Decide which one based + * on the format of our screen, and (in the future) color + * capaiblities. + */ + InitTerminal(); /* Sets MaxNumberColumns, MaxNumberLines */ + if ((MaxNumberLines >= 24) && (MaxNumberColumns >= 80)) { + Sent3270TerminalType = 1; + if ((MaxNumberLines >= 27) && (MaxNumberColumns >= 132)) { + MaxNumberLines = 27; + MaxNumberColumns = 132; + sb_terminal[SBTERMMODEL] = '5'; + } else if (MaxNumberLines >= 43) { + MaxNumberLines = 43; + MaxNumberColumns = 80; + sb_terminal[SBTERMMODEL] = '4'; + } else if (MaxNumberLines >= 32) { + MaxNumberLines = 32; + MaxNumberColumns = 80; + sb_terminal[SBTERMMODEL] = '3'; + } else { + MaxNumberLines = 24; + MaxNumberColumns = 80; + sb_terminal[SBTERMMODEL] = '2'; + } + NumberLines = 24; /* before we start out... */ + NumberColumns = 80; + ScreenSize = NumberLines*NumberColumns; + if ((MaxNumberLines*MaxNumberColumns) > MAXSCREENSIZE) { + ExitString("Programming error: MAXSCREENSIZE too small.\n", + 1); + /*NOTREACHED*/ + } + printsub('>', sb_terminal+2, sizeof sb_terminal-2); + ring_supply_data(&netoring, sb_terminal, sizeof sb_terminal); + return 1; + } else { + return 0; + } +} + +#if defined(unix) + int +settranscom(argc, argv) + int argc; + char *argv[]; +{ + int i; + + if (argc == 1 && transcom) { + transcom = 0; + } + if (argc == 1) { + return 1; + } + transcom = tline; + (void) strcpy(transcom, argv[1]); + for (i = 2; i < argc; ++i) { + (void) strcat(transcom, " "); + (void) strcat(transcom, argv[i]); + } + return 1; +} +#endif /* defined(unix) */ + +#endif /* defined(TN3270) */ diff --git a/appl/telnet/telnet/types.h b/appl/telnet/telnet/types.h new file mode 100644 index 000000000..191d311fd --- /dev/null +++ b/appl/telnet/telnet/types.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 1988, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)types.h 8.1 (Berkeley) 6/6/93 + */ + +typedef struct { + char *modedescriptions; + char modetype; +} Modelist; + +extern Modelist modelist[]; + +typedef struct { + int + system, /* what the current time is */ + echotoggle, /* last time user entered echo character */ + modenegotiated, /* last time operating mode negotiated */ + didnetreceive, /* last time we read data from network */ + gotDM; /* when did we last see a data mark */ +} Clocks; + +extern Clocks clocks; diff --git a/appl/telnet/telnetd/Makefile.4.4 b/appl/telnet/telnetd/Makefile.4.4 new file mode 100644 index 000000000..4b1d5302e --- /dev/null +++ b/appl/telnet/telnetd/Makefile.4.4 @@ -0,0 +1,36 @@ +# @(#)Makefile 8.2 (Berkeley) 12/15/93 + +PROG= telnetd +CFLAGS+=-DLINEMODE -DKLUDGELINEMODE -DUSE_TERMIO -DDIAGNOSTICS +CFLAGS+=-DOLD_ENVIRON -DENV_HACK +CFLAGS+=-DAUTHENTICATION -DENCRYPTION -I${.CURDIR}/../../lib +SRCS= authenc.c global.c slc.c state.c sys_term.c telnetd.c \ + termstat.c utility.c +DPADD= ${LIBUTIL} ${LIBTERM} +LDADD= -lutil -ltermcap -ltelnet +LDADD+= -lkrb -ldes +MAN8= telnetd.0 + +# These are the sources that have encryption stuff in them. +CRYPT_SRC= authenc.c ext.h state.c telnetd.c termstat.c +CRYPT_SRC+= utility.c Makefile +NOCRYPT_DIR=${.CURDIR}/Nocrypt + +.include + +nocrypt: +#ifdef ENCRYPTION + @for i in ${CRYPT_SRC}; do \ + if [ ! -d ${NOCRYPT_DIR} ]; then \ + echo Creating subdirectory ${NOCRYPT_DIR}; \ + mkdir ${NOCRYPT_DIR}; \ + fi; \ + echo ${NOCRYPT_DIR}/$$i; \ + unifdef -UENCRYPTION ${.CURDIR}/$$i | \ + sed "s/ || defined(ENCRYPTION)//" > ${NOCRYPT_DIR}/$$i; \ + done + +placeholder: +#else /* ENCRYPTION */ + @echo "Encryption code already removed." +#endif /* ENCRYPTION */ diff --git a/appl/telnet/telnetd/Makefile.ORIG b/appl/telnet/telnetd/Makefile.ORIG new file mode 100644 index 000000000..46597306c --- /dev/null +++ b/appl/telnet/telnetd/Makefile.ORIG @@ -0,0 +1,45 @@ +# +# Copyright (c) 1991 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted provided +# that: (1) source distributions retain this entire copyright notice and +# comment, and (2) distributions including binaries display the following +# acknowledgement: ``This product includes software developed by the +# University of California, Berkeley and its contributors'' in the +# documentation or other materials provided with the distribution and in +# all advertising materials mentioning features or use of this software. +# Neither the name of the University nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)Makefile 5.5 (Berkeley) 3/1/91 +# + +# +# Everything happens in ../Makefile.config and Makefile.generic +# +SHELL=/bin/sh + +all: + @-if test -f ../Config.local; \ + then \ + echo make -f ../Config.local WHAT=${WHAT} CC="${CC}"; \ + make -f ../Config.local WHAT=${WHAT} CC="${CC}"; \ + else \ + echo make -f ../Config.generic WHAT=${WHAT} CC="${CC}"; \ + make -f ../Config.generic WHAT=${WHAT} CC="${CC}"; \ + fi + +.DEFAULT: + @-if test -f ../Config.local; \ + then \ + echo make -f ../Config.local WHAT=${WHAT} CC="${CC}" $@; \ + make -f ../Config.local WHAT=${WHAT} CC="${CC}" $@; \ + else \ + echo make -f ../Config.generic WHAT=${WHAT} CC="${CC}" $@; \ + make -f ../Config.generic WHAT=${WHAT} CC="${CC}" $@; \ + fi diff --git a/appl/telnet/telnetd/Makefile.generic b/appl/telnet/telnetd/Makefile.generic new file mode 100644 index 000000000..a40845d9f --- /dev/null +++ b/appl/telnet/telnetd/Makefile.generic @@ -0,0 +1,71 @@ +# +# Copyright (c) 1991 The Regents of the University of California. +# All rights reserved. +# +# Redistribution and use in source and binary forms are permitted provided +# that: (1) source distributions retain this entire copyright notice and +# comment, and (2) distributions including binaries display the following +# acknowledgement: ``This product includes software developed by the +# University of California, Berkeley and its contributors'' in the +# documentation or other materials provided with the distribution and in +# all advertising materials mentioning features or use of this software. +# Neither the name of the University nor the names of its contributors may +# be used to endorse or promote products derived from this software without +# specific prior written permission. +# THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +# +# @(#)Makefile.generic 5.5 (Berkeley) 3/1/91 +# + +SRC1= telnetd.c state.c termstat.c slc.c sys_term.c utility.c global.c authenc.c +OBJ1= telnetd.o state.o termstat.o slc.o sys_term.o utility.o global.o authenc.o + +OBJS= ${OBJ1} ${GETTYOBJ} +SRCS= ${SRC1} ${GETTYSRC} + +MAN= telnetd.0 +CFLAGS= ${LCCFLAGS} -I.. ${DEFINES} ${INCLUDES} +ARPA_TELNET = ../arpa/telnet.h + +# +# These next three lines are not needed in 4.4BSD +# +.SUFFIXES: .0 .8 +.8.0: + nroff -man -h $< > $@ + + +all: telnetd + +telnetd: ${OBJS} ${LIBPATH} + ${CC} -o $@ ${CFLAGS} ${OBJS} ../../../lib/kafs/libkafs.a ${LIBS} + +clean: + rm -f ${OBJS} core telnetd + +cleandir: clean + rm -f ${MAN} tags .depend + +depend: ${SRCS} + mkdep ${CFLAGS} ${SRCS} + +install: ${MAN} + install -s -o bin -g bin -m 755 telnetd ${LIBEXEC} + install -c -o bin -g bin -m 444 ${MAN} ${DESTDIR}/usr/man/cat8 + +lint: ${SRCS} + lint ${CFLAGS} ${SRCS} + +tags: ${SRCS} + ctags ${SRCS} + +authenc.o: telnetd.h +global.o: defs.h ext.h ${ARPA_TELNET} +slc.o: telnetd.h defs.h ext.h ${ARPA_TELNET} +state.o: telnetd.h defs.h ext.h ${ARPA_TELNET} +sys_term.o: telnetd.h pathnames.h defs.h ext.h ${ARPA_TELNET} +telnetd.o: telnetd.h defs.h ext.h ${ARPA_TELNET} +termstat.o: telnetd.h defs.h ext.h ${ARPA_TELNET} +utility.o: telnetd.h defs.h ext.h ${ARPA_TELNET} diff --git a/appl/telnet/telnetd/pathnames.h b/appl/telnet/telnetd/pathnames.h new file mode 100644 index 000000000..c8b0806e7 --- /dev/null +++ b/appl/telnet/telnetd/pathnames.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)pathnames.h 8.1 (Berkeley) 6/4/93 + */ + +#if BSD > 43 + +# include + +# ifndef _PATH_LOGIN +# define _PATH_LOGIN "/usr/bin/login" +# endif + +#else + +# define _PATH_TTY "/dev/tty" +# ifndef _PATH_LOGIN +# define _PATH_LOGIN "/bin/login" +# endif + +#endif + +#ifdef BFTPDAEMON +#define BFTPPATH "/usr/ucb/bftp" +#endif /* BFTPDAEMON */ diff --git a/appl/telnet/telnetd/telnetd.0.ps b/appl/telnet/telnetd/telnetd.0.ps new file mode 100644 index 000000000..bbbdbd002 --- /dev/null +++ b/appl/telnet/telnetd/telnetd.0.ps @@ -0,0 +1,555 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.08 +%%DocumentNeededResources: font Times-Roman +%%+ font Times-Bold +%%+ font Courier-Bold +%%+ font Courier-Oblique +%%+ font Courier +%%DocumentSuppliedResources: procset grops 1.08 0 +%%Pages: 5 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.08 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Roman +%%IncludeResource: font Times-Bold +%%IncludeResource: font Courier-Bold +%%IncludeResource: font Courier-Oblique +%%IncludeResource: font Courier +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL +792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron +/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space +/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft +/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four +/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C +/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash +/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q +/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase +/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger +/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar +/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus +/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu +/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright +/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde +/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute +/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute +/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve +/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex +/udieresis/yacute/thorn/ydieresis]def/Courier@0 ENC0/Courier RE +/Courier-Oblique@0 ENC0/Courier-Oblique RE/Courier-Bold@0 ENC0/Courier-Bold RE +/Times-Bold@0 ENC0/Times-Bold RE/Times-Roman@0 ENC0/Times-Roman RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNETD \( 8 \))72 48 R(BSD System Manager') +241.42 48 Q 2.5(sM)-.55 G 105.272(anual TELNETD)348.92 48 R 1.666(\(8\))1.666 G +/F1 10/Times-Bold@0 SF -.2(NA)72 108 S(ME).2 E/F2 10/Courier-Bold@0 SF(telnetd) +102 120 Q F0 2.52.5 G(ARP)161.46 120 Q(A)-.92 E/F3 9/Times-Roman@0 SF +(TELNET)2.5 E F0(protocol serv)2.5 E(er)-.15 E F1(SYNOPSIS)72 144 Q F2 +(/usr/libexec/telnetd)102 156 Q F0([)3.333 E F22.499 E/F4 10 +/Courier-Oblique@0 SF(authmode)6 E F0 3.333(][).833 G F2-.834 E F0 3.333 +(][).833 G F2-.834 E F4(debugmode)6 E F0 3.333(][).833 G F2(\255edebug) +-.834 E F0 3.333(][).833 G F2-.834 E F0(]).833 E([)228.833 168 Q F2 +2.499 E F4(initid)A F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 G F2 +-.834 E F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 G F2 +-.834 E F4(lowpty-highpty)A F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 +G F2-.834 E F4(tos)228 180 Q F0 3.333(][).833 G F2-.834 E F4(len)6 +E F0 3.333(][).833 G F2-.834 E F0 3.333(][).833 G F2-.834 E F4 +(authtype)6 E F0 3.333(][).833 G F2(\255debug)-.834 E F0([)6.833 E F4(port).833 +E F0 .833(]]).833 G F1(DESCRIPTION)72 204 Q F0(The)102 216 Q F2(telnetd)3.044 E +F0 .544(command is a serv)3.044 F .544(er which supports the)-.15 F F3 -.36(DA) +3.044 G(RP).36 E(A)-.828 E F0(standard)3.044 E F3(TELNET)3.044 E F0 .543 +(virtual terminal protocol.)3.044 F F2(Telnetd)102 228 Q F0 .221 +(is normally in)2.721 F -.2(vo)-.4 G -.1(ke).2 G 2.721(db).1 G 2.721(yt)234.184 +228 S .221(he internet serv)244.685 228 R .221(er \(see)-.15 F/F5 10/Courier@0 +SF(inetd)2.721 E F0 2.942(\(8\)\) for)B .221(requests to connect to the)2.721 F +F3(TELNET)2.721 E F0 .673(port as indicated by the)102 240 R F5(/etc/services) +3.173 E F0 .673(\214le \(see)3.173 F F5(services)3.173 E F0 3.846(\(5\)\). The) +B F2(\255debug)4.839 E F0 .672(option may be used to)3.173 F .145(start up)102 +252 R F2(telnetd)2.645 E F0(manually)2.645 E 2.645(,i)-.65 G .145 +(nstead of through)223.65 252 R F5(inetd)2.645 E F0 2.79(\(8\). If)B .145 +(started up this w)2.645 F(ay)-.1 E(,)-.65 E F4(port)2.645 E F0 .145 +(may be speci\214ed to)2.645 F(run)102 264 Q F2(telnetd)2.5 E F0 +(on an alternate)2.5 E F3(TCP)2.5 E F0(port number)2.5 E(.)-.55 E(The)102 282 Q +F2(telnetd)2.5 E F0(command accepts the follo)2.5 E(wing options:)-.25 E F2 +103.666 300 Q F4(authmode)6 E F0 .106(This option may be used for specif\ +ying what mode should be used for authentication.)173 312 R(Note)5.106 E 2.778 +(that this option is only useful if)173 324 R F2(telnetd)5.279 E F0 2.779 +(has been compiled with support for the)5.279 F F5(AUTHENTICATION)173 336 Q F0 +2.5(option. There)2.5 F(are se)2.5 E -.15(ve)-.25 G(ral v).15 E(alid v)-.25 E +(alues for)-.25 E F4(authmode:)2.5 E F0(deb)173 354 Q 8.26(ug T)-.2 F +(urns on authentication deb)-.45 E(ugging code.)-.2 E 15.84(user Only)173 372 R +(allo)2.923 E 2.923(wc)-.25 G .423(onnections when the remote user can pro) +260.256 372 R .422(vide v)-.15 F .422(alid authentication in-)-.25 F 1.277 +(formation to identify the remote user)208 384 R 3.777(,a)-.4 G 1.277 +(nd is allo)372.181 384 R 1.277(wed access to the speci\214ed ac-)-.25 F +(count without pro)208 396 Q(viding a passw)-.15 E(ord.)-.1 E -.25(va)173 414 S +12.75(lid Only).25 F(allo)2.923 E 2.923(wc)-.25 G .423 +(onnections when the remote user can pro)260.256 414 R .422(vide v)-.15 F .422 +(alid authentication in-)-.25 F .742(formation to identify the remote user)208 +426 R 5.743(.T)-.55 G(he)372.995 426 Q F5(login)3.243 E F0 .743 +(\(1\) command will pro)B .743(vide an)-.15 F(y)-.15 E .53(additional user v) +208 438 R .529(eri\214cation needed if the remote user is not allo)-.15 F .529 +(wed automatic ac-)-.25 F(cess to the speci\214ed account.)208 450 Q 11.95 +(other Only)173 468 R(allo)3.028 E 3.029(wc)-.25 G .529 +(onnections that supply some authentication information.)260.467 468 R .529 +(This option)5.529 F .079(is currently not supported by an)208 480 R 2.578(yo) +-.15 G 2.578(ft)347.752 480 S .078(he e)356.44 480 R .078 +(xisting authentication mechanisms, and is)-.15 F(thus the same as specifying) +208 492 Q F2 -3.5(\255a valid)4.166 F F0(.)A 13.06(none This)173 510 R .869 +(is the def)3.369 F .869(ault state.)-.1 F .869 +(Authentication information is not required.)5.869 F .87(If no or in-)5.869 F +(suf)208 522 Q .394(\214cient authentication information is pro)-.25 F .393 +(vided, then the)-.15 F F5(login)2.893 E F0 .393(\(1\) program will)B(pro)208 +534 Q(vide the necessary user v)-.15 E(eri\214cation.)-.15 E(of)173 552 Q 23.59 +(fT)-.25 G 1.385(his disables the authentication code.)214.11 552 R 1.385 +(All user v)6.385 F 1.385(eri\214cation will happen through)-.15 F(the)208 564 +Q F5(login)2.5 E F0(\(1\) program.)A F2103.666 582 Q F0 .82 +(Speci\214es bftp serv)173 582 R .82(er mode.)-.15 F .819(In this mode,)5.82 F +F2(telnetd)3.319 E F0 .819(causes login to start a)3.319 F F5(bftp)3.319 E F0 +.819(\(1\) ses-)B .747(sion rather than the user')173 594 R 3.247(sn)-.55 G +.747(ormal shell.)286.995 594 R .748 +(In bftp daemon mode normal logins are not sup-)5.747 F +(ported, and it must be used on a port other than the normal)173 606 Q F3 +(TELNET)2.5 E F0(port.)2.5 E F2103.666 624 Q F4(debugmode)6 E F0 .827 +(This option may be used for deb)173 636 R .827(ugging purposes.)-.2 F .827 +(This allo)5.827 F(ws)-.25 E F2(telnetd)3.327 E F0 .827(to print out de-)3.327 +F -.2(bu)173 648 S .827(gging information to the connection, allo).2 F .827 +(wing the user to see what)-.25 F F2(telnetd)3.327 E F0 .827(is doing.)3.327 F +(There are se)173 660 Q -.15(ve)-.25 G(ral possible v).15 E(alues for)-.25 E F4 +(debugmode:)2.5 E F2(options)173 678 Q F0(Prints information about the ne)226 +678 Q(gotiation of)-.15 E F3(TELNET)2.5 E F0(options.)2.5 E(4.2 Berk)72 750 Q +(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71(ution February)-.2 F +(3, 1994)2.5 E(1)535 750 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNETD \( 8 \))72 48 R(BSD System Manager') +241.42 48 Q 2.5(sM)-.55 G 105.272(anual TELNETD)348.92 48 R 1.666(\(8\))1.666 G +/F1 10/Courier-Bold@0 SF(report)173 96 Q F0 2.438(Prints the)226 96 R F1 +(options)4.938 E F0 2.437(information, plus some additional information about) +4.938 F(what processing is going on.)226 108 Q F1(netdata)173 126 Q F0 +(Displays the data stream recei)226 126 Q -.15(ve)-.25 G 2.5(db).15 G(y)367.51 +126 Q F1(telnetd.)2.5 E(ptydata)173 144 Q F0(Displays data written to the pty) +226 144 Q(.)-.65 E F1(exercise)173 162 Q F0(Has not been implemented yet.)5 E +F1(\255debug)103.666 180 Q F0(Enables deb)173 180 Q(ugging on each sock)-.2 E +(et created by)-.1 E F1(telnetd)2.5 E F0(\(see)2.5 E/F2 10/Courier@0 SF +(SO_DEBUG)2.5 E F0(in)2.5 E F2(socket)2.5 E F0(\(2\)\).)A F1(\255edebug)103.666 +198 Q F0(If)173 198 Q F1(telnetd)3.161 E F0 .662 +(has been compiled with support for data encryption, then the)3.161 F F1 +(\255edebug)4.828 E F0(op-)3.162 E(tion may be used to enable encryption deb) +173 210 Q(ugging code.)-.2 E F1103.666 228 Q F0(Disables the printing of\ + host-speci\214c information before login has been completed.)173 228 Q F1 +103.666 246 Q/F3 10/Courier-Oblique@0 SF(initid)7.171 E F0 1.171 +(This option is only applicable to)174.171 246 R/F4 9/Times-Roman@0 SF(UNICOS) +3.671 E F0 1.171(systems prior to 7.0.)3.671 F 1.17(It speci\214es the)6.171 F +F2(ID)3.67 E F0(from)3.67 E F2(/etc/inittab)173 258 Q F0 +(to use when init starts login sessions.)2.5 E(The def)5 E(ault)-.1 E F2(ID)2.5 +E F0(is)2.5 E F2(fe.)2.5 E F1103.666 276 Q F0 .556 +(This option is only useful if)173 276 R F1(telnetd)3.056 E F0 .557 +(has been compiled with both linemode and kludge)3.056 F .521 +(linemode support.)173 288 R .521(If the)5.521 F F14.687 E F0 .52 +(option is speci\214ed, then if the remote client does not support)3.02 F(the) +173 300 Q F2(LINEMODE)3.697 E F0 1.197(option, then)3.697 F F1(telnetd)3.697 E +F0 1.197(will operate in character at a time mode.)3.697 F 1.198(It will)6.198 +F .148(still support kludge linemode, b)173 312 R .147 +(ut will only go into kludge linemode if the remote client re-)-.2 F 2.06 +(quests it.)173 324 R 2.061(\(This is done by by the client sending)7.06 F F2 +2.061(DONT SUPPRESS-GO-AHEAD)4.561 F F0(and)4.561 E F2 .1(DONT ECHO)173 336 R +F0 .1(.\) The)B F14.266 E F0 .1 +(option is most useful when there are remote clients that do not sup-)2.6 F .67 +(port kludge linemode, b)173 348 R .67(ut pass the heuristic \(if the)-.2 F +3.17(yr)-.15 G .67(espond with)390.88 348 R F2 .67(WILL TIMING-MARK)3.17 F F0 +(in response to a)173 360 Q F2(DO TIMING-MARK\))2.5 E F0 +(for kludge linemode support.)2.5 E F1103.666 378 Q F0 .672 +(Speci\214es line mode.)173 378 R -.35(Tr)5.672 G .671 +(ies to force clients to use line- at-a-time mode.).35 F .671(If the)5.671 F F2 +(LINEMODE)3.171 E F0(option is not supported, it will go into kludge linemode.) +173 390 Q F1103.666 408 Q F0(Disable)173 408 Q F2(TCP)3.488 E F0 -.1(ke) +3.488 G(ep-ali).1 E -.15(ve)-.25 G 3.488(s. Normally).15 F F1(telnetd)3.488 E +F0 .988(enables the)3.488 F F4(TCP)3.489 E F0 -.1(ke)3.489 G(ep-ali).1 E 1.289 +-.15(ve m)-.25 H .989(echanism to).15 F .602(probe connections that ha)173 420 +R .902 -.15(ve b)-.2 H .602 +(een idle for some period of time to determine if the client is).15 F 1.124 +(still there, so that idle connections from machines that ha)173 432 R 1.424 +-.15(ve c)-.2 H 1.124(rashed or can no longer be).15 F +(reached may be cleaned up.)173 444 Q F1103.666 462 Q F3(lowpty-highpty)6 +E F0 .772(This option is only enabled when)173 474 R F1(telnetd)3.272 E F0 .771 +(is compiled for)3.271 F F2(UNICOS.)3.271 E F0 .771(It speci\214es an in-)3.271 +F(clusi)173 486 Q 3.232 -.15(ve r)-.25 H 2.932(ange of pseudo-terminal de).15 F +2.932(vices to use.)-.25 F 2.933(If the system has sysconf v)7.933 F(ariable) +-.25 E F2(_SC_CRAY_NPTY)173 498 Q F0 1.486(con\214gured, the def)3.986 F 1.486 +(ault pty search range is 0 to)-.1 F F2(_SC_CRAY_NPTY;)3.986 E F0 .72 +(otherwise, the def)173 510 R .72(ault range is 0 to 128.)-.1 F(Either)5.72 E +F3(lowpty)3.22 E F0(or)3.22 E F3(highpty)3.22 E F0 .72(may be omitted to)3.22 F +(allo)173 522 Q 2.6(wc)-.25 G .1(hanging either end of the search range.)202.01 +522 R(If)5.1 E F3(lowpty)2.6 E F0 .1(is omitted, the - character is still)2.6 F +(required so that)173 534 Q F1(telnetd)2.5 E F0(can dif)2.5 E(ferentiate)-.25 E +F3(highpty)2.5 E F0(from)2.5 E F3(lowpty)2.5 E F0(.)A F1103.666 552 Q F0 +1.391(This option is only enabled if)173 552 R F1(telnetd)3.891 E F0 1.391 +(is compiled with support for)3.891 F F4(SecurID)3.891 E F0 3.891(cards. It) +3.891 F .787(causes the)173 564 R F14.953 E F0 .786 +(option to be passed on to)3.286 F F2(login)3.286 E F0 4.072(\(1\), and)B .786 +(thus is only useful if)3.286 F F2(login)3.286 E F0(\(1\))A .48(supports the) +173 576 R F14.646 E F0 .48(\215ag to indicate that only)2.98 F F4 +(SecurID)2.98 E F0 -.25(va)2.98 G .481(lidated logins are allo).25 F .481 +(wed, and is usu-)-.25 F +(ally useful for controlling remote logins from outside of a \214re)173 588 Q +-.1(wa)-.25 G(ll.).1 E F1103.666 606 Q F3(tos)6 E F1103.666 624 Q +F3(len)6.628 E F0 .628 +(This option is used to specify the size of the \214eld in the)173.628 624 R F2 +(utmp)3.127 E F0 .627(structure that holds the re-)3.127 F 1(mote host name.) +173 636 R 1(If the resolv)6 F 1(ed host name is longer than)-.15 F F3(len)3.5 E +F0 3.5(,t)C 1(he dotted decimal v)441.99 636 R(alue)-.25 E .046 +(will be used instead.)173 648 R .046(This allo)5.046 F .046(ws hosts with v) +-.25 F .045(ery long host names that o)-.15 F -.15(ve)-.15 G(r\215o).15 E 2.545 +(wt)-.25 G .045(his \214eld to)497.68 648 R .996 +(still be uniquely identi\214ed.)173 660 R(Specifying)5.997 E F1(\255u0)5.163 E +F0 .997(indicates that only dotted decimal addresses)3.497 F +(should be put into the)173 672 Q F2(utmp)2.5 E F0(\214le.)2.5 E F1 +103.666 690 Q F0 .422(This option causes)173 690 R F1(telnetd)2.922 E F0 .422 +(to refuse connections from addresses that cannot be mapped)2.922 F(4.2 Berk)72 +750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71(ution February)-.2 F +(3, 1994)2.5 E(2)535 750 Q EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNETD \( 8 \))72 48 R(BSD System Manager') +241.42 48 Q 2.5(sM)-.55 G 105.272(anual TELNETD)348.92 48 R 1.666(\(8\))1.666 G +(back into a symbolic name via the)173 96 Q/F1 10/Courier@0 SF(gethostbyaddr) +2.5 E F0(\(3\) routine.)A/F2 10/Courier-Bold@0 SF103.666 114 Q/F3 10 +/Courier-Oblique@0 SF(authtype)6 E F0 .123(This option is only v)173 126 R .123 +(alid if)-.25 F F2(telnetd)2.623 E F0 .123(has been b)2.623 F .124 +(uilt with support for the authentication op-)-.2 F 2.968(tion. It)173 138 R +.467(disables the use of)2.968 F F3(authtype)2.967 E F0 .467 +(authentication, and can be used to temporarily dis-)2.967 F +(able a speci\214c authentication type without ha)173 150 Q(ving to recompile) +-.2 E F2(telnetd)2.5 E F0(.)A F2(Telnetd)102 168 Q F0 .851 +(operates by allocating a pseudo-terminal de)3.351 F .851(vice \(see)-.25 F F1 +(pty)3.351 E F0 4.202(\(4\)\) for)B 3.351(ac)3.351 G .852 +(lient, then creating a login)431.882 168 R .757(process which has the sla)102 +180 R 1.057 -.15(ve s)-.2 H .757(ide of the pseudo-terminal as).15 F F1(stdin) +3.257 E F0(,)A F1(stdout)3.256 E F0(and)3.256 E F1(stderr)3.256 E F0(.)A F2 +(Telnetd)3.256 E F0(ma-)3.256 E .483 +(nipulates the master side of the pseudo-terminal, implementing the)102 192 R +/F4 9/Times-Roman@0 SF(TELNET)2.984 E F0 .484(protocol and passing characters) +2.984 F(between the remote client and the login process.)102 204 Q .538(When a) +102 222 R F4(TELNET)3.038 E F0 .538(session is started up,)3.038 F F2(telnetd) +3.038 E F0(sends)3.038 E F4(TELNET)3.038 E F0 .538 +(options to the client side indicating a will-)3.038 F(ingness to do the follo) +102 234 Q(wing)-.25 E F4(TELNET)2.5 E F0 +(options, which are described in more detail belo)2.5 E(w:)-.25 E F1 +(DO AUTHENTICATION)132 252 Q(WILL ENCRYPT)132 264 Q(DO TERMINAL TYPE)132 276 Q +(DO TSPEED)132 288 Q(DO XDISPLOC)132 300 Q(DO NEW-ENVIRON)132 312 Q(DO ENVIRON) +132 324 Q(WILL SUPPRESS GO AHEAD)132 336 Q(DO ECHO)132 348 Q(DO LINEMODE)132 +360 Q(DO NAWS)132 372 Q(WILL STATUS)132 384 Q(DO LFLOW)132 396 Q +(DO TIMING-MARK)132 408 Q F0 .468(The pseudo-terminal allocated to the client \ +is con\214gured to operate in cook)102 426 R .468(ed mode, and with)-.1 F F1 +.469(XTABS and)2.969 F(CRMOD)102 438 Q F0(enabled \(see)2.5 E F1(tty)2.5 E F0 +(\(4\)\).)A F2(Telnetd)102 456 Q F0(has support for enabling locally the follo) +2.5 E(wing)-.25 E F4(TELNET)2.5 E F0(options:)2.5 E .558(WILL ECHO)102 474 R +.558(When the)209.558 474 R F1(LINEMODE)3.057 E F0 .557(option is enabled, a) +3.057 F F1 .557(WILL ECHO)3.057 F F0(or)3.057 E F1 .557(WONT ECHO)3.057 F F0 +.557(will be)3.057 F .487 +(sent to the client to indicate the current state of terminal echoing.)209 486 +R .487(When terminal)5.487 F .409(echo is not desired, a)209 498 R F1 .408 +(WILL ECHO)2.908 F F0 .408(is sent to indicate that)2.908 F F4(telnetd)2.908 E +F0 .408(will tak)2.908 F 2.908(ec)-.1 G .408(are of)516.552 498 R 1.811 +(echoing an)209 510 R 4.311(yd)-.15 G 1.811 +(ata that needs to be echoed to the terminal, and then nothing is)268.572 510 R +3.876(echoed. When)209 522 R 1.376(terminal echo is desired, a)3.876 F F1 1.375 +(WONT ECHO)3.875 F F0 1.375(is sent to indicate that)3.875 F F4(telnetd)209 534 +Q F0 .11(will not be doing an)2.61 F 2.61(yt)-.15 G .11 +(erminal echoing, so the client should do an)326.788 534 R 2.611(yt)-.15 G +(erminal)509.45 534 Q(echoing that is needed.)209 546 Q .243(WILL BIN)102 564 R +(AR)-.35 E 42.18(YI)-.65 G .243(ndicates that the client is willing to send a \ +8 bits of data, rather than the normal 7)212.573 564 R(bits of the Netw)209 576 +Q(ork V)-.1 E(irtual T)-.6 E(erminal.)-.7 E(WILL SGA)102 594 Q +(Indicates that it will not be sending)209 594 Q F1(IAC GA,)2.5 E F0 +(go ahead, commands.)2.5 E .366(WILL ST)102 612 R -1.11(AT)-.93 G 41.27 +(US Indicates)1.11 F 2.866(aw)2.866 G .366 +(illingness to send the client, upon request, of the current status of all) +262.858 612 R F4(TELNET)209 624 Q F0(options.)2.5 E .51(WILL TIMING-MARK)102 +642 R(Whene)209.51 642 Q -.15(ve)-.25 G 3.01(ra).15 G F1 .509(DO TIMING-MARK) +-.001 F F0 .509(command is recei)3.009 F -.15(ve)-.25 G .509(d, it is al).15 F +-.1(wa)-.1 G .509(ys responded to).1 F(with a)209 654 Q F1(WILL TIMING-MARK)2.5 +E F0 .726(WILL LOGOUT)102 672 R .726(When a)209.726 672 R F1 .726(DO LOGOUT) +3.226 F F0 .726(is recei)3.226 F -.15(ve)-.25 G .726(d, a).15 F F1 .726 +(WILL LOGOUT)3.226 F F0 .726(is sent in response, and the)3.226 F(4.2 Berk)72 +750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71(ution February)-.2 F +(3, 1994)2.5 E(3)535 750 Q EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNETD \( 8 \))72 48 R(BSD System Manager') +241.42 48 Q 2.5(sM)-.55 G 105.272(anual TELNETD)348.92 48 R 1.666(\(8\))1.666 G +/F1 9/Times-Roman@0 SF(TELNET)209 96 Q F0(session is shut do)2.5 E(wn.)-.25 E +.118(WILL ENCR)102 114 R 32.1(YPT Only)-.65 F .118(sent if)2.618 F/F2 10 +/Courier-Bold@0 SF(telnetd)2.618 E F0 .118 +(is compiled with support for data encryption, and indicates)2.618 F 2.5(aw)209 +126 S(illingness to decrypt the data stream.)223.16 126 Q F2(Telnetd)102 144 Q +F0(has support for enabling remotely the follo)2.5 E(wing)-.25 E F1(TELNET)2.5 +E F0(options:)2.5 E(DO BIN)102 162 Q(AR)-.35 E 52.73(YS)-.65 G +(ent to indicate that)214.56 162 Q F1(telnetd)2.5 E F0(is willing to recei)2.5 +E .3 -.15(ve a)-.25 H 2.5(n8b).15 G(it data stream.)423.918 162 Q(DO LFLO)102 +180 Q 55.97(WR)-.35 G(equests that the client handle \215o)215.67 180 Q 2.5(wc) +-.25 G(ontrol characters remotely)358.18 180 Q(.)-.65 E .967(DO ECHO)102 198 R +.967(This is not really supported, b)209.967 198 R .967 +(ut is sent to identify a 4.2BSD)-.2 F/F3 10/Courier@0 SF(telnet)3.468 E F0 +.968(\(1\) client,)B .365(which will improperly respond with)209 210 R F3 .365 +(WILL ECHO.)2.865 F F0 .365(If a)2.865 F F3 .365(WILL ECHO)2.865 F F0 .365 +(is recei)2.865 F -.15(ve)-.25 G(d,).15 E(a)209 222 Q F3(DONT ECHO)2.5 E F0 +(will be sent in response.)2.5 E .445(DO TERMIN)102 240 R 7.92 +(AL-TYPE Indicates)-.35 F 2.945(ad)2.945 G .445 +(esire to be able to request the name of the type of terminal that is at-) +260.875 240 R(tached to the client side of the connection.)209 252 Q(DO SGA)102 +270 Q(Indicates that it does not need to recei)209 270 Q -.15(ve)-.25 G F3 +(IAC GA,)2.65 E F0(the go ahead command.)2.5 E .006(DO N)102 288 R -.9(AW)-.35 +G 61.87(SR).9 G .006(equests that the client inform the serv)215.676 288 R .005 +(er when the windo)-.15 F 2.505(w\()-.25 G .005(display\) size changes.)452.51 +288 R(DO TERMIN)102 306 Q(AL-SPEED)-.35 E 1.029(Indicates a desire to be able \ +to request information about the speed of the serial)209 318 R +(line to which the client is attached.)209 330 Q .469(DO XDISPLOC)102 348 R +.469(Indicates a desire to be able to request the name of the X windo)209.469 +348 R .468(ws display that is)-.25 F(associated with the telnet client.)209 360 +Q 1.008(DO NEW)102 378 R(-ENVIR)-.65 E 17.52(ON Indicates)-.4 F 3.508(ad)3.508 +G 1.008(esire to be able to request en)262.564 378 R 1.009(vironment v)-.4 F +1.009(ariable information, as de-)-.25 F(scribed in RFC 1572.)209 390 Q 1.009 +(DO ENVIR)102 408 R 42.97(ON Indicates)-.4 F 3.509(ad)3.509 G 1.009 +(esire to be able to request en)262.567 408 R 1.008(vironment v)-.4 F 1.008 +(ariable information, as de-)-.25 F(scribed in RFC 1408.)209 420 Q .886 +(DO LINEMODE)102 438 R .886(Only sent if)209.886 438 R F2(telnetd)3.386 E F0 +.886(is compiled with support for linemode, and requests that)3.386 F +(the client do line by line processing.)209 450 Q 1.292(DO TIMING-MARK)102 468 +R 1.292(Only sent if)210.292 468 R F2(telnetd)3.792 E F0 1.291 +(is compiled with support for both linemode and kludge)3.792 F 2.029 +(linemode, and the client responded with)209 480 R F3 2.029(WONT LINEMODE.) +4.529 F F0 2.029(If the client re-)4.529 F 3.375(sponds with)209 492 R F3 3.375 +(WILL TM,)5.875 F F0 3.375(the it is assumed that the client supports kludge) +5.875 F 2.5(linemode. Note)209 504 R(that the)2.5 E([)3.333 E F22.499 E +F0 2.5(]o).833 G(ption can be used to disable this.)338.205 504 Q(DO A)102 522 +Q(UTHENTICA)-.55 E(TION)-1.11 E .618(Only sent if)209 534 R F2(telnetd)3.118 E +F0 .618(is compiled with support for authentication, and indicates)3.118 F 2.5 +(aw)209 546 S(illingness to recei)223.16 546 Q .3 -.15(ve a)-.25 H +(uthentication information for automatic login.).15 E .118(DO ENCR)102 564 R +42.65(YPT Only)-.65 F .118(sent if)2.618 F F2(telnetd)2.618 E F0 .118 +(is compiled with support for data encryption, and indicates)2.618 F 2.5(aw)209 +576 S(illingness to decrypt the data stream.)223.16 576 Q/F4 10/Times-Bold@0 SF +(ENVIR)72 600 Q(ONMENT)-.3 E(FILES)72 612 Q F3(/etc/services)102 624 Q +(/etc/inittab)102 636 Q F0(\(UNICOS systems only\))2.5 E F3(/etc/iptos)102 648 +Q F0(\(if supported\))2.5 E F3(/usr/ucb/bftp)102 660 Q F0(\(if supported\))2.5 +E(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71 +(ution February)-.2 F(3, 1994)2.5 E(4)535 750 Q EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF -.834(TELNETD \( 8 \))72 48 R(BSD System Manager') +241.42 48 Q 2.5(sM)-.55 G 105.272(anual TELNETD)348.92 48 R 1.666(\(8\))1.666 G +/F1 10/Times-Bold@0 SF(SEE ALSO)72 96 Q/F2 10/Courier@0 SF(telnet)102 108 Q F0 +(\(1\),)A F2(login)5 E F0(\(1\),)A F2(bftp)5 E F0(\(1\) \(if supported\))A F1 +(ST)72 132 Q(AND)-.9 E(ARDS)-.35 E/F3 10/Courier-Bold@0 SF(RFC-854)102 144 Q/F4 +9/Times-Roman@0 SF(TELNET)155 144 Q F0(PR)2.5 E -1.88 -.4(OT O)-.4 H +(COL SPECIFICA).4 E(TION)-1.11 E F3(RFC-855)102 156 Q F0 +(TELNET OPTION SPECIFICA)155 156 Q(TIONS)-1.11 E F3(RFC-856)102 168 Q F0 +(TELNET BIN)155 168 Q(AR)-.35 E 2.5(YT)-.65 G(RANSMISSION)241.21 168 Q F3 +(RFC-857)102 180 Q F0(TELNET ECHO OPTION)155 180 Q F3(RFC-858)102 192 Q F0 +(TELNET SUPPRESS GO AHEAD OPTION)155 192 Q F3(RFC-859)102 204 Q F0(TELNET ST) +155 204 Q -1.11(AT)-.93 G(US OPTION)1.11 E F3(RFC-860)102 216 Q F0 +(TELNET TIMING MARK OPTION)155 216 Q F3(RFC-861)102 228 Q F0 +(TELNET EXTENDED OPTIONS - LIST OPTION)155 228 Q F3(RFC-885)102 240 Q F0 +(TELNET END OF RECORD OPTION)155 240 Q F3(RFC-1073)102 252 Q F0 -.7(Te)5 G +(lnet W).7 E(indo)-.4 E 2.5(wS)-.25 G(ize Option)224.2 252 Q F3(RFC-1079)102 +264 Q F0 -.7(Te)5 G(lnet T).7 E(erminal Speed Option)-.7 E F3(RFC-1091)102 276 +Q F0 -.7(Te)5 G(lnet T).7 E(erminal-T)-.7 E(ype Option)-.8 E F3(RFC-1096)102 +288 Q F0 -.7(Te)5 G(lnet X Display Location Option).7 E F3(RFC-1123)102 300 Q +F0(Requirements for Internet Hosts -- Application and Support)5 E F3(RFC-1184) +102 312 Q F0 -.7(Te)5 G(lnet Linemode Option).7 E F3(RFC-1372)102 324 Q F0 -.7 +(Te)5 G(lnet Remote Flo).7 E 2.5(wC)-.25 G(ontrol Option)245.44 324 Q F3 +(RFC-1416)102 336 Q F0 -.7(Te)5 G(lnet Authentication Option).7 E F3(RFC-1411) +102 348 Q F0 -.7(Te)5 G(lnet Authentication: K).7 E(erberos V)-.25 E(ersion 4) +-1.11 E F3(RFC-1412)102 360 Q F0 -.7(Te)5 G(lnet Authentication: SPX).7 E F3 +(RFC-1571)102 372 Q F0 -.7(Te)5 G(lnet En).7 E +(vironment Option Interoperability Issues)-.4 E F3(RFC-1572)102 384 Q F0 -.7 +(Te)5 G(lnet En).7 E(vironment Option)-.4 E F1 -.1(BU)72 408 S(GS).1 E F0(Some) +102 420 Q F4(TELNET)2.5 E F0(commands are only partially implemented.)2.5 E +.082(Because of b)102 438 R .082(ugs in the original 4.2 BSD)-.2 F F2(telnet) +2.582 E F0(\(1\),)A F3(telnetd)5.164 E F0 .082 +(performs some dubious protocol e)2.582 F(xchanges)-.15 E(to try to disco)102 +450 Q -.15(ve)-.15 G 2.5(ri).15 G 2.5(ft)175.03 450 S +(he remote client is, in f)183.64 450 Q(act, a 4.2 BSD)-.1 E F2(telnet)2.5 E F0 +(\(1\).)A(Binary mode has no common interpretation e)102 468 Q +(xcept between similar operating systems \(Unix in this case\).)-.15 E +(The terminal type name recei)102 486 Q -.15(ve)-.25 G 2.5(df).15 G +(rom the remote client is con)239.06 486 Q -.15(ve)-.4 G(rted to lo).15 E +(wer case.)-.25 E F3(Telnetd)102 504 Q F0(ne)2.5 E -.15(ve)-.25 G 2.5(rs).15 G +(ends)174.7 504 Q F4(TELNET)2.5 E F2(IAC GA)2.5 E F0(\(go ahead\) commands.)2.5 +E(4.2 Berk)72 750 Q(ele)-.1 E 2.5(yD)-.15 G(istrib)132.57 750 Q 95.71 +(ution February)-.2 F(3, 1994)2.5 E(5)535 750 Q EP +%%Trailer +end +%%EOF diff --git a/appl/telnet/telnetd/telnetd.0.txt b/appl/telnet/telnetd/telnetd.0.txt new file mode 100644 index 000000000..66557bcea --- /dev/null +++ b/appl/telnet/telnetd/telnetd.0.txt @@ -0,0 +1,322 @@ +TELNETD(8) BSD System Manager's Manual TELNETD(8) + +NNAAMMEE + tteellnneettdd - DARPA TELNET protocol server + +SSYYNNOOPPSSIISS + //uussrr//lliibbeexxeecc//tteellnneettdd [--BBUUhhllkknnss] [--DD _d_e_b_u_g_m_o_d_e] [--II_i_n_i_t_i_d] [--SS _t_o_s] [--XX + _a_u_t_h_t_y_p_e] [--aa _a_u_t_h_m_o_d_e] [--eeddeebbuugg] [--rr_l_o_w_p_t_y_-_h_i_g_h_p_t_y] + [--uu _l_e_n] [--ddeebbuugg [_p_o_r_t]] + +DDEESSCCRRIIPPTTIIOONN + The tteellnneettdd command is a server which supports the DARPA standard TELNET + virtual terminal protocol. TTeellnneettdd is normally invoked by the internet + server (see inetd(8)) for requests to connect to the TELNET port as in- + dicated by the _/_e_t_c_/_s_e_r_v_i_c_e_s file (see services(5)). The --ddeebbuugg option + may be used to start up tteellnneettdd manually, instead of through inetd(8). + If started up this way, _p_o_r_t may be specified to run tteellnneettdd on an alter- + nate TCP port number. + + The tteellnneettdd command accepts the following options: + + --aa _a_u_t_h_m_o_d_e This option may be used for specifying what mode should be + used for authentication. Note that this option is only use- + ful if tteellnneettdd has been compiled with support for the + AUTHENTICATION option. There are several valid values for + _a_u_t_h_m_o_d_e_: + + debug Turns on authentication debugging code. + + user Only allow connections when the remote user can pro- + vide valid authentication information to identify the + remote user, and is allowed access to the specified + account without providing a password. + + valid Only allow connections when the remote user can pro- + vide valid authentication information to identify the + remote user. The login(1) command will provide any + additional user verification needed if the remote us- + er is not allowed automatic access to the specified + account. + + other Only allow connections that supply some authentica- + tion information. This option is currently not sup- + ported by any of the existing authentication mecha- + nisms, and is thus the same as specifying --aa vvaalliidd. + + none This is the default state. Authentication informa- + tion is not required. If no or insufficient authen- + tication information is provided, then the login(1) + program will provide the necessary user verification. + + off This disables the authentication code. All user ver- + ification will happen through the login(1) program. + + --BB Specifies bftp server mode. In this mode, tteellnneettdd causes + login to start a bftp(1) session rather than the user's nor- + mal shell. In bftp daemon mode normal logins are not sup- + ported, and it must be used on a port other than the normal + TELNET port. + + --DD _d_e_b_u_g_m_o_d_e + This option may be used for debugging purposes. This allows + tteellnneettdd to print out debugging information to the connec- + tion, allowing the user to see what tteellnneettdd is doing. There + + are several possible values for _d_e_b_u_g_m_o_d_e_: + + ooppttiioonnss Prints information about the negotiation of TELNET + options. + + rreeppoorrtt Prints the ooppttiioonnss information, plus some addi- + tional information about what processing is going + on. + + nneettddaattaa Displays the data stream received by tteellnneettdd.. + + ppttyyddaattaa Displays data written to the pty. + + eexxeerrcciissee Has not been implemented yet. + + --ddeebbuugg Enables debugging on each socket created by tteellnneettdd (see + SO_DEBUG in socket(2)). + + --eeddeebbuugg If tteellnneettdd has been compiled with support for data encryp- + tion, then the --eeddeebbuugg option may be used to enable encryp- + tion debugging code. + + --hh Disables the printing of host-specific information before + login has been completed. + + --II _i_n_i_t_i_d This option is only applicable to UNICOS systems prior to + 7.0. It specifies the ID from _/_e_t_c_/_i_n_i_t_t_a_b to use when init + starts login sessions. The default ID is fe. + + --kk This option is only useful if tteellnneettdd has been compiled with + both linemode and kludge linemode support. If the --kk option + is specified, then if the remote client does not support the + LINEMODE option, then tteellnneettdd will operate in character at a + time mode. It will still support kludge linemode, but will + only go into kludge linemode if the remote client requests + it. (This is done by by the client sending DONT SUPPRESS- + GO-AHEAD and DONT ECHO.) The --kk option is most useful when + there are remote clients that do not support kludge + linemode, but pass the heuristic (if they respond with WILL + TIMING-MARK in response to a DO TIMING-MARK) for kludge + linemode support. + + --ll Specifies line mode. Tries to force clients to use line- + at-a-time mode. If the LINEMODE option is not supported, it + will go into kludge linemode. + + --nn Disable TCP keep-alives. Normally tteellnneettdd enables the TCP + keep-alive mechanism to probe connections that have been + idle for some period of time to determine if the client is + still there, so that idle connections from machines that + have crashed or can no longer be reached may be cleaned up. + + --rr _l_o_w_p_t_y_-_h_i_g_h_p_t_y + This option is only enabled when tteellnneettdd is compiled for + UNICOS. It specifies an inclusive range of pseudo-terminal + devices to use. If the system has sysconf variable + _SC_CRAY_NPTY configured, the default pty search range is 0 + to _SC_CRAY_NPTY; otherwise, the default range is 0 to 128. + Either _l_o_w_p_t_y or _h_i_g_h_p_t_y may be omitted to allow changing + either end of the search range. If _l_o_w_p_t_y is omitted, the - + character is still required so that tteellnneettdd can differenti- + ate _h_i_g_h_p_t_y from _l_o_w_p_t_y. + + --ss This option is only enabled if tteellnneettdd is compiled with sup- + port for SecurID cards. It causes the --ss option to be + passed on to login(1), and thus is only useful if login(1) + supports the --ss flag to indicate that only SecurID validated + logins are allowed, and is usually useful for controlling + remote logins from outside of a firewall. + + --SS _t_o_s + + --uu _l_e_n This option is used to specify the size of the field in the + utmp structure that holds the remote host name. If the re- + solved host name is longer than _l_e_n, the dotted decimal val- + ue will be used instead. This allows hosts with very long + host names that overflow this field to still be uniquely + identified. Specifying --uu00 indicates that only dotted deci- + mal addresses should be put into the _u_t_m_p file. + + --UU This option causes tteellnneettdd to refuse connections from ad- + dresses that cannot be mapped back into a symbolic name via + the gethostbyaddr(3) routine. + + --XX _a_u_t_h_t_y_p_e This option is only valid if tteellnneettdd has been built with + support for the authentication option. It disables the use + of _a_u_t_h_t_y_p_e authentication, and can be used to temporarily + disable a specific authentication type without having to re- + compile tteellnneettdd. + + TTeellnneettdd operates by allocating a pseudo-terminal device (see pty(4)) for + a client, then creating a login process which has the slave side of the + pseudo-terminal as stdin, stdout and stderr. TTeellnneettdd manipulates the mas- + ter side of the pseudo-terminal, implementing the TELNET protocol and + passing characters between the remote client and the login process. + + When a TELNET session is started up, tteellnneettdd sends TELNET options to the + client side indicating a willingness to do the following TELNET options, + which are described in more detail below: + + DO AUTHENTICATION + WILL ENCRYPT + DO TERMINAL TYPE + DO TSPEED + DO XDISPLOC + DO NEW-ENVIRON + DO ENVIRON + WILL SUPPRESS GO AHEAD + DO ECHO + DO LINEMODE + DO NAWS + WILL STATUS + DO LFLOW + DO TIMING-MARK + + The pseudo-terminal allocated to the client is configured to operate in + cooked mode, and with XTABS and CRMOD enabled (see tty(4)). + + TTeellnneettdd has support for enabling locally the following TELNET options: + + WILL ECHO When the LINEMODE option is enabled, a WILL ECHO or + WONT ECHO will be sent to the client to indicate the + current state of terminal echoing. When terminal echo + is not desired, a WILL ECHO is sent to indicate that + telnetd will take care of echoing any data that needs + to be echoed to the terminal, and then nothing is + echoed. When terminal echo is desired, a WONT ECHO is + sent to indicate that telnetd will not be doing any + terminal echoing, so the client should do any terminal + echoing that is needed. + + WILL BINARY Indicates that the client is willing to send a 8 bits + of data, rather than the normal 7 bits of the Network + Virtual Terminal. + + WILL SGA Indicates that it will not be sending IAC GA, go + ahead, commands. + + WILL STATUS Indicates a willingness to send the client, upon re- + quest, of the current status of all TELNET options. + + WILL TIMING-MARK Whenever a DO TIMING-MARK command is received, it is + always responded to with a WILL TIMING-MARK + + WILL LOGOUT When a DO LOGOUT is received, a WILL LOGOUT is sent in + response, and the TELNET session is shut down. + + WILL ENCRYPT Only sent if tteellnneettdd is compiled with support for data + encryption, and indicates a willingness to decrypt the + data stream. + + TTeellnneettdd has support for enabling remotely the following TELNET options: + + DO BINARY Sent to indicate that telnetd is willing to receive an + 8 bit data stream. + + DO LFLOW Requests that the client handle flow control charac- + ters remotely. + + DO ECHO This is not really supported, but is sent to identify + a 4.2BSD telnet(1) client, which will improperly re- + spond with WILL ECHO. If a WILL ECHO is received, a + DONT ECHO will be sent in response. + + DO TERMINAL-TYPE Indicates a desire to be able to request the name of + the type of terminal that is attached to the client + side of the connection. + + DO SGA Indicates that it does not need to receive IAC GA, the + go ahead command. + + DO NAWS Requests that the client inform the server when the + window (display) size changes. + + DO TERMINAL-SPEED Indicates a desire to be able to request information + about the speed of the serial line to which the client + is attached. + + DO XDISPLOC Indicates a desire to be able to request the name of + the X windows display that is associated with the tel- + net client. + + DO NEW-ENVIRON Indicates a desire to be able to request environment + variable information, as described in RFC 1572. + + DO ENVIRON Indicates a desire to be able to request environment + variable information, as described in RFC 1408. + + DO LINEMODE Only sent if tteellnneettdd is compiled with support for + linemode, and requests that the client do line by line + processing. + + DO TIMING-MARK Only sent if tteellnneettdd is compiled with support for both + linemode and kludge linemode, and the client responded + with WONT LINEMODE. If the client responds with WILL + TM, the it is assumed that the client supports kludge + linemode. Note that the [--kk] option can be used to + + disable this. + + DO AUTHENTICATION Only sent if tteellnneettdd is compiled with support for au- + thentication, and indicates a willingness to receive + authentication information for automatic login. + + DO ENCRYPT Only sent if tteellnneettdd is compiled with support for data + encryption, and indicates a willingness to decrypt the + data stream. + +EENNVVIIRROONNMMEENNTT +FFIILLEESS + _/_e_t_c_/_s_e_r_v_i_c_e_s + _/_e_t_c_/_i_n_i_t_t_a_b (UNICOS systems only) + _/_e_t_c_/_i_p_t_o_s (if supported) + _/_u_s_r_/_u_c_b_/_b_f_t_p (if supported) + +SSEEEE AALLSSOO + telnet(1), login(1), bftp(1) (if supported) + +SSTTAANNDDAARRDDSS + RRFFCC--885544 TELNET PROTOCOL SPECIFICATION + RRFFCC--885555 TELNET OPTION SPECIFICATIONS + RRFFCC--885566 TELNET BINARY TRANSMISSION + RRFFCC--885577 TELNET ECHO OPTION + RRFFCC--885588 TELNET SUPPRESS GO AHEAD OPTION + RRFFCC--885599 TELNET STATUS OPTION + RRFFCC--886600 TELNET TIMING MARK OPTION + RRFFCC--886611 TELNET EXTENDED OPTIONS - LIST OPTION + RRFFCC--888855 TELNET END OF RECORD OPTION + RRFFCC--11007733 Telnet Window Size Option + RRFFCC--11007799 Telnet Terminal Speed Option + RRFFCC--11009911 Telnet Terminal-Type Option + RRFFCC--11009966 Telnet X Display Location Option + RRFFCC--11112233 Requirements for Internet Hosts -- Application and Support + RRFFCC--11118844 Telnet Linemode Option + RRFFCC--11337722 Telnet Remote Flow Control Option + RRFFCC--11441166 Telnet Authentication Option + RRFFCC--11441111 Telnet Authentication: Kerberos Version 4 + RRFFCC--11441122 Telnet Authentication: SPX + RRFFCC--11557711 Telnet Environment Option Interoperability Issues + RRFFCC--11557722 Telnet Environment Option + +BBUUGGSS + Some TELNET commands are only partially implemented. + + Because of bugs in the original 4.2 BSD telnet(1), tteellnneettdd performs some + dubious protocol exchanges to try to discover if the remote client is, in + fact, a 4.2 BSD telnet(1). + + Binary mode has no common interpretation except between similar operating + systems (Unix in this case). + + The terminal type name received from the remote client is converted to + lower case. + + TTeellnneettdd never sends TELNET IAC GA (go ahead) commands. + +4.2 Berkeley Distribution June 1, 1994 5 diff --git a/appl/telnet/telnetd/telnetd.8 b/appl/telnet/telnetd/telnetd.8 new file mode 100644 index 000000000..f618385ed --- /dev/null +++ b/appl/telnet/telnetd/telnetd.8 @@ -0,0 +1,607 @@ +.\" Copyright (c) 1983, 1993 +.\" The Regents of the University of California. All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" @(#)telnetd.8 8.4 (Berkeley) 6/1/94 +.\" +.Dd June 1, 1994 +.Dt TELNETD 8 +.Os BSD 4.2 +.Sh NAME +.Nm telnetd +.Nd DARPA +.Tn TELNET +protocol server +.Sh SYNOPSIS +.Nm /usr/libexec/telnetd +.Op Fl BUhlkns +.Op Fl D Ar debugmode +.Op Fl I Ns Ar initid +.Op Fl S Ar tos +.Op Fl X Ar authtype +.Op Fl a Ar authmode +.Op Fl edebug +.Op Fl r Ns Ar lowpty-highpty +.Op Fl u Ar len +.Op Fl debug Op Ar port +.Sh DESCRIPTION +The +.Nm telnetd +command is a server which supports the +.Tn DARPA +standard +.Tn TELNET +virtual terminal protocol. +.Nm Telnetd +is normally invoked by the internet server (see +.Xr inetd 8 ) +for requests to connect to the +.Tn TELNET +port as indicated by the +.Pa /etc/services +file (see +.Xr services 5 ) . +The +.Fl debug +option may be used to start up +.Nm telnetd +manually, instead of through +.Xr inetd 8 . +If started up this way, +.Ar port +may be specified to run +.Nm telnetd +on an alternate +.Tn TCP +port number. +.Pp +The +.Nm telnetd +command accepts the following options: +.Bl -tag -width "-a authmode" +.It Fl a Ar authmode +This option may be used for specifying what mode should +be used for authentication. +Note that this option is only useful if +.Nm telnetd +has been compiled with support for the +.Dv AUTHENTICATION +option. +There are several valid values for +.Ar authmode: +.Bl -tag -width debug +.It debug +Turns on authentication debugging code. +.It user +Only allow connections when the remote user +can provide valid authentication information +to identify the remote user, +and is allowed access to the specified account +without providing a password. +.It valid +Only allow connections when the remote user +can provide valid authentication information +to identify the remote user. +The +.Xr login 1 +command will provide any additional user verification +needed if the remote user is not allowed automatic +access to the specified account. +.It other +Only allow connections that supply some authentication information. +This option is currently not supported +by any of the existing authentication mechanisms, +and is thus the same as specifying +.Fl a +.Cm valid . +.It none +This is the default state. +Authentication information is not required. +If no or insufficient authentication information +is provided, then the +.Xr login 1 +program will provide the necessary user +verification. +.It off +This disables the authentication code. +All user verification will happen through the +.Xr login 1 +program. +.El +.It Fl B +Specifies bftp server mode. In this mode, +.Nm telnetd +causes login to start a +.Xr bftp 1 +session rather than the user's +normal shell. In bftp daemon mode normal +logins are not supported, and it must be used +on a port other than the normal +.Tn TELNET +port. +.It Fl D Ar debugmode +This option may be used for debugging purposes. +This allows +.Nm telnetd +to print out debugging information +to the connection, allowing the user to see what +.Nm telnetd +is doing. +There are several possible values for +.Ar debugmode: +.Bl -tag -width exercise +.It Cm options +Prints information about the negotiation of +.Tn TELNET +options. +.It Cm report +Prints the +.Cm options +information, plus some additional information +about what processing is going on. +.It Cm netdata +Displays the data stream received by +.Nm telnetd. +.It Cm ptydata +Displays data written to the pty. +.It Cm exercise +Has not been implemented yet. +.El +.It Fl debug +Enables debugging on each socket created by +.Nm telnetd +(see +.Dv SO_DEBUG +in +.Xr socket 2 ) . +.It Fl edebug +If +.Nm telnetd +has been compiled with support for data encryption, then the +.Fl edebug +option may be used to enable encryption debugging code. +.It Fl h +Disables the printing of host-specific information before +login has been completed. +.It Fl I Ar initid +This option is only applicable to +.Tn UNICOS +systems prior to 7.0. +It specifies the +.Dv ID +from +.Pa /etc/inittab +to use when init starts login sessions. The default +.Dv ID +is +.Dv fe. +.It Fl k +This option is only useful if +.Nm telnetd +has been compiled with both linemode and kludge linemode +support. If the +.Fl k +option is specified, then if the remote client does not +support the +.Dv LINEMODE +option, then +.Nm telnetd +will operate in character at a time mode. +It will still support kludge linemode, but will only +go into kludge linemode if the remote client requests +it. +(This is done by by the client sending +.Dv DONT SUPPRESS-GO-AHEAD +and +.Dv DONT ECHO . ) +The +.Fl k +option is most useful when there are remote clients +that do not support kludge linemode, but pass the heuristic +(if they respond with +.Dv WILL TIMING-MARK +in response to a +.Dv DO TIMING-MARK) +for kludge linemode support. +.It Fl l +Specifies line mode. Tries to force clients to use line- +at-a-time mode. +If the +.Dv LINEMODE +option is not supported, it will go +into kludge linemode. +.It Fl n +Disable +.Dv TCP +keep-alives. Normally +.Nm telnetd +enables the +.Tn TCP +keep-alive mechanism to probe connections that +have been idle for some period of time to determine +if the client is still there, so that idle connections +from machines that have crashed or can no longer +be reached may be cleaned up. +.It Fl r Ar lowpty-highpty +This option is only enabled when +.Nm telnetd +is compiled for +.Dv UNICOS. +It specifies an inclusive range of pseudo-terminal devices to +use. If the system has sysconf variable +.Dv _SC_CRAY_NPTY +configured, the default pty search range is 0 to +.Dv _SC_CRAY_NPTY; +otherwise, the default range is 0 to 128. Either +.Ar lowpty +or +.Ar highpty +may be omitted to allow changing +either end of the search range. If +.Ar lowpty +is omitted, the - character is still required so that +.Nm telnetd +can differentiate +.Ar highpty +from +.Ar lowpty . +.It Fl s +This option is only enabled if +.Nm telnetd +is compiled with support for +.Tn SecurID +cards. +It causes the +.Fl s +option to be passed on to +.Xr login 1 , +and thus is only useful if +.Xr login 1 +supports the +.Fl s +flag to indicate that only +.Tn SecurID +validated logins are allowed, and is +usually useful for controlling remote logins +from outside of a firewall. +.It Fl S Ar tos +.It Fl u Ar len +This option is used to specify the size of the field +in the +.Dv utmp +structure that holds the remote host name. +If the resolved host name is longer than +.Ar len , +the dotted decimal value will be used instead. +This allows hosts with very long host names that +overflow this field to still be uniquely identified. +Specifying +.Fl u0 +indicates that only dotted decimal addresses +should be put into the +.Pa utmp +file. +.ne 1i +.It Fl U +This option causes +.Nm telnetd +to refuse connections from addresses that +cannot be mapped back into a symbolic name +via the +.Xr gethostbyaddr 3 +routine. +.It Fl X Ar authtype +This option is only valid if +.Nm telnetd +has been built with support for the authentication option. +It disables the use of +.Ar authtype +authentication, and +can be used to temporarily disable +a specific authentication type without having to recompile +.Nm telnetd . +.El +.Pp +.Nm Telnetd +operates by allocating a pseudo-terminal device (see +.Xr pty 4 ) +for a client, then creating a login process which has +the slave side of the pseudo-terminal as +.Dv stdin , +.Dv stdout +and +.Dv stderr . +.Nm Telnetd +manipulates the master side of the pseudo-terminal, +implementing the +.Tn TELNET +protocol and passing characters +between the remote client and the login process. +.Pp +When a +.Tn TELNET +session is started up, +.Nm telnetd +sends +.Tn TELNET +options to the client side indicating +a willingness to do the +following +.Tn TELNET +options, which are described in more detail below: +.Bd -literal -offset indent +DO AUTHENTICATION +WILL ENCRYPT +DO TERMINAL TYPE +DO TSPEED +DO XDISPLOC +DO NEW-ENVIRON +DO ENVIRON +WILL SUPPRESS GO AHEAD +DO ECHO +DO LINEMODE +DO NAWS +WILL STATUS +DO LFLOW +DO TIMING-MARK +.Ed +.Pp +The pseudo-terminal allocated to the client is configured +to operate in \*(lqcooked\*(rq mode, and with +.Dv XTABS and +.Dv CRMOD +enabled (see +.Xr tty 4 ) . +.Pp +.Nm Telnetd +has support for enabling locally the following +.Tn TELNET +options: +.Bl -tag -width "DO AUTHENTICATION" +.It "WILL ECHO" +When the +.Dv LINEMODE +option is enabled, a +.Dv WILL ECHO +or +.Dv WONT ECHO +will be sent to the client to indicate the +current state of terminal echoing. +When terminal echo is not desired, a +.Dv WILL ECHO +is sent to indicate that +.Tn telnetd +will take care of echoing any data that needs to be +echoed to the terminal, and then nothing is echoed. +When terminal echo is desired, a +.Dv WONT ECHO +is sent to indicate that +.Tn telnetd +will not be doing any terminal echoing, so the +client should do any terminal echoing that is needed. +.It "WILL BINARY" +Indicates that the client is willing to send a +8 bits of data, rather than the normal 7 bits +of the Network Virtual Terminal. +.It "WILL SGA" +Indicates that it will not be sending +.Dv IAC GA, +go ahead, commands. +.It "WILL STATUS" +Indicates a willingness to send the client, upon +request, of the current status of all +.Tn TELNET +options. +.It "WILL TIMING-MARK" +Whenever a +.Dv DO TIMING-MARK +command is received, it is always responded +to with a +.Dv WILL TIMING-MARK +.ne 1i +.It "WILL LOGOUT" +When a +.Dv DO LOGOUT +is received, a +.Dv WILL LOGOUT +is sent in response, and the +.Tn TELNET +session is shut down. +.It "WILL ENCRYPT" +Only sent if +.Nm telnetd +is compiled with support for data encryption, and +indicates a willingness to decrypt +the data stream. +.El +.Pp +.Nm Telnetd +has support for enabling remotely the following +.Tn TELNET +options: +.Bl -tag -width "DO AUTHENTICATION" +.It "DO BINARY" +Sent to indicate that +.Tn telnetd +is willing to receive an 8 bit data stream. +.It "DO LFLOW" +Requests that the client handle flow control +characters remotely. +.It "DO ECHO" +This is not really supported, but is sent to identify a 4.2BSD +.Xr telnet 1 +client, which will improperly respond with +.Dv WILL ECHO. +If a +.Dv WILL ECHO +is received, a +.Dv DONT ECHO +will be sent in response. +.It "DO TERMINAL-TYPE" +Indicates a desire to be able to request the +name of the type of terminal that is attached +to the client side of the connection. +.It "DO SGA" +Indicates that it does not need to receive +.Dv IAC GA, +the go ahead command. +.It "DO NAWS" +Requests that the client inform the server when +the window (display) size changes. +.It "DO TERMINAL-SPEED" +Indicates a desire to be able to request information +about the speed of the serial line to which +the client is attached. +.It "DO XDISPLOC" +Indicates a desire to be able to request the name +of the X windows display that is associated with +the telnet client. +.It "DO NEW-ENVIRON" +Indicates a desire to be able to request environment +variable information, as described in RFC 1572. +.It "DO ENVIRON" +Indicates a desire to be able to request environment +variable information, as described in RFC 1408. +.It "DO LINEMODE" +Only sent if +.Nm telnetd +is compiled with support for linemode, and +requests that the client do line by line processing. +.It "DO TIMING-MARK" +Only sent if +.Nm telnetd +is compiled with support for both linemode and +kludge linemode, and the client responded with +.Dv WONT LINEMODE. +If the client responds with +.Dv WILL TM, +the it is assumed that the client supports +kludge linemode. +Note that the +.Op Fl k +option can be used to disable this. +.It "DO AUTHENTICATION" +Only sent if +.Nm telnetd +is compiled with support for authentication, and +indicates a willingness to receive authentication +information for automatic login. +.It "DO ENCRYPT" +Only sent if +.Nm telnetd +is compiled with support for data encryption, and +indicates a willingness to decrypt +the data stream. +.Sh ENVIRONMENT +.Sh FILES +.Pa /etc/services +.br +.Pa /etc/inittab +(UNICOS systems only) +.br +.Pa /etc/iptos +(if supported) +.br +.Pa /usr/ucb/bftp +(if supported) +.Sh "SEE ALSO" +.Xr telnet 1 , +.Xr login 1 , +.Xr bftp 1 +(if supported) +.Sh STANDARDS +.Bl -tag -compact -width RFC-1572 +.It Cm RFC-854 +.Tn TELNET +PROTOCOL SPECIFICATION +.It Cm RFC-855 +TELNET OPTION SPECIFICATIONS +.It Cm RFC-856 +TELNET BINARY TRANSMISSION +.It Cm RFC-857 +TELNET ECHO OPTION +.It Cm RFC-858 +TELNET SUPPRESS GO AHEAD OPTION +.It Cm RFC-859 +TELNET STATUS OPTION +.It Cm RFC-860 +TELNET TIMING MARK OPTION +.It Cm RFC-861 +TELNET EXTENDED OPTIONS - LIST OPTION +.It Cm RFC-885 +TELNET END OF RECORD OPTION +.It Cm RFC-1073 +Telnet Window Size Option +.It Cm RFC-1079 +Telnet Terminal Speed Option +.It Cm RFC-1091 +Telnet Terminal-Type Option +.It Cm RFC-1096 +Telnet X Display Location Option +.It Cm RFC-1123 +Requirements for Internet Hosts -- Application and Support +.It Cm RFC-1184 +Telnet Linemode Option +.It Cm RFC-1372 +Telnet Remote Flow Control Option +.It Cm RFC-1416 +Telnet Authentication Option +.It Cm RFC-1411 +Telnet Authentication: Kerberos Version 4 +.It Cm RFC-1412 +Telnet Authentication: SPX +.It Cm RFC-1571 +Telnet Environment Option Interoperability Issues +.It Cm RFC-1572 +Telnet Environment Option +.Sh BUGS +Some +.Tn TELNET +commands are only partially implemented. +.Pp +Because of bugs in the original 4.2 BSD +.Xr telnet 1 , +.Nm telnetd +performs some dubious protocol exchanges to try to discover if the remote +client is, in fact, a 4.2 BSD +.Xr telnet 1 . +.Pp +Binary mode +has no common interpretation except between similar operating systems +(Unix in this case). +.Pp +The terminal type name received from the remote client is converted to +lower case. +.Pp +.Nm Telnetd +never sends +.Tn TELNET +.Dv IAC GA +(go ahead) commands. diff --git a/appl/telnet/telnetd/telnetd.h b/appl/telnet/telnetd/telnetd.h new file mode 100644 index 000000000..234b9739e --- /dev/null +++ b/appl/telnet/telnetd/telnetd.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)telnetd.h 8.1 (Berkeley) 6/4/93 + */ + + +#include "defs.h" +#include "ext.h" + +#ifdef DIAGNOSTICS +#define DIAG(a,b) if (diagnostic & (a)) b +#else +#define DIAG(a,b) +#endif + +/* other external variables */ +extern char **environ; +extern int errno; + diff --git a/appl/xnlock/README b/appl/xnlock/README new file mode 100644 index 000000000..5b16c522f --- /dev/null +++ b/appl/xnlock/README @@ -0,0 +1,21 @@ +xnlock -- Dan Heller, 1990 +"nlock" is a "new lockscreen" type program... something that prevents +screen burnout by making most of it "black" while providing something +of interest to be displayed in case anyone is watching. The program +also provides added security. + +"xnlock" is the X11 version of the program. + +Original sunview version written by Dan Heller 1985 (not included). + +For a real description of how this program works, read the +man page or just try running it. + +The one major outstanding bug with this program is that every +once in a while, two horizontal lines appear below the little +figure that runs around the screen. If someone can find and +fix this bug, *please* let me know -- I don't have time to +look and if I waited till I had time, you'd never see this +program... It has something to do with the "looking down" +position and then directly moving up and right or left... + diff --git a/appl/xnlock/nose.0.left b/appl/xnlock/nose.0.left new file mode 100644 index 000000000..98f406432 --- /dev/null +++ b/appl/xnlock/nose.0.left @@ -0,0 +1,38 @@ +#define nose_0_left_width 64 +#define nose_0_left_height 64 +static char nose_0_left_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0x07,0x00,0x00,0x00,0x00,0x40,0x00, + 0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40, + 0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00, + 0x40,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0x3f,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x20,0x00, + 0x00,0xf8,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0xf0,0x03,0x00,0x00,0x80,0x00, + 0x00,0x00,0x0e,0x0c,0x00,0x00,0x80,0x01,0x00,0x00,0x03,0x30,0x00,0x00,0x00, + 0x01,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x40,0x00,0xc0,0x00,0x00, + 0x00,0x02,0x00,0x20,0x00,0x80,0x00,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0x00, + 0x00,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x08,0x00,0x00, + 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, + 0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08, + 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10, + 0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x01,0x00,0x00, + 0x18,0x00,0x20,0x00,0x00,0x01,0x00,0x00,0x08,0x00,0x40,0x00,0x80,0x00,0x00, + 0x00,0x08,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x0c,0x00,0x00,0x01,0x20,0x00, + 0x00,0x00,0x04,0x00,0x00,0x06,0x18,0x00,0x00,0x00,0x06,0x00,0x00,0xf8,0x07, + 0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x0f,0x00,0x00,0x00, + 0x00,0xff,0x00,0x04,0x10,0x00,0x00,0x00,0xc0,0x00,0x03,0x03,0x10,0x00,0x00, + 0x00,0x30,0x00,0x0c,0x01,0x20,0x00,0x00,0x00,0x08,0x00,0x98,0x00,0x20,0x00, + 0x00,0x00,0x0c,0x03,0x60,0x00,0x20,0x00,0x00,0x00,0xc2,0x00,0xc0,0x00,0x20, + 0x00,0x00,0x00,0x42,0x00,0x80,0x00,0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x01, + 0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x21,0x00,0x00, + 0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x01,0x00, + 0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02, + 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x00,0x00, + 0x18,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x10,0x00,0x00, + 0x00,0xc0,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.0.right b/appl/xnlock/nose.0.right new file mode 100644 index 000000000..f6433441b --- /dev/null +++ b/appl/xnlock/nose.0.right @@ -0,0 +1,38 @@ +#define nose_0_right_width 64 +#define nose_0_right_height 64 +static char nose_0_right_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0x03,0x00,0x00,0x00,0x00,0x20,0x00, + 0x00,0x02,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x20, + 0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00, + 0x20,0x00,0x00,0x02,0x00,0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0x1f,0x00,0x00, + 0x04,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x10,0x00, + 0x00,0xfc,0xff,0xff,0xff,0xff,0x1f,0x00,0x00,0x00,0x01,0x00,0x00,0xc0,0x0f, + 0x00,0x00,0x80,0x01,0x00,0x00,0x30,0x70,0x00,0x00,0x80,0x00,0x00,0x00,0x0c, + 0xc0,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x40,0x00,0x00,0x00, + 0x03,0x00,0x02,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x20,0x00,0x00, + 0x00,0x00,0x00,0x08,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x00, + 0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08, + 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10, + 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x18,0x00,0x00,0x80,0x00, + 0x00,0x08,0x00,0x10,0x00,0x00,0x80,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0x00, + 0x01,0x00,0x02,0x00,0x30,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x20,0x00,0x00, + 0x00,0x04,0x80,0x00,0x00,0x60,0x00,0x00,0x00,0x18,0x60,0x00,0x00,0x40,0x00, + 0x00,0x00,0xe0,0x1f,0x00,0x00,0x80,0xff,0xff,0xff,0x1f,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x1f,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0x20,0x00,0xff,0x00,0x00,0x00,0x00,0x08,0xc0,0xc0,0x00,0x03,0x00, + 0x00,0x00,0x04,0x80,0x30,0x00,0x0c,0x00,0x00,0x00,0x04,0x00,0x19,0x00,0x10, + 0x00,0x00,0x00,0x04,0x00,0x06,0xc0,0x30,0x00,0x00,0x00,0x04,0x00,0x03,0x00, + 0x43,0x00,0x00,0x00,0x04,0x00,0x01,0x00,0x42,0x00,0x00,0x00,0x04,0x80,0x00, + 0x00,0x84,0x00,0x00,0x00,0x04,0x80,0x00,0x00,0x84,0x00,0x00,0x00,0x04,0x00, + 0x00,0x00,0x84,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x02, + 0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x00, + 0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0e,0x00, + 0x00,0x00,0xf0,0xff,0xff,0xff,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.1.left b/appl/xnlock/nose.1.left new file mode 100644 index 000000000..6902cda61 --- /dev/null +++ b/appl/xnlock/nose.1.left @@ -0,0 +1,38 @@ +#define nose_1_left_width 64 +#define nose_1_left_height 64 +static char nose_1_left_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0x07,0x00,0x00,0x00,0x00,0x40,0x00, + 0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40, + 0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00, + 0x40,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0x3f,0x00,0x00, + 0x08,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x08,0x00,0x00,0x00,0x00,0x20,0x00, + 0x00,0xf8,0xff,0xff,0xff,0xff,0x3f,0x00,0x00,0xf0,0x03,0x00,0x00,0x80,0x00, + 0x00,0x00,0x0e,0x0c,0x00,0x00,0x80,0x01,0x00,0x00,0x03,0x30,0x00,0x00,0x00, + 0x01,0x00,0x80,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x40,0x00,0xc0,0x00,0x00, + 0x00,0x02,0x00,0x20,0x00,0x80,0x00,0x00,0x00,0x04,0x00,0x10,0x00,0x00,0x00, + 0x00,0x00,0x04,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0c,0x00,0x08,0x00,0x00, + 0x00,0x00,0x00,0x08,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x08,0x00, + 0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08, + 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10, + 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x01,0x00,0x00, + 0x18,0x00,0x10,0x00,0x00,0x01,0x00,0x00,0x08,0x00,0x20,0x00,0x80,0x00,0x00, + 0x00,0x08,0x00,0x40,0x00,0x40,0x00,0x00,0x00,0x0c,0x00,0x80,0x00,0x20,0x00, + 0x00,0x00,0xe4,0x00,0x00,0x03,0x18,0x00,0x00,0x00,0x26,0x03,0x00,0xfc,0x07, + 0x00,0x00,0x00,0x12,0x0c,0x00,0x00,0xf8,0xff,0xff,0xff,0x11,0x10,0x80,0x1f, + 0x00,0x00,0x00,0x00,0x08,0x20,0x60,0x60,0xc0,0x07,0x00,0x00,0x04,0x40,0x10, + 0xc0,0x20,0x08,0x00,0x1f,0x02,0x40,0x08,0x00,0x21,0x10,0xc0,0x60,0x02,0x40, + 0x04,0x00,0x12,0x20,0x20,0x80,0x02,0x20,0xc2,0x00,0x14,0x40,0x18,0x00,0x03, + 0x20,0x22,0x00,0x0c,0x80,0x04,0x03,0x02,0x10,0x12,0x00,0x08,0x80,0x86,0x00, + 0x04,0x10,0x12,0x00,0x10,0x80,0x42,0x00,0x18,0x08,0x12,0x00,0x10,0x40,0x42, + 0x00,0x00,0x04,0x02,0x00,0x20,0x40,0x42,0x00,0x00,0x04,0x02,0x00,0x00,0x20, + 0x42,0x00,0x00,0x02,0x04,0x00,0x00,0x20,0x02,0x00,0x00,0x01,0x04,0x00,0x00, + 0x20,0x02,0x00,0x00,0x01,0x08,0x00,0x00,0x20,0x04,0x00,0x80,0x00,0x10,0x00, + 0x00,0x20,0x0c,0x00,0x80,0x00,0x60,0x00,0x00,0x10,0x08,0x00,0x40,0x00,0x80, + 0xff,0xff,0x0f,0x30,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0x0f,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.1.right b/appl/xnlock/nose.1.right new file mode 100644 index 000000000..ff4aa5e36 --- /dev/null +++ b/appl/xnlock/nose.1.right @@ -0,0 +1,38 @@ +#define nose_1_right_width 64 +#define nose_1_right_height 64 +static char nose_1_right_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0x03,0x00,0x00,0x00,0x00,0x20,0x00, + 0x00,0x02,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x20, + 0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00, + 0x20,0x00,0x00,0x02,0x00,0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0x1f,0x00,0x00, + 0x04,0x00,0x00,0x00,0x00,0x10,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x10,0x00, + 0x00,0xfc,0xff,0xff,0xff,0xff,0x1f,0x00,0x00,0x00,0x01,0x00,0x00,0xc0,0x0f, + 0x00,0x00,0x80,0x01,0x00,0x00,0x30,0x70,0x00,0x00,0x80,0x00,0x00,0x00,0x0c, + 0xc0,0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x01,0x00,0x40,0x00,0x00,0x00, + 0x03,0x00,0x02,0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x04,0x00,0x20,0x00,0x00, + 0x00,0x00,0x00,0x08,0x00,0x30,0x00,0x00,0x00,0x00,0x00,0x08,0x00,0x10,0x00, + 0x00,0x00,0x00,0x00,0x10,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08, + 0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00, + 0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10, + 0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00, + 0x10,0x00,0x08,0x00,0x00,0x00,0x00,0x00,0x10,0x00,0x18,0x00,0x00,0x80,0x00, + 0x00,0x08,0x00,0x10,0x00,0x00,0x80,0x00,0x00,0x08,0x00,0x10,0x00,0x00,0x00, + 0x01,0x00,0x04,0x00,0x30,0x00,0x00,0x00,0x02,0x00,0x02,0x00,0x27,0x00,0x00, + 0x00,0x04,0x00,0x01,0xc0,0x64,0x00,0x00,0x00,0x18,0xc0,0x00,0x30,0x48,0x00, + 0x00,0x00,0xe0,0x3f,0x00,0x08,0x88,0xff,0xff,0xff,0x1f,0x00,0x00,0x04,0x10, + 0x00,0x00,0x00,0x00,0xf8,0x01,0x02,0x20,0x00,0x00,0xe0,0x03,0x06,0x06,0x02, + 0x40,0xf8,0x00,0x10,0x04,0x03,0x08,0x02,0x40,0x06,0x03,0x08,0x84,0x00,0x10, + 0x04,0x40,0x01,0x04,0x04,0x48,0x00,0x20,0x04,0xc0,0x00,0x18,0x02,0x28,0x00, + 0x43,0x08,0x40,0xc0,0x20,0x01,0x30,0x00,0x44,0x08,0x20,0x00,0x61,0x01,0x10, + 0x00,0x48,0x10,0x18,0x00,0x42,0x01,0x08,0x00,0x48,0x20,0x00,0x00,0x42,0x02, + 0x08,0x00,0x48,0x20,0x00,0x00,0x42,0x02,0x04,0x00,0x40,0x40,0x00,0x00,0x42, + 0x04,0x00,0x00,0x40,0x80,0x00,0x00,0x40,0x04,0x00,0x00,0x20,0x80,0x00,0x00, + 0x40,0x04,0x00,0x00,0x20,0x00,0x01,0x00,0x20,0x04,0x00,0x00,0x10,0x00,0x01, + 0x00,0x30,0x04,0x00,0x00,0x08,0x00,0x02,0x00,0x10,0x08,0x00,0x00,0x06,0x00, + 0x0c,0x00,0x0c,0xf0,0xff,0xff,0x01,0x00,0xf0,0xff,0x03,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.down b/appl/xnlock/nose.down new file mode 100644 index 000000000..ff3243084 --- /dev/null +++ b/appl/xnlock/nose.down @@ -0,0 +1,38 @@ +#define nose_down_width 64 +#define nose_down_height 64 +static char nose_down_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0xfc,0xff,0x01,0x00,0x00,0x00,0x00,0xc0,0x03,0x00,0x1e,0x00, + 0x00,0x00,0x00,0x38,0x00,0x00,0xe0,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00, + 0x03,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x04,0x00,0x00,0x40,0x00,0x00,0x00, + 0x00,0x08,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x30,0x00,0x00,0x10,0x00,0x80, + 0x1f,0x00,0x40,0x00,0x00,0x08,0x00,0x60,0x60,0x00,0x80,0x00,0x00,0x08,0x00, + 0x10,0x80,0x00,0x80,0x00,0x00,0x04,0x00,0x08,0x00,0x01,0x00,0x01,0x00,0x04, + 0x00,0x08,0x00,0x01,0x00,0x01,0x00,0x02,0x00,0x18,0x80,0x01,0x00,0x02,0x00, + 0x02,0x00,0x68,0x60,0x01,0x00,0x02,0x00,0x02,0x00,0x88,0x1f,0x01,0x00,0x02, + 0x00,0x02,0x00,0x08,0x00,0x01,0x00,0x02,0x00,0x02,0x00,0x10,0x80,0x00,0x00, + 0x03,0x00,0x06,0x00,0x60,0x60,0x00,0x80,0x02,0x00,0x0c,0x00,0x80,0x1f,0x00, + 0x40,0x01,0x00,0x14,0x00,0x00,0x00,0x00,0x20,0x01,0x00,0x28,0x00,0x00,0x00, + 0x00,0x90,0x00,0x00,0x50,0x00,0x00,0x00,0x00,0x48,0x00,0x00,0xa0,0x01,0x00, + 0x00,0x00,0x26,0x00,0x00,0x40,0x1e,0x00,0x00,0xc0,0x11,0x00,0x00,0x80,0xe1, + 0x03,0x00,0x3c,0x0c,0x00,0x00,0x00,0x0e,0xfc,0xff,0x83,0x03,0x00,0x00,0x00, + 0xf0,0x01,0x00,0x78,0x00,0x00,0x00,0x00,0x00,0xfe,0xff,0x0f,0x00,0x00,0x00, + 0x00,0x80,0x03,0x00,0x0c,0x00,0x00,0x00,0x00,0x80,0x02,0x00,0x14,0x00,0x00, + 0x00,0x00,0x60,0x04,0x00,0x12,0x00,0x00,0xc0,0x7f,0x10,0x04,0x00,0x22,0xe0, + 0x01,0x70,0xc0,0x18,0x08,0x00,0x61,0x1c,0x06,0x10,0x00,0x0f,0x30,0xc0,0x80, + 0x07,0x08,0x08,0x00,0x06,0xc0,0x3f,0x80,0x01,0x08,0x08,0x00,0x18,0x00,0x02, + 0xc0,0x00,0x10,0x04,0x00,0x30,0x00,0x05,0x30,0x00,0x10,0x04,0x00,0x00,0x80, + 0x08,0x18,0x00,0x20,0x04,0x00,0x00,0x80,0x08,0x00,0x00,0x20,0x04,0x00,0x00, + 0x40,0x10,0x00,0x00,0x20,0x24,0x00,0x00,0x40,0x10,0x00,0x00,0x22,0x24,0x00, + 0x00,0x40,0x10,0x00,0x00,0x22,0x44,0x00,0x00,0x40,0x10,0x00,0x00,0x11,0x84, + 0x01,0x00,0xc0,0x18,0x00,0xc0,0x10,0x08,0x00,0x00,0x80,0x08,0x00,0x00,0x08, + 0x30,0x00,0x00,0x80,0x08,0x00,0x00,0x04,0xe0,0xff,0xff,0xff,0xf8,0xff,0xff, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.front b/appl/xnlock/nose.front new file mode 100644 index 000000000..ad5f3b9f0 --- /dev/null +++ b/appl/xnlock/nose.front @@ -0,0 +1,38 @@ +#define nose_front_width 64 +#define nose_front_height 64 +static char nose_front_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0x07,0x00,0x00,0x00,0x00,0x40,0x00, + 0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40, + 0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00, + 0x40,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0x3f,0x00,0x00, + 0x08,0x00,0xc0,0x1f,0x00,0x20,0x00,0x00,0x08,0x00,0x30,0x60,0x00,0x20,0x00, + 0x00,0xf8,0xff,0x0f,0x80,0xff,0x3f,0x00,0x00,0x00,0x02,0x02,0x00,0x82,0x00, + 0x00,0x00,0x00,0x03,0x01,0x00,0x84,0x01,0x00,0x00,0x00,0x81,0x00,0x00,0x08, + 0x01,0x00,0x00,0x80,0x80,0x00,0x00,0x08,0x02,0x00,0x00,0x80,0x40,0x00,0x00, + 0x10,0x02,0x00,0x00,0x40,0x40,0x00,0x00,0x10,0x04,0x00,0x00,0x40,0x20,0x00, + 0x00,0x20,0x04,0x00,0x00,0x60,0x20,0x00,0x00,0x20,0x0c,0x00,0x00,0x20,0x20, + 0x00,0x00,0x20,0x08,0x00,0x00,0x20,0x20,0x00,0x00,0x20,0x08,0x00,0x00,0x10, + 0x20,0x00,0x00,0x20,0x10,0x00,0x00,0x10,0x20,0x00,0x00,0x20,0x10,0x00,0x00, + 0x10,0x20,0x00,0x00,0x20,0x10,0x00,0x00,0x10,0x40,0x00,0x00,0x10,0x10,0x00, + 0x00,0x10,0x40,0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x80,0x00,0x00,0x08,0x10, + 0x00,0x00,0x10,0x80,0x00,0x00,0x08,0x10,0x00,0x00,0x30,0x00,0x01,0x00,0x04, + 0x18,0x00,0x00,0x20,0x00,0x02,0x00,0x02,0x08,0x00,0x00,0x20,0x00,0x0c,0x80, + 0x01,0x08,0x00,0x00,0x60,0x00,0x30,0x60,0x00,0x0c,0x00,0x00,0x40,0x00,0xc0, + 0x1f,0x00,0x04,0x00,0x00,0xc0,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x0f,0xc0,0x0f,0x00,0x00,0x00, + 0x00,0x40,0x10,0x20,0x10,0x00,0x00,0x00,0x00,0x20,0x60,0x30,0x20,0x00,0x00, + 0x00,0x00,0x20,0xc0,0x18,0x20,0x00,0x00,0xc0,0x7f,0x10,0x80,0x0d,0x40,0xe0, + 0x01,0x70,0xc0,0x18,0x00,0x05,0x40,0x1c,0x06,0x10,0x00,0x0f,0x00,0x05,0x80, + 0x07,0x08,0x08,0x00,0x06,0x00,0x05,0x80,0x01,0x08,0x08,0x00,0x18,0x00,0x05, + 0xc0,0x00,0x10,0x04,0x00,0x30,0x00,0x05,0x30,0x00,0x10,0x04,0x00,0x00,0x80, + 0x08,0x18,0x00,0x20,0x04,0x00,0x00,0x80,0x08,0x00,0x00,0x20,0x04,0x00,0x00, + 0x40,0x10,0x00,0x00,0x20,0x24,0x00,0x00,0x40,0x10,0x00,0x00,0x22,0x24,0x00, + 0x00,0x40,0x10,0x00,0x00,0x22,0x44,0x00,0x00,0x40,0x10,0x00,0x00,0x11,0x84, + 0x01,0x00,0xc0,0x18,0x00,0xc0,0x10,0x08,0x00,0x00,0x80,0x08,0x00,0x00,0x08, + 0x30,0x00,0x00,0x80,0x08,0x00,0x00,0x04,0xe0,0xff,0xff,0xff,0xf8,0xff,0xff, + 0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.left.front b/appl/xnlock/nose.left.front new file mode 100644 index 000000000..86ffff571 --- /dev/null +++ b/appl/xnlock/nose.left.front @@ -0,0 +1,38 @@ +#define nose_left_front_width 64 +#define nose_left_front_height 64 +static char nose_left_front_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xc0,0xff,0xff,0x07,0x00,0x00,0x00,0x00,0x40,0x00, + 0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40, + 0x00,0x00,0x04,0x00,0x00,0x00,0x00,0x40,0x00,0x00,0x04,0x00,0x00,0x00,0x00, + 0x40,0x00,0x00,0x04,0x00,0x00,0x00,0xf8,0xff,0xff,0xff,0xff,0x3f,0x00,0x00, + 0x08,0x00,0xe0,0x0f,0x00,0x20,0x00,0x00,0x08,0x00,0x18,0x30,0x00,0x20,0x00, + 0x00,0xf8,0xff,0x07,0xc0,0xff,0x3f,0x00,0x00,0x00,0x02,0x01,0x00,0x81,0x00, + 0x00,0x00,0x00,0x83,0x00,0x00,0x82,0x01,0x00,0x00,0x00,0x41,0x00,0x00,0x04, + 0x01,0x00,0x00,0x80,0x40,0x00,0x00,0x04,0x02,0x00,0x00,0x80,0x20,0x00,0x00, + 0x08,0x02,0x00,0x00,0x40,0x20,0x00,0x00,0x08,0x04,0x00,0x00,0x40,0x10,0x00, + 0x00,0x10,0x04,0x00,0x00,0x60,0x10,0x00,0x00,0x10,0x0c,0x00,0x00,0x20,0x10, + 0x00,0x00,0x10,0x08,0x00,0x00,0x30,0x10,0x00,0x00,0x10,0x08,0x00,0x00,0x10, + 0x10,0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00, + 0x10,0x10,0x00,0x00,0x10,0x10,0x00,0x00,0x10,0x20,0x00,0x00,0x08,0x10,0x00, + 0x00,0x10,0x20,0x00,0x00,0x08,0x10,0x00,0x00,0x10,0x40,0x00,0x00,0x04,0x10, + 0x00,0x00,0x30,0x40,0x00,0x00,0x04,0x10,0x00,0x00,0x20,0x80,0x00,0x00,0x02, + 0x18,0x00,0x00,0x20,0x00,0x01,0x00,0x01,0x08,0x00,0x00,0x60,0x00,0x06,0xc0, + 0x00,0x08,0x00,0x00,0x80,0x00,0x18,0x30,0x00,0x0c,0x00,0x00,0x80,0x00,0xe0, + 0x0f,0x00,0x04,0x00,0x00,0x80,0x01,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x01, + 0x00,0x00,0x00,0x02,0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0x01,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x0f,0x00,0x00,0x00, + 0x00,0xff,0x00,0x04,0x10,0x00,0x00,0x00,0xe0,0x00,0x07,0x02,0x10,0x00,0x00, + 0x00,0x30,0x00,0x8c,0x01,0x20,0x00,0x00,0x00,0x0c,0x00,0x90,0x00,0x20,0x00, + 0x00,0x00,0x04,0x03,0x60,0x00,0x20,0x00,0x00,0x00,0xc2,0x00,0xc0,0x00,0x20, + 0x00,0x00,0x00,0x42,0x00,0x00,0x01,0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x02, + 0x20,0x00,0x00,0x00,0x21,0x00,0x00,0x06,0x20,0x00,0x00,0x00,0x21,0x00,0x00, + 0x00,0x20,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x03,0x00, + 0x00,0x00,0x40,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x02, + 0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x00,0x00, + 0x18,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x70,0x00,0x00,0x00,0x10,0x00,0x00, + 0x00,0xc0,0xff,0xff,0xff,0x0f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/nose.right.front b/appl/xnlock/nose.right.front new file mode 100644 index 000000000..b9c4fe814 --- /dev/null +++ b/appl/xnlock/nose.right.front @@ -0,0 +1,38 @@ +#define nose_right_front_width 64 +#define nose_right_front_height 64 +static char nose_right_front_bits[] = { + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0xe0,0xff,0xff,0x03,0x00,0x00,0x00,0x00,0x20,0x00, + 0x00,0x02,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x20, + 0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x02,0x00,0x00,0x00,0x00, + 0x20,0x00,0x00,0x02,0x00,0x00,0x00,0xfc,0xff,0xff,0xff,0xff,0x1f,0x00,0x00, + 0x04,0x00,0xf0,0x07,0x00,0x10,0x00,0x00,0x04,0x00,0x0c,0x18,0x00,0x10,0x00, + 0x00,0xfc,0xff,0x03,0xe0,0xff,0x1f,0x00,0x00,0x00,0x81,0x00,0x80,0x40,0x00, + 0x00,0x00,0x80,0x41,0x00,0x00,0xc1,0x00,0x00,0x00,0x80,0x20,0x00,0x00,0x82, + 0x00,0x00,0x00,0x40,0x20,0x00,0x00,0x02,0x01,0x00,0x00,0x40,0x10,0x00,0x00, + 0x04,0x01,0x00,0x00,0x20,0x10,0x00,0x00,0x04,0x02,0x00,0x00,0x20,0x08,0x00, + 0x00,0x08,0x02,0x00,0x00,0x30,0x08,0x00,0x00,0x08,0x06,0x00,0x00,0x10,0x08, + 0x00,0x00,0x08,0x04,0x00,0x00,0x10,0x08,0x00,0x00,0x08,0x0c,0x00,0x00,0x08, + 0x08,0x00,0x00,0x08,0x08,0x00,0x00,0x08,0x08,0x00,0x00,0x08,0x08,0x00,0x00, + 0x08,0x08,0x00,0x00,0x08,0x08,0x00,0x00,0x08,0x10,0x00,0x00,0x04,0x08,0x00, + 0x00,0x08,0x10,0x00,0x00,0x04,0x08,0x00,0x00,0x08,0x20,0x00,0x00,0x02,0x08, + 0x00,0x00,0x08,0x20,0x00,0x00,0x02,0x0c,0x00,0x00,0x18,0x40,0x00,0x00,0x01, + 0x04,0x00,0x00,0x10,0x80,0x00,0x80,0x00,0x04,0x00,0x00,0x10,0x00,0x03,0x60, + 0x00,0x06,0x00,0x00,0x30,0x00,0x0c,0x18,0x00,0x01,0x00,0x00,0x20,0x00,0xf0, + 0x07,0x00,0x01,0x00,0x00,0x60,0x00,0x00,0x00,0x80,0x01,0x00,0x00,0x40,0x00, + 0x00,0x00,0x80,0x00,0x00,0x00,0x80,0xff,0xff,0xff,0x7f,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0x1f,0x00,0x00,0x00,0x00,0x00, + 0x00,0x08,0x20,0x00,0xff,0x00,0x00,0x00,0x00,0x08,0x40,0xe0,0x00,0x07,0x00, + 0x00,0x00,0x04,0x80,0x31,0x00,0x0c,0x00,0x00,0x00,0x04,0x00,0x09,0x00,0x30, + 0x00,0x00,0x00,0x04,0x00,0x06,0xc0,0x20,0x00,0x00,0x00,0x04,0x00,0x03,0x00, + 0x43,0x00,0x00,0x00,0x04,0x80,0x00,0x00,0x42,0x00,0x00,0x00,0x04,0x40,0x00, + 0x00,0x84,0x00,0x00,0x00,0x04,0x60,0x00,0x00,0x84,0x00,0x00,0x00,0x04,0x00, + 0x00,0x00,0x84,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x80,0x00,0x00,0x00,0x02, + 0x00,0x00,0x00,0xc0,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00, + 0x02,0x00,0x00,0x00,0x40,0x00,0x00,0x00,0x04,0x00,0x00,0x00,0x20,0x00,0x00, + 0x00,0x04,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x0e,0x00, + 0x00,0x00,0xf0,0xff,0xff,0xff,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00}; diff --git a/appl/xnlock/xnlock.c.save b/appl/xnlock/xnlock.c.save new file mode 100644 index 000000000..597ab34e2 --- /dev/null +++ b/appl/xnlock/xnlock.c.save @@ -0,0 +1,860 @@ +/* + * xnlock -- Dan Heller, 1990 + * "nlock" is a "new lockscreen" type program... something that prevents + * screen burnout by making most of it "black" while providing something + * of interest to be displayed in case anyone is watching. + * "xnlock" is the X11 version of the program. + * Original sunview version written by Dan Heller 1985 (not included here). + */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#include "protos.h" +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#ifdef KERBEROS +#include +#include +#endif + +char STRING[] = "****************"; +#define MAX_PASSWD_LENGTH (sizeof(STRING)) + +/* The program should be something that outputs a small amount of text */ +#define DEFAULT_PROGRAM "fortune -s" +#define DEFAULT_TEXT "I'm out running around." +#define font_height(font) (font->ascent + font->descent) +#define FONT_NAME "-*-new century schoolbook-*-*-*-18-*" +#define when break;case +#define otherwise break;default + +XtAppContext app; +Display *dpy; +unsigned short Width, Height; +Widget widget; +GC gc; +XtIntervalId timeout_id; +char *ProgName, *words, *get_words(); +int x, y; +Pixel Black, White; +XFontStruct *font; +struct passwd *pw; +char root_pw[16]; +char *def_words = DEFAULT_TEXT; +int time_left, prompt_x, prompt_y, time_x, time_y; +void init_images(), countdown(), post_prompt_box(); +unsigned long interval, look(); +Pixmap left0, left1, right0, right1, left_front, + right_front, front, down; +int test; + +#define FROM_ARGV 1 +#define FROM_PROGRAM 2 +#define FROM_FILE 3 +#define FROM_RESRC 4 +int getwordsfrom = FROM_RESRC; + +#define IS_MOVING 1 +#define GET_PASSWD 2 +int state; /* indicates states: walking or getting passwd */ + +void ClearWindow(), GetPasswd(), Visibility(), move(); + +struct _resrcs { + Pixel fg, bg; + XFontStruct *font; + Boolean ignore_passwd; + Boolean do_reverse; + Boolean accept_root; + char *text, *text_prog, *file; +} Resrcs; + +static XtResource resources[] = { + { XtNfont, XtCFont, XtRFontStruct, sizeof (XFontStruct *), + XtOffsetOf(struct _resrcs,font), XtRImmediate, NULL }, + { XtNforeground, XtCForeground, XtRPixel, sizeof (Pixel), + /* note: the background is really the foreground color */ + XtOffsetOf(struct _resrcs,fg), XtRString, XtDefaultBackground }, + { XtNbackground, XtCBackground, XtRPixel, sizeof (Pixel), + /* note: the foreground is really the background color */ + XtOffsetOf(struct _resrcs,bg), XtRString, XtDefaultForeground }, + { XtNreverseVideo, XtCReverseVideo, XtRBoolean, sizeof(Boolean), + XtOffsetOf(struct _resrcs,do_reverse), XtRImmediate, (char *)False }, + { "ignorePasswd", "IgnorePasswd", XtRBoolean, sizeof(Boolean), + XtOffsetOf(struct _resrcs,ignore_passwd), XtRImmediate, (char *)False }, + { "acceptRootPasswd", "AcceptRootPasswd", XtRBoolean, sizeof(Boolean), + XtOffsetOf(struct _resrcs,accept_root), XtRImmediate, (char *)True }, + { "text", "Text", XtRString, sizeof(char *), + XtOffsetOf(struct _resrcs,text), XtRImmediate, DEFAULT_TEXT }, + { "program", "Program", XtRString, sizeof(char *), + XtOffsetOf(struct _resrcs,text_prog), XtRImmediate, DEFAULT_PROGRAM }, + { "file", "File", XtRString, sizeof(char *), + XtOffsetOf(struct _resrcs,file), XtRImmediate, NULL }, +}; + +static XrmOptionDescRec options[] = { + { "-fn", "font", XrmoptionSepArg, NULL }, + { "-fg", "foreground", XrmoptionSepArg, NULL }, + { "-bg", "background", XrmoptionSepArg, NULL }, + { "-rv", "reverseVideo", XrmoptionNoArg, "True" }, + { "-norv", "reverseVideo", XrmoptionNoArg, "False" }, + { "-ip", "ignorePasswd", XrmoptionNoArg, "True" }, + { "-noip", "ignorePasswd", XrmoptionNoArg, "False" }, + { "-ar", "acceptRootPasswd", XrmoptionNoArg, "True" }, + { "-noar", "acceptRootPasswd", XrmoptionNoArg, "False" }, +}; + +int +main (argc, argv) +int argc; +char *argv[]; +{ + register int i; + int foo; + Widget override; + XGCValues gcvalues; + char **list; + + if ((ProgName = rindex(*argv, '/')) != 0) + ProgName++; + else + ProgName = *argv; + + /* getpwuid() returns static pointer, so get root's passwd first */ + if (!(pw = getpwuid(0))) + printf("%s: can't get root's passwd!\n", ProgName), exit(1); + strcpy(root_pw, pw->pw_passwd); + if (!(pw = getpwuid(getuid()))) + printf("%s: Intruder alert!\n", ProgName), exit(1); + + XtToolkitInitialize(); + app = XtCreateApplicationContext(); + dpy = XtOpenDisplay(app, NULL, + "xnlock", "XNlock", options, XtNumber(options), &argc, argv); + + if (dpy == 0) + { + fprintf(stderr, "Error: Can't open display:\n"); + exit(1); + } + + Width = DisplayWidth(dpy, DefaultScreen(dpy)) + 2; + Height = DisplayHeight(dpy, DefaultScreen(dpy)) + 2; + override = XtVaAppCreateShell("xnlock", "XNlock", + overrideShellWidgetClass, dpy, XtNx, -1, XtNy, -1, NULL); + XtGetApplicationResources(override, &Resrcs, + resources, XtNumber(resources), NULL, 0); + + XtAddEventHandler(override, VisibilityChangeMask, FALSE, Visibility, NULL); + + widget = XtVaCreateManagedWidget("_foo", widgetClass, override, + XtNwidth, Width, + XtNheight, Height, + NULL); + + init_words(--argc, ++argv); + init_images(); + + /* the background is black and the little guy is white */ + Black = Resrcs.do_reverse? Resrcs.fg : Resrcs.bg; + White = Resrcs.do_reverse? Resrcs.bg : Resrcs.fg; + gcvalues.foreground = Black; + gcvalues.background = White; + + if (!(font = Resrcs.font)) { + list = XListFonts(dpy, FONT_NAME, 32767, &foo); + for (i = 0; i < foo; i++) + if ((font = XLoadQueryFont(dpy, list[i])) != 0) + break; + if (!font) + { + list = XListFonts(dpy, "fixed", 1, &foo); + font = XLoadQueryFont(dpy, list[0]); + } + if (!font) + XtError("Can't find a font (so call me stupid)."); + XFreeFontNames(list); + } + gcvalues.font = font->fid; + gcvalues.graphics_exposures = False; + gc = XCreateGC(dpy, DefaultRootWindow(dpy), + GCForeground | GCBackground | GCGraphicsExposures | GCFont, + &gcvalues); + + x = Width / 2; + y = Height / 2; + srand (time(0)); + state = IS_MOVING; + + { + static XtActionsRec actions[] = { + { "ClearWindow", ClearWindow }, + { "GetPasswd", GetPasswd }, + }; + XtAppAddActions(app, actions, XtNumber(actions)); + XtOverrideTranslations(widget, + XtParseTranslationTable( + ": ClearWindow() \n\ + : GetPasswd() \n\ + : GetPasswd()")); + } + + XtRealizeWidget(override); +#if 0 + XGrabServer(dpy); +#else + XGrabPointer(dpy, XtWindow(widget), TRUE, 0, GrabModeAsync, + GrabModeAsync, XtWindow(widget), None, CurrentTime); + XGrabKeyboard(dpy, XtWindow(widget), TRUE, GrabModeAsync, + GrabModeAsync, CurrentTime); +#endif + ScreenSaver(1); + XtAppMainLoop(app); + exit(0); +} + +static void +leave() +{ +#if 0 + XUngrabServer(dpy); +#else + XUngrabPointer(dpy, CurrentTime); + XUngrabKeyboard(dpy, CurrentTime); +#endif + ScreenSaver(0); + exit(0); +} + +static void +ScreenSaver(save) +{ + static int timeout, interval, prefer_blank, allow_exp; + if (save) { + XGetScreenSaver(dpy, &timeout, &interval, &prefer_blank, &allow_exp); + XSetScreenSaver(dpy, 0, interval, prefer_blank, allow_exp); + } else + /* restore state */ + XSetScreenSaver(dpy, timeout, interval, prefer_blank, allow_exp); +} + +static void +ClearWindow(w, event) +Widget w; +XExposeEvent *event; +{ + if (!XtIsRealized(w)) + return; + XSetForeground(dpy, gc, Black); + XFillRectangle(dpy, XtWindow(w), gc, + event->x, event->y, event->width, event->height); + XSetForeground(dpy, gc, White); + XSetBackground(dpy, gc, Black); + if (state == GET_PASSWD) + post_prompt_box(XtWindow(w)); + if (timeout_id == 0 && event->count == 0) { + timeout_id = XtAppAddTimeOut(app, 1000L, move, NULL); + /* first grab the input focus */ + XSetInputFocus(dpy, XtWindow(w), RevertToPointerRoot, CurrentTime); + /* now grab the pointer and keyboard and contrain to this window */ + XGrabPointer(dpy, XtWindow(w), TRUE, 0, GrabModeAsync, + GrabModeAsync, XtWindow(w), None, CurrentTime); + } +} + +static void +Visibility(w, client_data, event) +Widget w; +XtPointer client_data; +XVisibilityEvent *event; +{ + XRaiseWindow(dpy, XtWindow(w)); +} + +static void +init_words (argc, argv) +int argc; +char *argv[]; +{ + char buf[BUFSIZ]; + + while (*argv && **argv == '-') { + switch(argv[0][1]) { + case 'p': + getwordsfrom = FROM_PROGRAM; + if (!*++argv) + puts("specify a program name to get text from!"), exit(1); + Resrcs.text_prog = *argv; + case 'f': + getwordsfrom = FROM_FILE; + if (argv[1]) + Resrcs.file = *++argv; + else { + sprintf(buf, "%s/.msgfile", pw->pw_dir); + Resrcs.file = strcpy(XtMalloc(strlen(buf)+1), buf); + } + default : + printf("usage: %s [options] [message]\n", ProgName); + puts("-fg color foreground color"); + puts("-bg color background color"); + puts("-rv reverse foreground/background colors"); + puts("-nrv no reverse video"); + puts("-ip ignore passwd"); + puts("-nip don't ignore passwd"); + puts("-ar accept root's passwd to unlock"); + puts("-nar don't accept root's passwd"); + puts("-f [file] message is read from file or ~/.msgfile"); + puts("-prog program text is gotten from executing `program'"); + exit(1); + } + argv++; + } + if (*argv) { + if (getwordsfrom != FROM_RESRC) + puts("I don't know what text you want displayed."); + getwordsfrom = FROM_ARGV; + } else if (!getwordsfrom) + if (Resrcs.text) + getwordsfrom = FROM_RESRC; + else if (Resrcs.file) + getwordsfrom = FROM_FILE; + else + getwordsfrom = FROM_PROGRAM; + words = get_words(argv); /* if getwordsfrom != FROM_ARGV, argv is a nop */ +} + +static char * +get_words(argv) +char **argv; +{ + FILE *pp; + static char buf[BUFSIZ]; + register char *p = buf; + + if (getwordsfrom == FROM_RESRC) + return Resrcs.text; + if (getwordsfrom == FROM_PROGRAM) { + if (!(pp = popen(Resrcs.text_prog, "r"))) { + perror(Resrcs.text_prog); + return def_words; + } + } else if (getwordsfrom == FROM_FILE) + if (!(pp = fopen(Resrcs.file, "r"))) { + perror(Resrcs.file); + return def_words; + } + else if (getwordsfrom != FROM_PROGRAM && getwordsfrom != FROM_FILE) + return def_words; + + buf[0] = 0; + if (getwordsfrom == FROM_ARGV) { + while (*argv) { + p += strlen(strcpy(p, *argv)); + if (*++argv) + strcpy(p++, " "); + } + return buf; + } + + /* BUG Alert: does not check for overflow */ + while (fgets(p, sizeof buf, pp)) + p += strlen(p); + if (getwordsfrom == FROM_PROGRAM) + (void) pclose(pp); + else + (void) fclose (pp); + if (!buf[0]) + return def_words; + return buf; +} + +#define PROMPT "Password: " +#define FAIL_MSG "Sorry, try again" + +static void +GetPasswd(w, event) +Widget w; +XKeyEvent *event; +{ + static char passwd[MAX_PASSWD_LENGTH]; + static int cnt; + char c; + KeySym keysym; + + if (event->type == ButtonPress) { + x = event->x, y = event->y, test = 2; + return; + } + if (state == IS_MOVING) { + /* guy is running around--change to post prompt box. */ + XtRemoveTimeOut(timeout_id); + state = GET_PASSWD; + if (Resrcs.ignore_passwd || !strlen(pw->pw_passwd)) + leave(); + post_prompt_box(XtWindow(w)); + cnt = 0; + time_left = 30; + countdown(&time_left); + return; + } + if (event->type != KeyPress) + return; + if (!XLookupString(event, &c, 1, &keysym, 0)) + return; + if (keysym == XK_Return || keysym == XK_Linefeed) { + passwd[cnt] = 0; + XtRemoveTimeOut(timeout_id); + /* + * First try with root password, if allowed. + */ + if (Resrcs.accept_root && + (root_pw[0] == 0 && cnt == 0 || + cnt && root_pw[0] && !strcmp(crypt(passwd, root_pw), root_pw))) + leave(); + /* + * Try to verify as user. + */ +#ifdef KERBEROS + { + char realm[REALM_SZ]; + if (krb_get_lrealm(realm, 1) == KSUCCESS) + { + if (KSUCCESS == + krb_get_pw_in_tkt(pw->pw_name, + "", + realm, + "krbtgt", + realm, + DEFAULT_TKT_LIFE, + passwd)) + { + if (k_hasafs()) + { + int k_errno; + + if ((k_errno = k_afsklog(NULL)) != KSUCCESS) + fprintf(stderr, + "%s: Warning %s\n", + ProgName, + krb_err_txt[k_errno]); + } + leave(); + } + } + } +#endif /* KERBEROS */ + if (!strcmp(crypt(passwd, pw->pw_passwd), pw->pw_passwd)) + leave(); + + XDrawImageString(dpy, XtWindow(widget), gc, + time_x, time_y, FAIL_MSG, strlen(FAIL_MSG)); + time_left = 0; + state = IS_MOVING; + timeout_id = XtAppAddTimeOut(app, 2000L, countdown, &time_left); + return; + } + if (keysym == XK_BackSpace || keysym == XK_Delete || keysym == XK_Left) { + if (cnt) + passwd[cnt--] = ' '; + } else if (isprint(c)) + if (cnt >= MAX_PASSWD_LENGTH) + XBell(dpy, 50); + else + passwd[cnt++] = c; + else + return; + XDrawImageString(dpy, XtWindow(w), gc, + prompt_x, prompt_y, STRING, cnt); + XDrawImageString(dpy, XtWindow(w), gc, + prompt_x + XTextWidth(font, STRING, cnt), + prompt_y, " ", 11-cnt); +} + +static void +post_prompt_box(window) +Window window; +{ + char s[32]; + int width = (Width / 3); + int height = font_height(font) * 6; + int box_x, box_y; + + /* make sure the entire nose icon fits in the box */ + if (height < 100) + height = 100; + + time_x = prompt_x = Width / 3; + time_y = prompt_y = Height / 2; + box_x = prompt_x - 105; + box_y = prompt_y - 3 * font_height(font); + + sprintf (s, "User: %s", pw->pw_name); + /* erase current guy -- text message may still exist */ + XSetForeground(dpy, gc, Black); + XFillRectangle(dpy, window, gc, x, y, 64, 64); + talk(1); /* forcefully erase message if one is being displayed */ + /* Clear area in middle of screen for prompt box */ + XSetForeground(dpy, gc, White); + XFillRectangle(dpy, window, gc, box_x, box_y, width, height); + XSetForeground(dpy, gc, Black); + + /* make a box that's 5 pixels thick. Then add a thin box inside it */ + XSetLineAttributes(dpy, gc, 5, 0, 0, 0); + XDrawRectangle(dpy, window, gc, box_x+5, box_y+5, width-10, height-10); + XSetLineAttributes(dpy, gc, 0, 0, 0, 0); + XDrawRectangle(dpy, window, gc, box_x+12, box_y+12, width-23, height-23); + + XDrawString(dpy, window, gc, + prompt_x, prompt_y-font_height(font), s, strlen(s)); + XDrawString(dpy, window, gc, prompt_x, prompt_y, PROMPT, strlen(PROMPT)); + /* set background for copyplane and DrawImageString; need reverse video */ + XSetBackground(dpy, gc, White); + XCopyPlane(dpy, right0, window, gc, 0,0, 64,64, + box_x + 20, box_y + (height - 64)/2, 1L); + prompt_x += XTextWidth(font, PROMPT, strlen(PROMPT)); + time_y += 2*font_height(font); +} + +static void +countdown(timeout) +int *timeout; +{ + char buf[16]; + + if (--(*timeout) < 0) { + XExposeEvent event; + XtRemoveTimeOut(timeout_id); + state = IS_MOVING; + event.x = event.y = 0; + event.width = Width, event.height = Height; + ClearWindow(widget, &event); + timeout_id = XtAppAddTimeOut(app, 200L, move, NULL); + return; + } + sprintf(buf, "Time: %2.d ", (*timeout)+1); + XDrawImageString(dpy, XtWindow(widget), gc, + time_x, time_y, buf, strlen(buf)); + XtAppAddTimeOut(app, 1000L, countdown, timeout); +} + +#include "nose.0.left" +#include "nose.1.left" +#include "nose.0.right" +#include "nose.1.right" +#include "nose.left.front" +#include "nose.right.front" +#include "nose.front" +#include "nose.down" + +static void +init_images() +{ + static Pixmap *images[] = { + &left0, &left1, &right0, &right1, + &left_front, &right_front, &front, &down + }; + static char *bits[] = { + nose_0_left_bits, nose_1_left_bits, nose_0_right_bits, + nose_1_right_bits, nose_left_front_bits, nose_right_front_bits, + nose_front_bits, nose_down_bits + }; + int i; + + for (i = 0; i < XtNumber(images); i++) + if (!(*images[i] = + XCreatePixmapFromBitmapData(dpy, DefaultRootWindow(dpy), + bits[i], 64, 64, 1, 0, 1))) + XtError("Can't load nose images"); +} + +#define LEFT 001 +#define RIGHT 002 +#define DOWN 004 +#define UP 010 +#define FRONT 020 +#define X_INCR 3 +#define Y_INCR 2 + +static void +move() +{ + static int length, dir; + + if (!length) { + register int tries = 0; + dir = 0; + if ((rand() & 1) && think()) { + talk(0); /* sets timeout to itself */ + return; + } + if (!(rand() % 3) && (interval = look())) { + timeout_id = XtAppAddTimeOut(app, interval, move, NULL); + return; + } + interval = 20 + rand() % 100; + do { + if (!tries) + length = Width/100 + rand() % 90, tries = 8; + else + tries--; + switch (rand() % 8) { + case 0: + if (x - X_INCR*length >= 5) + dir = LEFT; + case 1: + if (x + X_INCR*length <= Width - 70) + dir = RIGHT; + case 2: + if (y - (Y_INCR*length) >= 5) + dir = UP, interval = 40; + case 3: + if (y + Y_INCR*length <= Height - 70) + dir = DOWN, interval = 20; + case 4: + if (x - X_INCR*length >= 5 && y - (Y_INCR*length) >= 5) + dir = (LEFT|UP); + case 5: + if (x + X_INCR * length <= Width - 70 && + y-Y_INCR * length >= 5) + dir = (RIGHT|UP); + case 6: + if (x - X_INCR * length >= 5 && + y + Y_INCR * length <= Height - 70) + dir = (LEFT|DOWN); + case 7: + if (x + X_INCR*length <= Width - 70 && + y + Y_INCR*length <= Height - 70) + dir = (RIGHT|DOWN); + } + } while (!dir); + } + walk(dir); + --length; + timeout_id = XtAppAddTimeOut(app, interval, move, NULL); +} + +static void +walk(dir) +register int dir; +{ + register int incr = 0; + static int lastdir; + static int up = 1; + static Pixmap frame; + + if (dir & (LEFT|RIGHT)) { /* left/right movement (mabye up/down too) */ + up = -up; /* bouncing effect (even if hit a wall) */ + if (dir & LEFT) { + incr = X_INCR; + frame = (up < 0) ? left0 : left1; + } else { + incr = -X_INCR; + frame = (up < 0) ? right0 : right1; + } + if ((lastdir == FRONT || lastdir == DOWN) && dir & UP) { + /* workaround silly bug that leaves screen dust when + * guy is facing forward or down and moves up-left/right. + */ + XCopyPlane(dpy, frame, XtWindow(widget), gc, 0, 0, 64,64, x, y, 1L); + XFlush(dpy); + } + /* note that maybe neither UP nor DOWN is set! */ + if (dir & UP && y > Y_INCR) + y -= Y_INCR; + else if (dir & DOWN && y < Height - 64) + y += Y_INCR; + } + /* Explicit up/down movement only (no left/right) */ + else if (dir == UP) + XCopyPlane(dpy, front, XtWindow(widget), gc, + 0,0, 64,64, x, y -= Y_INCR, 1L); + else if (dir == DOWN) + XCopyPlane(dpy, down, XtWindow(widget), gc, + 0,0, 64,64, x, y += Y_INCR, 1L); + else if (dir == FRONT && frame != front) { + if (up > 0) + up = -up; + if (lastdir & LEFT) + frame = left_front; + else if (lastdir & RIGHT) + frame = right_front; + else + frame = front; + XCopyPlane(dpy, frame, XtWindow(widget), gc, 0, 0, 64,64, x, y, 1L); + } + if (dir & LEFT) + while(--incr >= 0) { + XCopyPlane(dpy, frame, XtWindow(widget), gc, + 0,0, 64,64, --x, y+up, 1L); + XFlush(dpy); + } + else if (dir & RIGHT) + while(++incr <= 0) { + XCopyPlane(dpy, frame, XtWindow(widget), gc, + 0,0, 64,64, ++x, y+up, 1L); + XFlush(dpy); + } + lastdir = dir; +} + +static int +think() +{ + if (rand() & 1) + walk(FRONT); + if (rand() & 1) { + if (getwordsfrom > 1) + words = get_words((char **)NULL); + return 1; + } + return 0; +} + +#define MAXLINES 40 +static void +talk(force_erase) +int force_erase; +{ + int width = 0, height, Z, total = 0; + static int X, Y, talking; + static struct { int x, y, width, height; } s_rect; + register char *p, *p2; + char buf[BUFSIZ], *strcpy(), *index(), args[MAXLINES][256]; + + /* clear what we've written */ + if (talking || force_erase) { + if (!talking) + return; + if (talking == 2) { + XSetForeground(dpy, gc, Black); + XDrawString(dpy, XtWindow(widget), gc, X, Y, words, strlen(words)); + XSetForeground(dpy, gc, White); + } else if (talking == 1) { + XSetForeground(dpy, gc, Black); + XFillRectangle(dpy, XtWindow(widget), gc, s_rect.x-5, s_rect.y-5, + s_rect.width+10, s_rect.height+10); + XSetForeground(dpy, gc, White); + } + talking = 0; + if (!force_erase) + timeout_id = XtAppAddTimeOut(app, 40L, move, NULL); + return; + } + talking = 1; + walk(FRONT); + p = strcpy(buf, words); + + /* possibly avoid a lot of work here + * if no CR or only one, then just print the line + */ + if (!(p2 = index(p, '\n')) || !p2[1]) { + register int w; + + if (p2) + *p2 = 0; + w = XTextWidth(font, words, strlen(words)); + X = x + 32 - w/2; + Y = y - 5 - font_height(font); + /* give us a nice 5 pixel margin */ + if (X < 5) + X = 5; + else if (X + w + 15 > Width + 5) + X = Width - w - 5; + if (Y < 5) + Y = y + 64 + 5 + font_height(font); + XDrawString(dpy, XtWindow(widget), gc, X, Y, words, strlen(words)); + timeout_id = XtAppAddTimeOut(app, 5000L, (XtTimerCallbackProc)talk, + NULL); + talking++; + return; + } + + /* p2 now points to the first '\n' */ + for (height = 0; p; height++) { + int w; + *p2 = 0; + if ((w = XTextWidth(font, p, p2 - p)) > width) + width = w; + total += p2 - p; /* total chars; count to determine reading time */ + strcpy(args[height], p); + if (height == MAXLINES - 1) { + puts("Message too long!"); + break; + } + p = p2+1; + if (!(p2 = index(p, '\n'))) + break; + } + height++; + + /* Figure out the height and width in pixels (height, width) extend + * the new box by 15 pixels on the sides (30 total) top and bottom. + */ + s_rect.width = width + 30; + s_rect.height = height * font_height(font) + 30; + if (x - s_rect.width - 10 < 5) + s_rect.x = 5; + else + if ((s_rect.x = x+32-(s_rect.width+15)/2) + + s_rect.width+15 > Width-5) + s_rect.x = Width - 15 - s_rect.width; + if (y - s_rect.height - 10 < 5) + s_rect.y = y + 64 + 5; + else + s_rect.y = y - 5 - s_rect.height; + + XSetForeground(dpy, gc, White); + XFillRectangle(dpy, XtWindow(widget), gc, + s_rect.x-5, s_rect.y-5, s_rect.width+10, s_rect.height+10); + XSetForeground(dpy, gc, Black); + + /* make a box that's 5 pixels thick. Then add a thin box inside it */ + XSetLineAttributes(dpy, gc, 5, 0, 0, 0); + XDrawRectangle(dpy, XtWindow(widget), gc, + s_rect.x, s_rect.y, s_rect.width-1, s_rect.height-1); + XSetLineAttributes(dpy, gc, 0, 0, 0, 0); + XDrawRectangle(dpy, XtWindow(widget), gc, + s_rect.x + 7, s_rect.y + 7, s_rect.width - 15, s_rect.height - 15); + + X = 15; + Y = 15 + font_height(font); + + /* now print each string in reverse order (start at bottom of box) */ + for (Z = 0; Z < height; Z++) { + XDrawString(dpy, XtWindow(widget), gc, s_rect.x+X, s_rect.y+Y, + args[Z], strlen(args[Z])); + Y += font_height(font); + } + timeout_id = XtAppAddTimeOut(app, (total/15) * 1000, + (XtTimerCallbackProc)talk, NULL); +} + +static unsigned long +look() +{ + if (rand() % 3) { + XCopyPlane(dpy, (rand() & 1)? down : front, XtWindow(widget), gc, + 0, 0, 64,64, x, y, 1L); + return 1000L; + } + if (!(rand() % 5)) + return 0; + if (rand() % 3) { + XCopyPlane(dpy, (rand() & 1)? left_front : right_front, + XtWindow(widget), gc, 0, 0, 64,64, x, y, 1L); + return 1000L; + } + if (!(rand() % 5)) + return 0; + XCopyPlane(dpy, (rand() & 1)? left0 : right0, XtWindow(widget), gc, + 0, 0, 64,64, x, y, 1L); + return 1000L; +} diff --git a/appl/xnlock/xnlock.man b/appl/xnlock/xnlock.man new file mode 100644 index 000000000..c62417d06 --- /dev/null +++ b/appl/xnlock/xnlock.man @@ -0,0 +1,123 @@ +.\" xnlock -- Dan Heller 1985 +.TH XNLOCK 1L "19 April 1990" +.SH NAME +xnlock \- amusing lock screen program with message for passers-by +.SH SYNOPSIS +.B xnlock +[ +\fIoptions\fP +] +[ +\fImessage\fP +] +.SH DESCRIPTION +.I xnlock +is a program that acts as a screen saver for workstations running X11. +It also "locks" the screen such that the workstation can be left +unattended without worry that someone else will walk up to it and +mess everything up. When \fIxnlock\fP is running, a little man with +a big nose and a hat runs around spewing out messages to the screen. +By default, the messages are "humorous", but that depends on your +sense of humor. +.LP +If a key or mouse button is pressed, a prompt is printed requesting the +user's password. If a RETURN is not typed within 30 seconds, +the little man resumes running around. +.LP +Text on the command line is used as the message. For example: +.br + % xnlock I\'m out to lunch for a couple of hours. +.br +Note the need to quote shell metacharacters. +.LP +In the absence of flags or text, \fIxnlock\fP displays random fortunes. +.SH OPTIONS +Command line options override all resource specifications. +All arguments that are not associated with a command line option +is taken to be message text that the little man will "say" every +once in a while. The resource \fBxnlock.text\fP may be set to +a string. +.TP +.BI \-fn " fontname" +The default font is the first 18 point font in the \fInew century schoolbook\fP +family. While larger fonts are recokmmended over smaller ones, any font +in the server's font list will work. The resource to use for this option +is \fBxnlock.font\fP. +.TP +.BI \-filename " filename" +Take the message to be displayed from the file \fIfilename\fP. +If \fIfilename\fP is not specified, \fI$HOME/.msgfile\fP is used. +If the contents of the file are changed during runtime, the most recent text +of the file is used (allowing the displayed message to be altered remotely). +Carriage returns within the text are allowed, but tabs or other control +characters are not translated and should not be used. +The resource available for this option is \fBxnlock.file\fP. +.TP +.BI \-ar +Accept root's password to unlock screen. This option is true by +default. The reason for this is so that someone's screen may be +unlocked by autorized users in case of emergency and the person +running the program is still out to lunch. The resource available +for specifying this option is \fBxnlock.acceptRootPasswd\fP. +.TP +.BI \-noar +Don't accept root's password. This option is for paranoids who +fear their peers might breakin using root's password and remove +their files anyway. Specifying this option on the command line +overrides the \fBxnlock.acceptRootPasswd\fP if set to True. +.TP +.BI \-ip +Ignore password prompt. +The resource available for this option is \fBxnlock.ignorePasswd\fP. +.TP +.BI \-noip +Don't ignore password prompt. This is available in order to +override the resource \fBignorePasswd\fP if set to True. +.TP +.BI -fg " color" +Specifies the foreground color. The resource available for this +is \fBxnlock.foreground\fP. +.TP +.BI -bg " color" +Specifies the background color. The resource available for this +is \fBxnlock.background\fP. +.TP +.BI \-rv +Reverse the foreground and background colors. +The resource for this is \fBxvnlock.reverseVideo\fP. +.TP +.BI \-norv +Don't use reverse video. This is available to override the reverseVideo +resource if set to True. +.TP +.BI \-prog " program" +Receive message text from the running program \fIprogram\fP. If there +are arguments to \fIprogram\fP, encase them with the name of the program in +quotes (e.g. xnlock -t "fortune -o"). +The resource for this is \fBxnlock.program\fP. +.SH RESOURCES +.br +xnlock.font: fontname +.br +xnlock.foreground: color +.br +xnlock.background: color +.br +xnlock.reverseVideo: True/False +.br +xnlock.text: Some random text string +.br +xnlock.program: program [args] +.br +xnlock.ignorePasswd: True/False +.br +xnlock.acceptRootPasswd: True/False +.SH FILES +\fIxnlock\fP executable file +.br +~/.msgfile default message file +.SH AUTHOR +Dan Heller Copyright (c) 1985, 1990. +.br +The original version of this program was written using pixrects on +a Sun 2 running SunOS 1.1. diff --git a/lib/des/3cbc_enc.c b/lib/des/3cbc_enc.c new file mode 100644 index 000000000..6aefd0bdb --- /dev/null +++ b/lib/des/3cbc_enc.c @@ -0,0 +1,51 @@ +/* 3cbc_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +static void +xp(des_cblock *arg) +{ + unsigned char *a = (unsigned char *) arg; + int i; + for(i=0; i<8; i++) printf("%02X",a[i]);printf("\n"); +} + +int des_3cbc_encrypt(des_cblock (*input), des_cblock (*output), long int length, struct des_ks_struct *ks1, struct des_ks_struct *ks2, des_cblock (*iv1), des_cblock (*iv2), int encrypt) +{ + int off=length/8-1; + des_cblock niv1,niv2; + + printf("3cbc\n"); + xp(iv1); + xp(iv1); + xp(iv2); + xp(input); + if (encrypt == DES_ENCRYPT) + { + des_cbc_encrypt(input,output,length,ks1,iv1,encrypt); + if (length >= sizeof(des_cblock)) + memcpy(niv1,output[off],sizeof(des_cblock)); + des_cbc_encrypt(output,output,length,ks2,iv1,!encrypt); + des_cbc_encrypt(output,output,length,ks1,iv2, encrypt); + if (length >= sizeof(des_cblock)) + memcpy(niv2,output[off],sizeof(des_cblock)); + memcpy(*iv1,niv1,sizeof(des_cblock)); + } + else + { + if (length >= sizeof(des_cblock)) + memcpy(niv1,input[off],sizeof(des_cblock)); + des_cbc_encrypt(input,output,length,ks1,iv1,encrypt); + des_cbc_encrypt(output,output,length,ks2,iv2,!encrypt); + if (length >= sizeof(des_cblock)) + memcpy(niv2,output[off],sizeof(des_cblock)); + des_cbc_encrypt(output,output,length,ks1,iv2, encrypt); + } + memcpy(iv1,niv1,sizeof(des_cblock)); + memcpy(iv2,niv2,sizeof(des_cblock)); + xp(iv1); + xp(iv1); + xp(iv2); + xp(output); + return(0); +} diff --git a/lib/des/3ecb_enc.c b/lib/des/3ecb_enc.c new file mode 100644 index 000000000..bf303510d --- /dev/null +++ b/lib/des/3ecb_enc.c @@ -0,0 +1,26 @@ +/* 3ecb_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +int des_3ecb_encrypt(des_cblock (*input), des_cblock (*output), struct des_ks_struct *ks1, struct des_ks_struct *ks2, int encrypt) +{ + register u_int32_t l0,l1; + register unsigned char *in,*out; + u_int32_t ll[2]; + + in=(unsigned char *)input; + out=(unsigned char *)output; + c2l(in,l0); + c2l(in,l1); + ll[0]=l0; + ll[1]=l1; + des_encrypt(ll,ll,ks1,encrypt); + des_encrypt(ll,ll,ks2,!encrypt); + des_encrypt(ll,ll,ks1,encrypt); + l0=ll[0]; + l1=ll[1]; + l2c(l0,out); + l2c(l1,out); + return(0); +} + diff --git a/lib/des/ARTISTIC b/lib/des/ARTISTIC new file mode 100644 index 000000000..b3826572d --- /dev/null +++ b/lib/des/ARTISTIC @@ -0,0 +1,105 @@ + + The "Artistic License" + + Preamble + +The intent of this document is to state the conditions under which a +Package may be copied, such that the Copyright Holder maintains some +semblance of artistic control over the development of the package, +while giving the users of the package the right to use and distribute +the Package in a more-or-less customary fashion, plus the right to make +reasonable modifications. + +Definitions: + + "Package" refers to the collection of files distributed by the + Copyright Holder, and derivatives of that collection of files + created through textual modification. + + "Standard Version" refers to such a Package if it has not been + modified, or has been modified in accordance with the wishes + of the Copyright Holder as specified below. + + "Copyright Holder" is whoever is named in the copyright or + copyrights for the package. + + "You" is you, if you're thinking about copying or distributing + this Package. + + "Reasonable copying fee" is whatever you can justify on the + basis of media cost, duplication charges, time of people involved, + and so on. (You will not be required to justify it to the + Copyright Holder, but only to the computing community at large + as a market that must bear the fee.) + + "Freely Available" means that no fee is charged for the item + itself, though there may be fees involved in handling the item. + It also means that recipients of the item may redistribute it + under the same conditions they received it. + +1. You may make and give away verbatim copies of the source form of the +Standard Version of this Package without restriction, provided that you +duplicate all of the original copyright notices and associated disclaimers. + +2. You may apply bug fixes, portability fixes and other modifications +derived from the Public Domain or from the Copyright Holder. A Package +modified in such a way shall still be considered the Standard Version. + +3. You may otherwise modify your copy of this Package in any way, provided +that you insert a prominent notice in each changed file stating how and +when you changed that file, and provided that you do at least ONE of the +following: + + a) place your modifications in the Public Domain or otherwise make them + Freely Available, such as by posting said modifications to Usenet or + an equivalent medium, or placing the modifications on a major archive + site such as uunet.uu.net, or by allowing the Copyright Holder to include + your modifications in the Standard Version of the Package. + + b) use the modified Package only within your corporation or organization. + + c) rename any non-standard executables so the names do not conflict + with standard executables, which must also be provided, and provide + a separate manual page for each non-standard executable that clearly + documents how it differs from the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +4. You may distribute the programs of this Package in object code or +executable form, provided that you do at least ONE of the following: + + a) distribute a Standard Version of the executables and library files, + together with instructions (in the manual page or equivalent) on where + to get the Standard Version. + + b) accompany the distribution with the machine-readable source of + the Package with your modifications. + + c) give non-standard executables non-standard names, and clearly + document the differences in manual pages (or equivalent), together + with instructions on where to get the Standard Version. + + d) make other distribution arrangements with the Copyright Holder. + +5. You may charge a reasonable copying fee for any distribution of this +Package. You may charge any fee you choose for support of this +Package. You may not charge a fee for this Package itself. However, +you may distribute this Package in aggregate with other (possibly +commercial) programs as part of a larger (possibly commercial) software +distribution provided that you do not advertise this Package as a +product of your own. + +6. Any programs linked with this library do not automatically fall +under the copyright of this Package, but belong to whomever generated +them, and may be sold commercially, and may be aggregated with this +Package. + +7. The name of the Copyright Holder may not be used to endorse or promote +products derived from this software without specific prior written permission. + +8. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED +WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + + The End + diff --git a/lib/des/CHANGES b/lib/des/CHANGES new file mode 100644 index 000000000..4f441fae2 --- /dev/null +++ b/lib/des/CHANGES @@ -0,0 +1,16 @@ +The main changes in this package since it was last posted to +comp.sources.misc are + +The main changes are +- Major changes to the Copyright restrictions. +- Lots and lots of features added to the des(1) command, including + - Triple DES, both triple ECB and triple CBC options. + - uuencodeing/uudecoding built in to des(1). + - generate checksums. + - hex keys. +- Cleaned up the prototypes in des.h +- Filenames are now mostly <= 8 characters long. +- OFB, CFB, triple ECB and triple CBC modes of DES added to the library. +- Compiles and runs of all 64bit machines I could test the code on + (Cray, ETA10, DEC Alpha). +- It really does work with kerberos v 4 now :-). diff --git a/lib/des/COPYING b/lib/des/COPYING new file mode 100644 index 000000000..9b1a9329f --- /dev/null +++ b/lib/des/COPYING @@ -0,0 +1,489 @@ +Copyright (C) 1993 Eric Young + +This is a DES implementation written by Eric Young (eay@psych.psy.uq.oz.au) +The implementation was written so as to conform with the manual entry +for the des_crypt(3) library routines from MIT's project Athena. + + + + GNU LIBRARY GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the library GPL. It is + numbered 2 because it goes with version 2 of the ordinary GPL.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Library General Public License, applies to some +specially designated Free Software Foundation software, and to any +other libraries whose authors decide to use it. You can use it for +your libraries, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if +you distribute copies of the library, or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link a program with the library, you must provide +complete object files to the recipients so that they can relink them +with the library, after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + Our method of protecting your rights has two steps: (1) copyright +the library, and (2) offer you this license which gives you legal +permission to copy, distribute and/or modify the library. + + Also, for each distributor's protection, we want to make certain +that everyone understands that there is no warranty for this free +library. If the library is modified by someone else and passed on, we +want its recipients to know that what they have is not the original +version, so that any problems introduced by others will not reflect on +the original authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that companies distributing free +software will individually obtain patent licenses, thus in effect +transforming the program into proprietary software. To prevent this, +we have made it clear that any patent must be licensed for everyone's +free use or not licensed at all. + + Most GNU software, including some libraries, is covered by the ordinary +GNU General Public License, which was designed for utility programs. This +license, the GNU Library General Public License, applies to certain +designated libraries. This license is quite different from the ordinary +one; be sure to read it in full, and don't assume that anything in it is +the same as in the ordinary license. + + The reason we have a separate public license for some libraries is that +they blur the distinction we usually make between modifying or adding to a +program and simply using it. Linking a program with a library, without +changing the library, is in some sense simply using the library, and is +analogous to running a utility program or application program. However, in +a textual and legal sense, the linked executable is a combined work, a +derivative of the original library, and the ordinary General Public License +treats it as such. + + Because of this blurred distinction, using the ordinary General +Public License for libraries did not effectively promote software +sharing, because most developers did not use the libraries. We +concluded that weaker conditions might promote sharing better. + + However, unrestricted linking of non-free programs would deprive the +users of those programs of all benefit from the free status of the +libraries themselves. This Library General Public License is intended to +permit developers of non-free programs to use free libraries, while +preserving your freedom as a user of such programs to change the free +libraries that are incorporated in them. (We have not seen how to achieve +this as regards changes in header files, but we have achieved it as regards +changes in the actual functions of the Library.) The hope is that this +will lead to faster development of free libraries. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, while the latter only +works together with the library. + + Note that it is possible for a library to be covered by the ordinary +General Public License rather than by this special one. + + GNU LIBRARY GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library which +contains a notice placed by the copyright holder or other authorized +party saying it may be distributed under the terms of this Library +General Public License (also called "this License"). Each licensee is +addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also compile or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + c) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + d) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the source code distributed need not include anything that is normally +distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Library General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this library; if not, write to the Free + Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! diff --git a/lib/des/FILES b/lib/des/FILES new file mode 100644 index 000000000..a010ad1f8 --- /dev/null +++ b/lib/des/FILES @@ -0,0 +1,60 @@ +/* General stuff */ +CHANGES - Changes since the last posting to comp.sources.misc. +ARTISTIC - Copying info. +COPYING - Copying info. +MODES.DES - A description of the features of the different modes of DES. +FILES - This file. +INSTALL - How to make things compile. +Imakefile - For use with kerberos. +README - What this package is. +VERSION - Which version this is. +KERBEROS - Kerberos version 4 notes. +makefile - The make file. +times - Some outputs from 'speed' on my local machines. +vms.com - For use when compiling under VMS + +/* My sunOS des(1) replacement */ +des.c - des(1) source code. +des.man - des(1) manual. + +/* Testing and timing programs. */ +destest.c - Source for libdes.a test program. +speed.c - Source for libdes.a timing program. +rpw.c - Source for libdes.a testing password reading routines. + +/* libdes.a source code */ +des_crypt.man - libdes.a manual page. +des.h - Public libdes.a header file. +ecb_enc.c - des_ecb_encrypt() source, this contains the basic DES code. +3ecb_enc.c - des_3ecb_encrypt() source. +cbc_ckm.c - des_cbc_cksum() source. +cbc_enc.c - des_cbc_encrypt() source. +3cbc_enc.c - des_3cbc_encrypt() source. +cfb_enc.c - des_cfb_encrypt() source. +ofb_enc.c - des_cfb_encrypt() source. +enc_read.c - des_enc_read() source. +enc_writ.c - des_enc_write() source. +pcbc_enc.c - des_pcbc_encrypt() source. +qud_cksm.c - quad_cksum() source. +rand_key.c - des_random_key() source. +read_pwd.c - Source for des_read_password() plus related functions. +set_key.c - Source for des_set_key(). +str2key.c - Covert a string of any length into a key. +fcrypt.c - A small, fast version of crypt(3). +des_locl.h - Internal libdes.a header file. +podd.h - Odd parity tables - used in des_set_key(). +sk.h - Lookup tables used in des_set_key(). +spr.h - What is left of the S tables - used in ecb_encrypt(). + +/* The perl scripts - you can ignore these files they are only + * included for the curious */ +des.pl - des in perl anyone? des_set_key and des_ecb_encrypt + both done in a perl library. +testdes.pl - Testing program for des.pl +doIP - Perl script used to develop IP xor/shift code. +doPC1 - Perl script used to develop PC1 xor/shift code. +doPC2 - Generates sk.h. +PC1 - Output of doPC1 should be the same as output from PC1. +PC2 - used in development of doPC2. +shifts.pl - Perl library used by my perl scripts. + diff --git a/lib/des/INSTALL b/lib/des/INSTALL new file mode 100644 index 000000000..d34debe4f --- /dev/null +++ b/lib/des/INSTALL @@ -0,0 +1,53 @@ +Check the CC and CFLAGS lines in the makefile + +If your C library does not support the times(3) function, change the +#define TIMES to +#undef TIMES in speed.c +If it does, check the HZ value for the times(3) function. +If your system does not define CLK_TCK it will be assumed to +be 60. + +If possible use gcc v 2.2.2 +Turn on the maximum optimising + +type 'make' + +run './destest' to check things are ok. +run './rpw' to check the tty code for reading passwords works. +run './speed' to see how fast those optimisations make the library run :-) + +A make install will by default install +libdes.a in /usr/local/lib/libdes.a +des in /usr/local/bin/des +des_crypt.man in /usr/local/man/man3/des_crypt.3 +des.man in /usr/local/man/man1/des.1 +des.h in /usr/include/des.h + +des(1) should be compatible with sunOS's but I have been unable to +test it. + +These routines should compile on MSDOS, most 32bit and 64bit version +of Unix (BSD and SYSV) and VMS, without modification. +The only problems should be #include files that are in the wrong places. + +These routines can be compiled under MSDOS. +I have successfully encrypted files using des(1) under MSDOS and then +decrypted the files on a SparcStation. +I have been able to compile and test the routines with +Microsoft C v 5.1 and Turbo C v 2.0. +The code in this library is in no way optimised for the 16bit +operation of MSDOS. Microsoft C generates code that is 40% slower +than Turbo C's code. I believe this is due to problems it has with +code generation with the 32bit shift operation in the IP and FP +sections. I have added some 16bit optimization in ecb_encrypt.c +and this generated a %70 speedup under Turbo C. Such are the +limitations of DOS compilers :-(. + +For Turbo C v 2.0, make sure to define MSDOS, in the relevant menu. + +There is an alternative version of the D_ENCRYPT macro that can be +enabled with the -DALT_ECB option in the makefile. This alternative +macro can make a +-%20 speed difference to the DES encryption speed, +depending on the compiler/CPU combinations. +It has its greatest effect on Sparc machines when using the sun compiler. +If in doubt, try enable/disable it and running speed. diff --git a/lib/des/Imakefile b/lib/des/Imakefile new file mode 100644 index 000000000..5b2310657 --- /dev/null +++ b/lib/des/Imakefile @@ -0,0 +1,33 @@ +# This Imakefile has not been tested for a while but it should still +# work when placed in the correct directory in the kerberos v 4 distribution + +SRCS= cbc_cksm.c cbc_enc.c ecb_enc.c pcbc_enc.c \ + qud_cksm.c rand_key.c read_pwd.c set_key.c str2key.c \ + enc_read.c enc_writ.c cfb_enc.c \ + 3ecb_enc.c ofb_enc.c 3cbc_enc.c rnd_keys.c + +OBJS= cbc_cksm.o cbc_enc.o ecb_enc.o pcbc_enc.o \ + qud_cksm.o rand_key.o read_pwd.o set_key.o str2key.o \ + enc_read.o enc_writ.o cfb_enc.o \ + 3ecb_enc.o ofb_enc.o 3cbc_enc.o rnd_keys.o + +GENERAL=COPYING FILES INSTALL Imakefile README VERSION makefile times \ + vms.com KERBEROS +DES= des.c des.man +TESTING=destest.c speed.c rpw.c +LIBDES= des_crypt.man des.h des_locl.h podd.h sk.h spr.h + +PERL= des.pl testdes.pl doIP doPC1 doPC2 PC1 PC2 shifts.pl + +CODE= $(GENERAL) $(DES) $(TESTING) $(SRCS) $(LIBDES) $(PERL) + +SRCDIR=$(SRCTOP)/lib/des + +library_obj_rule() + +install_library_target(des,$(OBJS),$(SRCS),) + +test(destest,libdes.a,) +test(rpw,libdes.a,) +test(speed,libdes.a,) +test(des,libdes.a,) diff --git a/lib/des/KERBEROS b/lib/des/KERBEROS new file mode 100644 index 000000000..d8734b27f --- /dev/null +++ b/lib/des/KERBEROS @@ -0,0 +1,38 @@ +To use this library with Bones (kerberos without DES): +1) Get my modified Bones - eBones. It can be found on + gondwana.ecr.mu.oz.au (128.250.1.63) /pub/athena/eBones-p9.tar.Z + and + nic.funet.fi (128.214.6.100) /pub/unix/security/Kerberos/eBones-p9.tar.Z + +2) Unpack this library in src/lib/des, makeing sure it is version + 3.00 or greater (libdes.tar.93-10-07.Z). This versions differences + from the version in comp.sources.misc volume 29 patchlevel2. + The primarily difference is that it should compile under kerberos :-). + It can be found at. + ftp.psy.uq.oz.au (130.102.32.1) /pub/DES/libdes.tar.93-10-07.Z + +Now do a normal kerberos build and things should work. + +One problem I found when I was build on my local sun. +--- +For sunOS 4.1.1 apply the following patch to src/util/ss/make_commands.c + +*** make_commands.c.orig Fri Jul 3 04:18:35 1987 +--- make_commands.c Wed May 20 08:47:42 1992 +*************** +*** 98,104 **** + if (!rename(o_file, z_file)) { + if (!vfork()) { + chdir("/tmp"); +! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r", "-n", + z_file+5, 0); + perror("/bin/ld"); + _exit(1); +--- 98,104 ---- + if (!rename(o_file, z_file)) { + if (!vfork()) { + chdir("/tmp"); +! execl("/bin/ld", "ld", "-o", o_file+5, "-s", "-r", + z_file+5, 0); + perror("/bin/ld"); + _exit(1); diff --git a/lib/des/MODES.DES b/lib/des/MODES.DES new file mode 100644 index 000000000..fe9c03804 --- /dev/null +++ b/lib/des/MODES.DES @@ -0,0 +1,84 @@ +Modes of DES +Quite a bit of the following information has been taken from + AS 2805.5.2 + Australian Standard + Electronic funds transfer - Requirements for interfaces, + Part 5.2: Modes of operation for an n-bit block cipher algorithm + Appendix A + +There are several different modes in which DES can be used, they are +as follows. + +Electronic Codebook Mode (ECB) (des_ecb_encrypt()) +- 64 bits are enciphered at a time. +- The order of the blocks can be rearranged without detection. +- The same plaintext block always produces the same ciphertext block + (for the same key) making it vulnerable to a 'dictionary attack'. +- An error will only affect one ciphertext block. + +Cipher Block Chaining Mode (CBC) (des_cbc_encrypt()) +- a multiple of 64 bits are enciphered at a time. +- The CBC mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext blocks dependent on the + current and all preceding plaintext blocks and therefore blocks can not + be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- An error will affect the current and the following ciphertext blocks. + +Cipher Feedback Mode (CFB) (des_cfb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The CFB mode produces the same ciphertext whenever the same + plaintext is encrypted using the same key and starting variable. +- The chaining operation makes the ciphertext variables dependent on the + current and all preceding variables and therefore j-bit variables are + chained together and con not be rearranged. +- The use of different starting variables prevents the same plaintext + enciphering to the same ciphertext. +- The strength of the CFB mode depends on the size of k (maximal if + j == k). In my implementation this is always the case. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- An error will affect the current and the following ciphertext variables. + +Output Feedback Mode (OFB) (des_ofb_encrypt()) +- a number of bits (j) <= 64 are enciphered at a time. +- The OFB mode produces the same ciphertext whenever the same + plaintext enciphered using the same key and starting variable. More + over, in the OFB mode the same key stream is produced when the same + key and start variable are used. Consequently, for security reasons + a specific start variable should be used only once for a given key. +- The absence of chaining makes the OFB more vulnerable to specific attacks. +- The use of different start variables values prevents the same + plaintext enciphering to the same ciphertext, by producing different + key streams. +- Selection of a small value for j will require more cycles through + the encipherment algorithm per unit of plaintext and thus cause + greater processing overheads. +- Only multiples of j bits can be enciphered. +- OFB mode of operation does not extend ciphertext errors in the + resultant plaintext output. Every bit error in the ciphertext causes + only one bit to be in error in the deciphered plaintext. +- OFB mode is not self-synchronising. If the two operation of + encipherment and decipherment get out of synchronism, the system needs + to be re-initialised. +- Each re-initialisation should use a value of the start variable +different from the start variable values used before with the same +key. The reason for this is that an identical bit stream would be +produced each time from the same parameters. This would be +susceptible to a ' known plaintext' attack. + +Triple ECB Mode (des_3ecb_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key1 again. +- As for ECB encryption but increases the effective key length to 112 bits. +- If both keys are the same it is equivalent to encrypting once with + just one key. + +Triple CBC Mode (des_3cbc_encrypt()) +- Encrypt with key1, decrypt with key2 and encrypt with key1 again. +- As for CBC encryption but increases the effective key length to 112 bits. +- If both keys are the same it is equivalent to encrypting once with + just one key. diff --git a/lib/des/PC1 b/lib/des/PC1 new file mode 100755 index 000000000..efb8348b7 --- /dev/null +++ b/lib/des/PC1 @@ -0,0 +1,28 @@ +#!/usr/local/bin/perl + +@PC1=( 57,49,41,33,25,17, 9, + 1,58,50,42,34,26,18, + 10, 2,59,51,43,35,27, + 19,11, 3,60,52,44,36, + "-","-","-","-", + 63,55,47,39,31,23,15, + 7,62,54,46,38,30,22, + 14, 6,61,53,45,37,29, + 21,13, 5,28,20,12, 4, + "-","-","-","-", + ); + +foreach (@PC1) + { + if ($_ ne "-") + { + $_--; + $_=int($_/8)*8+7-($_%8); + printf "%2d ",$_; + } + else + { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + print "\n" if ((($i) % 32) == 0); + } + diff --git a/lib/des/PC2 b/lib/des/PC2 new file mode 100755 index 000000000..2d560270e --- /dev/null +++ b/lib/des/PC2 @@ -0,0 +1,57 @@ +#!/usr/local/bin/perl + +@PC2_C=(14,17,11,24, 1, 5, + 3,28,15, 6,21,10, + 23,19,12, 4,26, 8, + 16, 7,27,20,13, 2, + ); + +@PC2_D=(41,52,31,37,47,55, + 30,40,51,45,33,48, + 44,49,39,56,34,53, + 46,42,50,36,29,32, + ); + +foreach (@PC2_C) { + if ($_ ne "-") + { + $_--; + printf "%2d ",$_; } + else { print "-- "; } + $C{$_}=1; + print "\n" if (((++$i) % 8) == 0); + } +$i=0; +print "\n"; +foreach (@PC2_D) { + if ($_ ne "-") + { + $_-=29; + printf "%2d ",$_; } + else { print "-- "; } + $D{$_}=1; + print "\n" if (((++$i) % 8) == 0); } + +print "\n"; +foreach $i (0 .. 27) + { + $_=$C{$i}; + if ($_ ne "-") {printf "%2d ",$_;} + else { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + } +print "\n"; + +print "\n"; +foreach $i (0 .. 27) + { + $_=$D{$i}; + if ($_ ne "-") {printf "%2d ",$_;} + else { print "-- "; } + print "\n" if (((++$i) % 8) == 0); + } +print "\n"; +sub numsort + { + $a-$b; + } diff --git a/lib/des/README b/lib/des/README new file mode 100644 index 000000000..6acd62c20 --- /dev/null +++ b/lib/des/README @@ -0,0 +1,56 @@ + + libdes, Version 3.00 93/10/07 + + Copyright (c) 1993, Eric Young + All rights reserved. + + This program is free software; you can redistribute it and/or modify + it under the terms of either: + + a) the GNU General Public License as published by the Free + Software Foundation; either version 1, or (at your option) any + later version, or + + b) the "Artistic License" which comes with this Kit. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either + the GNU General Public License or the Artistic License for more details. + + You should have received a copy of the Artistic License with this + Kit, in the file named "Artistic". If not, I'll be glad to provide one. + + You should also have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +--- +This kit builds a DES encryption library and a DES encryption program. +It suports ecb, cbc, ofb, cfb, triple ecb, triple cbc and MIT's pcbc +encryption modes and also has a fast implementation of crypt(3). +It contains support routines to read keys from a terminal, +generate a random key, generate a key from an arbitary length string, +read/write encrypted data from/to a file descriptor. + +The implementation was written so as to conform with the manual entry +for the des_crypt(3) library routines from MIT's project Athena. + +destest should be run after compilation to test the des routines. +rpw should be run after compilation to test the read password routines. +The des program is a replacement for the sun des command. I believe it +conforms to the sun version. + +The Imakefile is setup for use in the kerberos distribution. + +These routines are best compiled with gcc or any other good +optimising compiler. +Just turn you optimiser up to the highest settings and run destest +after the build to make sure everything works. + +I believe these routines are close to the fastest and most portable DES +routines that use small lookup tables (4.5k) that are publicly available. +The fcrypt routine is faster than ufc's fcrypt (when compiling with +gcc2 -O2) on the sparc 2 (1410 vs 1270) but is not so good on other machines +(on a sun3/260 168 vs 336). + +Eric Young (eay@psych.psy.uq.oz.au) diff --git a/lib/des/VERSION b/lib/des/VERSION new file mode 100644 index 000000000..21e3b8dba --- /dev/null +++ b/lib/des/VERSION @@ -0,0 +1,185 @@ +Release apon comp.sources.misc +Version 3.01 08/10/93 + Added des_3cbc_encrypt() + +Version 3.00 07/10/93 + Fixed up documentation. + quad_cksum definitly compatable with MIT's now. + +Version 2.30 24/08/93 + Tripple DES now defaults to tripple cbc but can do tripple ecb + with the -b flag. + Fixed some MSDOS uuen/uudecoding problems, thanks to + Added prototypes. + +Version 2.22 29/06/93 + Fixed a bug in des_is_weak_key() which stopped it working :-( + thanks to engineering@MorningStar.Com. + +Version 2.21 03/06/93 + des(1) with no arguments gives quite a bit of help. + Added -c (generate ckecksum) flag to des(1). + Added -3 (tripple DES) flag to des(1). + Added cfb and ofb routines to the library. + +Version 2.20 11/03/93 + Added -u (uuencode) flag to des(1). + I have been playing with byte order in quad_cksum to make it + compatible with MIT's version. All I can say is aviod this + function if possible since MIT's output is endian dependent. + +Version 2.12 14/10/92 + Added MSDOS specific macro in ecb_encrypt which gives a %70 + speed up when the code is compiled with turbo C. + +Version 2.11 12/10/92 + Speedup in set_key (recoding of PC-1) + I now do it in 47 simple operations, down from 60. + Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) + for motivating me to look for a faster system :-) + The speedup is probably less that 1% but it is still 13 + instructions less :-). + +Version 2.10 06/10/92 + The code now works on the 64bit ETA10 and CRAY without modifications or + #defines. I believe the code should work on any machine that + defines long, int or short to be 8 bytes long. + Thanks to Shabbir J. Safdar (shabby@mentor.cc.purdue.edu) + for helping me fix the code to run on 64bit machines (he had + access to an ETA10). + Thanks also to John Fletcher + for testing the routines on a CRAY. + read_password.c has been renamed to read_passwd.c + string_to_key.c has been renamed to string2key.c + +Version 2.00 14/09/92 + Made mods so that the library should work on 64bit CPU's. + Removed all my uchar and ulong defs. To many different + versions of unix define them in their header files in too many + different combinations :-) + IRIX - Sillicon Graphics mods (mostly in read_password.c). + Thanks to Andrew Daviel (advax@erich.triumf.ca) + +Version 1.99 26/08/92 + Fixed a bug or 2 in enc_read.c + Fixed a bug in enc_write.c + Fixed a pseudo bug in fcrypt.c (very obscure). + +Version 1.98 31/07/92 + Support for the ETA10. This is a strange machine that defines + longs and ints as 8 bytes and shorts as 4 bytes. + Since I do evil things with long * that assume that they are 4 + bytes. Look in the Makefile for the option to compile for + this machine. quad_cksum appears to have problems but I + will don't have the time to fix it right now, and this is not + a function that uses DES and so will not effect the main uses + of the library. + +Version 1.97 20/05/92 eay + Fixed the Imakefile and made some changes to des.h to fix some + problems when building this package with Kerberos v 4. + +Version 1.96 18/05/92 eay + Fixed a small bug in string_to_key() where problems could + occur if des_check_key was set to true and the string + generated a weak key. + +Patch2 posted to comp.sources.misc +Version 1.95 13/05/92 eay + Added an alternative version of the D_ENCRYPT macro in + ecb_encrypt and fcrypt. Depending on the compiler, one version or the + other will be faster. This was inspired by + Dana How , and her pointers about doing the + *(ulong *)((uchar *)ptr+(value&0xfc)) + vs + ptr[value&0x3f] + to stop the C compiler doing a <<2 to convert the long array index. + +Version 1.94 05/05/92 eay + Fixed an incompatibility between my string_to_key and the MIT + version. When the key is longer than 8 chars, I was wrapping + with a different method. To use the old version, define + OLD_STR_TO_KEY in the makefile. Thanks to + viktor@newsu.shearson.com (Viktor Dukhovni). + +Version 1.93 28/04/92 eay + Fixed the VMS mods so that echo is now turned off in + read_password. Thanks again to brennan@coco.cchs.su.oz.AU. + MSDOS support added. The routines can be compiled with + Turbo C (v2.0) and MSC (v5.1). Make sure MSDOS is defined. + +Patch1 posted to comp.sources.misc +Version 1.92 13/04/92 eay + Changed D_ENCRYPT so that the rotation of R occurs outside of + the loop. This required rotating all the longs in sp.h (now + called spr.h). Thanks to Richard Outerbridge <71755.204@CompuServe.COM> + speed.c has been changed so it will work without SIGALRM. If + times(3) is not present it will try to use ftime() instead. + +Version 1.91 08/04/92 eay + Added -E/-D options to des(1) so it can use string_to_key. + Added SVR4 mods suggested by witr@rwwa.COM + Added VMS mods suggested by brennan@coco.cchs.su.oz.AU. If + anyone knows how to turn of tty echo in VMS please tell me or + implement it yourself :-). + Changed FILE *IN/*OUT to *DES_IN/*DES_OUT since it appears VMS + does not like IN/OUT being used. + +Libdes posted to comp.sources.misc +Version 1.9 24/03/92 eay + Now contains a fast small crypt replacement. + Added des(1) command. + Added des_rw_mode so people can use cbc encryption with + enc_read and enc_write. + +Version 1.8 15/10/91 eay + Bug in cbc_cksum. + Many thanks to Keith Reynolds (keithr@sco.COM) for pointing this + one out. + +Version 1.7 24/09/91 eay + Fixed set_key :-) + set_key is 4 times faster and takes less space. + There are a few minor changes that could be made. + +Version 1.6 19/09/1991 eay + Finally go IP and FP finished. + Now I need to fix set_key. + This version is quite a bit faster that 1.51 + +Version 1.52 15/06/1991 eay + 20% speedup in ecb_encrypt by changing the E bit selection + to use 2 32bit words. This also required modification of the + sp table. There is still a way to speedup the IP and IP-1 + (hints from outer@sq.com) still working on this one :-(. + +Version 1.51 07/06/1991 eay + Faster des_encrypt by loop unrolling + Fixed bug in quad_cksum.c (thanks to hughes@logos.ucs.indiana.edu) + +Version 1.50 28/05/1991 eay + Optimized the code a bit more for the sparc. I have improved the + speed of the inner des_encrypt by speeding up the initial and + final permutations. + +Version 1.40 23/10/1990 eay + Fixed des_random_key, it did not produce a random key :-( + +Version 1.30 2/10/1990 eay + Have made des_quad_cksum the same as MIT's, the full package + should be compatible with MIT's + Have tested on a DECstation 3100 + Still need to fix des_set_key (make it faster). + Does des_cbc_encrypts at 70.5k/sec on a 3100. + +Version 1.20 18/09/1990 eay + Fixed byte order dependencies. + Fixed (I hope) all the word alignment problems. + Speedup in des_ecb_encrypt. + +Version 1.10 11/09/1990 eay + Added des_enc_read and des_enc_write. + Still need to fix des_quad_cksum. + Still need to document des_enc_read and des_enc_write. + +Version 1.00 27/08/1990 eay diff --git a/lib/des/cbc_enc.c b/lib/des/cbc_enc.c new file mode 100644 index 000000000..1710930d1 --- /dev/null +++ b/lib/des/cbc_enc.c @@ -0,0 +1,72 @@ +/* cbc_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +int des_cbc_encrypt(des_cblock (*input), des_cblock (*output), long int length, struct des_ks_struct *schedule, des_cblock (*ivec), int encrypt) +{ + register u_int32_t tin0,tin1; + register u_int32_t tout0,tout1,xor0,xor1; + register unsigned char *in,*out; + register long l=length; + u_int32_t tout[2],tin[2]; + unsigned char *iv; + + in=(unsigned char *)input; + out=(unsigned char *)output; + iv=(unsigned char *)ivec; + + if (encrypt) + { + c2l(iv,tout0); + c2l(iv,tout1); + for (; l>0; l-=8) + { + if (l >= 8) + { + c2l(in,tin0); + c2l(in,tin1); + } + else + c2ln(in,tin0,tin1,l); + tin0^=tout0; + tin1^=tout1; + tin[0]=tin0; + tin[1]=tin1; + des_encrypt(tin,tout, + schedule,encrypt); + tout0=tout[0]; + tout1=tout[1]; + l2c(tout0,out); + l2c(tout1,out); + } + } + else + { + c2l(iv,xor0); + c2l(iv,xor1); + for (; l>0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + tin[0]=tin0; + tin[1]=tin1; + des_encrypt(tin,tout, + schedule,encrypt); + tout0=tout[0]^xor0; + tout1=tout[1]^xor1; + if (l >= 8) + { + l2c(tout0,out); + l2c(tout1,out); + } + else + l2cn(tout0,tout1,out,l); + xor0=tin0; + xor1=tin1; + } + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=tout[0]=tout[1]=0; + return(0); +} + diff --git a/lib/des/cfb_enc.c b/lib/des/cfb_enc.c new file mode 100644 index 000000000..14fbfe5d9 --- /dev/null +++ b/lib/des/cfb_enc.c @@ -0,0 +1,99 @@ +/* cfb_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +/* The input and output are loaded in multiples of 8 bits. + * What this means is that if you hame numbits=12 and length=2 + * the first 12 bits will be retrieved from the first byte and half + * the second. The second 12 bits will come from the 3rd and half the 4th + * byte. + */ +int des_cfb_encrypt(unsigned char *in, unsigned char *out, int numbits, long int length, struct des_ks_struct *schedule, des_cblock (*ivec), int encrypt) +{ + register u_int32_t d0,d1,v0,v1,n=(numbits+7)/8; + register u_int32_t mask0,mask1; + register long l=length; + register int num=numbits; + u_int32_t ti[2],to[2]; + unsigned char *iv; + + if (num > 64) return(0); + if (num > 32) + { + mask0=0xffffffff; + if (num == 64) + mask1=mask0; + else + mask1=(1L<<(num-32))-1; + } + else + { + if (num == 32) + mask0=0xffffffff; + else + mask0=(1L< 0) + { + ti[0]=v0; + ti[1]=v1; + des_encrypt(ti,to, + schedule,DES_ENCRYPT); + c2ln(in,d0,d1,n); + in+=n; + d0=(d0^to[0])&mask0; + d1=(d1^to[1])&mask1; + l2cn(d0,d1,out,n); + out+=n; + if (num > 32) + { + v0=((v1>>(num-32))|(d0<<(64-num)))&0xffffffff; + v1=((d0>>(num-32))|(d1<<(64-num)))&0xffffffff; + } + else + { + v0=((v0>>num)|(v1<<(32-num)))&0xffffffff; + v1=((v1>>num)|(d0<<(32-num)))&0xffffffff; + } + } + } + else + { + while (l-- > 0) + { + ti[0]=v0; + ti[1]=v1; + des_encrypt(ti,to, + schedule,DES_ENCRYPT); + c2ln(in,d0,d1,n); + in+=n; + if (num > 32) + { + v0=((v1>>(num-32))|(d0<<(64-num)))&0xffffffff; + v1=((d0>>(num-32))|(d1<<(64-num)))&0xffffffff; + } + else + { + v0=((v0>>num)|(v1<<(32-num)))&0xffffffff; + v1=((v1>>num)|(d0<<(32-num)))&0xffffffff; + } + d0=(d0^to[0])&mask0; + d1=(d1^to[1])&mask1; + l2cn(d0,d1,out,n); + out+=n; + } + } + iv=(unsigned char *)ivec; + l2c(v0,iv); + l2c(v1,iv); + v0=v1=d0=d1=ti[0]=ti[1]=to[0]=to[1]=0; + return(0); +} + diff --git a/lib/des/des.c b/lib/des/des.c new file mode 100644 index 000000000..536f94dd2 --- /dev/null +++ b/lib/des/des.c @@ -0,0 +1,842 @@ +/* des.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include +#include +#ifdef VMS +#include +#include +#else +#if !defined(_IRIX) +#include +#endif +#include +#endif +#include "des_locl.h" + +void usage(void); +void doencryption(void); +int uufwrite(char *data, int size, int num, FILE *fp); +void uufwriteEnd(FILE *fp); +int uufread(char *out,int size,int num,FILE *fp); +int uuencode(unsigned char *in,int num,unsigned char *out); +int uudecode(unsigned char *in,int num,unsigned char *out); + +#ifdef VMS +#define EXIT(a) exit(a&0x10000000) +#else +#define EXIT(a) exit(a) +#endif + +#define BUFSIZE (8*1024) +#define VERIFY 1 +#define KEYSIZ 8 +#define KEYSIZB 1024 /* should hit tty line limit first :-) */ +char key[KEYSIZB+1]; +int do_encrypt,longk=0; +char *in=NULL,*out=NULL; +FILE *DES_IN,*DES_OUT,*CKSUM_OUT; +char uuname[200]; +char uubuf[50]; +int uubufnum; +#define INUUBUFN (45*100) +#define OUTUUBUF (65*100) +char b[OUTUUBUF]; +char bb[300]; +des_cblock cksum={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; +char cksumname[200]=""; + +int cflag,eflag,dflag,kflag,bflag,fflag,sflag,uflag,flag3,hflag,error; + +void +main(int argc, char **argv) +{ + int i; + struct stat ins,outs; + char *p; + + cflag=eflag=dflag=kflag=hflag=bflag=fflag=sflag=uflag=flag3=0,error=0; + memset(key,0,sizeof(key)); + + for (i=1; i=0; j--) + argv[i][j]='\0'; + } + break; + default: + fprintf(stderr,"'%c' unknown flag\n",p[-1]); + error=1; + break; + } + } + } + else + { + if (in == NULL) + in=argv[i]; + else if (out == NULL) + out=argv[i]; + else + error=1; + } + } + if (error) usage(); + /* We either + * do checksum or + * do encrypt or + * do decrypt or + * do decrypt then ckecksum or + * do checksum then encrypt + */ + if (((eflag+dflag) == 1) || cflag) + { + if (eflag) do_encrypt=DES_ENCRYPT; + if (dflag) do_encrypt=DES_DECRYPT; + } + else + usage(); + + if ( (in != NULL) && + (out != NULL) && +#ifndef MSDOS + (stat(in,&ins) != -1) && + (stat(out,&outs) != -1) && + (ins.st_dev == outs.st_dev) && + (ins.st_ino == outs.st_ino)) +#else /* MSDOS */ + (strcmp(in,out) == 0)) +#endif +{ + fputs("input and output file are the same\n",stderr); + EXIT(3); +} + +if (!kflag) + if (des_read_pw_string(key,KEYSIZB+1,"Enter key:",eflag?VERIFY:0)) +{ + fputs("password error\n",stderr); + EXIT(2); +} + +if (in == NULL) + DES_IN=stdin; +else if ((DES_IN=fopen(in,"r")) == NULL) +{ + perror("opening input file"); + EXIT(4); +} + +CKSUM_OUT=stdout; +if (out == NULL) +{ + DES_OUT=stdout; + CKSUM_OUT=stderr; +} +else if ((DES_OUT=fopen(out,"w")) == NULL) +{ + perror("opening output file"); + EXIT(5); +} + +#ifdef MSDOS +/* This should set the file to binary mode. */ +{ +#include + if (!(uflag && dflag)) + setmode(fileno(DES_IN),O_BINARY); + if (!(uflag && eflag)) + setmode(fileno(DES_OUT),O_BINARY); +} +#endif + +doencryption(); +fclose(DES_IN); +fclose(DES_OUT); +EXIT(0); +} + +void +usage(void) +{ + char **u; + static char *usage[]={ + "des [input-file [output-file]]", + "options:", + "-e : encrypt using sunOS compatible user key to DES key conversion.", + "-E : encrypt ", + "-d : decrypt using sunOS compatible user key to DES key conversion.", + "-D : decrypt ", + "-c[ckname] : generate a cbc_cksum using sunOS compatible user key to", + " DES key conversion and output to ckname (stdout default,", + " stderr if data being output on stdout). The checksum is", + " generated before encryption and after decryption if used", + " in conjunction with -[eEdD].", + "-C[ckname] : generate a cbc_cksum as for -c but compatible with -[ED].", + "-k key : use key 'key'", + "-h : the key that is entered will be a hexidecimal number", + "-u[uuname] : input file is uudecoded if -[dD] or output uuencoded", + " data if -[eE] (uuname is the filename to put in the", + " uuencode header).", + "-b : encrypt using DES in ecb encryption mode, the defaut is", + " cbc mode.", + "-3 : encrypt using tripple DES encryption. This uses 2 keys", + " generated from the input key. If the input key is less", + " than 8 characters long, this is equivelent to normal", + " encryption. Default is tripple cbc, -b makes it tripple ecb.", + NULL + }; + for (u=usage; *u; u++) + { + fputs(*u,stderr); + fputc('\n',stderr); + } + + EXIT(1); +} + +void +doencryption(void) +{ + register int i; + des_key_schedule ks,ks2; + unsigned char iv[8],iv2[8],iv3[8]; + char *p; + int num=0,j,k,l,rem,ll,len,last,ex=0; + des_cblock kk,k2; + FILE *O; + int Exit=0; +#ifndef MSDOS + static unsigned char buf[BUFSIZE+8],obuf[BUFSIZE+8]; +#else + static unsigned char *buf=NULL,*obuf=NULL; + + if (buf == NULL) + { + if ( (( buf=(unsigned char *)malloc(BUFSIZE+8)) == NULL) || + ((obuf=(unsigned char *)malloc(BUFSIZE+8)) == NULL)) + { + fputs("Not enough memory\n",stderr); + Exit=10; + goto problems; + } + } +#endif + + if (hflag) + { + j=(flag3?16:8); + p=key; + for (i=0; i= '0')) + k=(*p-'0')<<4; + else if ((*p <= 'f') && (*p >= 'a')) + k=(*p-'a'+10)<<4; + else if ((*p <= 'F') && (*p >= 'A')) + k=(*p-'A'+10)<<4; + else + { + fputs("Bad hex key\n",stderr); + Exit=9; + goto problems; + } + p++; + if ((*p <= '9') && (*p >= '0')) + k|=(*p-'0'); + else if ((*p <= 'f') && (*p >= 'a')) + k|=(*p-'a'+10); + else if ((*p <= 'F') && (*p >= 'A')) + k|=(*p-'A'+10); + else + { + fputs("Bad hex key\n",stderr); + Exit=9; + goto problems; + } + p++; + if (i < 8) + kk[i]=k; + else + k2[i-8]=k; + } + des_set_key((des_cblock *)k2,ks2); + memset(k2,0,sizeof(k2)); + } + else if (longk || flag3) + { + if (flag3) + { + des_string_to_2keys(key,(des_cblock *)kk,(des_cblock *)k2); + des_set_key((des_cblock *)k2,ks2); + memset(k2,0,sizeof(k2)); + } + else + des_string_to_key(key,(des_cblock *)kk); + } + else + for (i=0; i>=1; + } + if (l & 1) + kk[i]=key[i]&0x7f; + else + kk[i]=key[i]|0x80; + } + + des_set_key((des_cblock *)kk,ks); + memset(key,0,sizeof(key)); + memset(kk,0,sizeof(kk)); + /* woops - A bug that does not showup under unix :-( */ + memset(iv,0,sizeof(iv)); + memset(iv2,0,sizeof(iv2)); + memset(iv3,0,sizeof(iv3)); + + l=1; + rem=0; + /* first read */ + if (eflag || (!dflag && cflag)) + { + for (;;) + { + num=l=fread(&(buf[rem]),1,BUFSIZE,DES_IN); + l+=rem; + num+=rem; + if (l < 0) + { + perror("read error"); + Exit=6; + goto problems; + } + + rem=l%8; + len=l-rem; + if (feof(DES_IN)) + { + srandom(time(NULL)); + for (i=7-rem; i>0; i--) + buf[l++]=random()&0xff; + buf[l++]=rem; + ex=1; + len+=rem; + } + else + l-=rem; + + if (cflag) + { + des_cbc_cksum((des_cblock *)buf,(des_cblock *)cksum, + (long)len,ks,(des_cblock *)cksum); + if (!eflag) + { + if (feof(DES_IN)) break; + else continue; + } + } + + if (bflag && !flag3) + for (i=0; i= 8) memcpy(iv,&(obuf[l-8]),8); + } + if (rem) memcpy(buf,&(buf[l]),rem); + + i=0; + while (i < l) + { + if (uflag) + j=uufwrite(obuf,1,l-i,DES_OUT); + else + j=fwrite(obuf,1,l-i,DES_OUT); + if (j == -1) + { + perror("Write error"); + Exit=7; + goto problems; + } + i+=j; + } + if (feof(DES_IN)) + { + if (uflag) uufwriteEnd(DES_OUT); + break; + } + } + } + else /* decrypt */ + { + ex=1; + for (;;) + { + if (ex) { + if (uflag) + l=uufread(buf,1,BUFSIZE,DES_IN); + else + l=fread(buf,1,BUFSIZE,DES_IN); + ex=0; + rem=l%8; + l-=rem; + } + if (l < 0) + { + perror("read error"); + Exit=6; + goto problems; + } + + if (bflag && !flag3) + for (i=0; i= 8) memcpy(iv,&(buf[l-8]),8); + } + + if (uflag) + ll=uufread(&(buf[rem]),1,BUFSIZE,DES_IN); + else + ll=fread(&(buf[rem]),1,BUFSIZE,DES_IN); + ll+=rem; + rem=ll%8; + ll-=rem; + if (feof(DES_IN) && (ll == 0)) + { + last=obuf[l-1]; + + if ((last > 7) || (last < 0)) + { + fputs("The file was not decrypted correctly.\n", + stderr); + /*Exit=8; + goto problems;*/ + last=0; + } + l=l-8+last; + } + i=0; + if (cflag) des_cbc_cksum((des_cblock *)obuf, + (des_cblock *)cksum,(long)l/8*8,ks, + (des_cblock *)cksum); + while (i != l) + { + j=fwrite(obuf,1,l-i,DES_OUT); + if (j == -1) + { + perror("Write error"); + Exit=7; + goto problems; + } + i+=j; + } + l=ll; + if ((l == 0) && feof(DES_IN)) break; + } + } + if (cflag) + { + l=0; + if (cksumname[0] != '\0') + { + if ((O=fopen(cksumname,"w")) != NULL) + { + CKSUM_OUT=O; + l=1; + } + } + for (i=0; i<8; i++) + fprintf(CKSUM_OUT,"%02X",cksum[i]); + fprintf(CKSUM_OUT,"\n"); + if (l) fclose(CKSUM_OUT); + } + problems: + memset(buf,0,sizeof(buf)); + memset(obuf,0,sizeof(obuf)); + memset(ks,0,sizeof(ks)); + memset(ks2,0,sizeof(ks2)); + memset(iv,0,sizeof(iv)); + memset(iv2,0,sizeof(iv2)); + memset(iv3,0,sizeof(iv3)); + memset(kk,0,sizeof(kk)); + memset(k2,0,sizeof(k2)); + memset(uubuf,0,sizeof(uubuf)); + memset(b,0,sizeof(b)); + memset(bb,0,sizeof(bb)); + memset(cksum,0,sizeof(cksum)); + if (Exit) EXIT(Exit); +} + +int uufwrite(char *data, int size, int num, FILE *fp) + + /* We ignore this parameter but it should be > ~50 I believe */ + + +{ + int i,j,left,rem,ret=num; + static int start=1; + + if (start) + { + fprintf(fp,"begin 600 %s\n", + (uuname[0] == '\0')?"text.d":uuname); + start=0; + } + + if (uubufnum) + { + if (uubufnum+num < 45) + { + memcpy(&(uubuf[uubufnum]),data,num); + uubufnum+=num; + return(num); + } + else + { + i=45-uubufnum; + memcpy(&(uubuf[uubufnum]),data,i); + j=uuencode(uubuf,45,b); + fwrite(b,1,j,fp); + uubufnum=0; + data+=i; + num-=i; + } + } + + for (i=0; i<(num-INUUBUFN); i+=INUUBUFN) + { + j=uuencode(&(data[i]),INUUBUFN,b); + fwrite(b,1,j,fp); + } + rem=(num-i)%45; + left=(num-i-rem); + if (left) + { + j=uuencode(&(data[i]),left,b); + fwrite(b,1,j,fp); + i+=left; + } + if (i != num) + { + memcpy(uubuf,&(data[i]),rem); + uubufnum=rem; + } + return(ret); +} + +void +uufwriteEnd(FILE *fp) +{ + int j; + static char *end=" \nend\n"; + + if (uubufnum != 0) + { + uubuf[uubufnum]='\0'; + uubuf[uubufnum+1]='\0'; + uubuf[uubufnum+2]='\0'; + j=uuencode(uubuf,uubufnum,b); + fwrite(b,1,j,fp); + } + fwrite(end,1,strlen(end),fp); +} + +int uufread(char *out, int size, int num, FILE *fp) + + /* should always be > ~ 60; I actually ignore this parameter :-) */ + + +{ + int i,j,tot; + static int done=0; + static int valid=0; + static int start=1; + + if (start) + { + for (;;) + { + b[0]='\0'; + fgets(b,300,fp); + if (b[0] == '\0') + { + fprintf(stderr,"no 'begin' found in uuencoded input\n"); + return(-1); + } + if (strncmp(b,"begin ",6) == 0) break; + } + start=0; + } + if (done) return(0); + tot=0; + if (valid) + { + memcpy(out,bb,valid); + tot=valid; + valid=0; + } + for (;;) + { + b[0]='\0'; + fgets(b,300,fp); + if (b[0] == '\0') break; + i=strlen(b); + if ((b[0] == 'e') && (b[1] == 'n') && (b[2] == 'd')) + { + done=1; + while (!feof(fp)) + { + fgets(b,300,fp); + } + break; + } + i=uudecode(b,i,bb); + if (i < 0) break; + if ((i+tot+8) > num) + { + /* num to copy to make it a multiple of 8 */ + j=(num/8*8)-tot-8; + memcpy(&(out[tot]),bb,j); + tot+=j; + memcpy(bb,&(bb[j]),i-j); + valid=i-j; + break; + } + memcpy(&(out[tot]),bb,i); + tot+=i; + } + return(tot); +} + +#define ccc2l(c,l) (l =((u_int32_t)(*((c)++)))<<16, \ + l|=((u_int32_t)(*((c)++)))<< 8, \ + l|=((u_int32_t)(*((c)++)))) + +#define l2ccc(l,c) (*((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + + +int uuencode(unsigned char *in, int num, unsigned char *out) +{ + int j,i,n,tot=0; + u_int32_t l; + register unsigned char *p; + p=out; + + for (j=0; j num) + i=(num-j); + else i=45; + *(p++)=i+' '; + for (n=0; n>18)&0x3f)+' '; + *(p++)=((l>>12)&0x3f)+' '; + *(p++)=((l>> 6)&0x3f)+' '; + *(p++)=((l )&0x3f)+' '; + tot+=4; + } + *(p++)='\n'; + tot+=2; + } + *p='\0'; + l=0; + return(tot); +} + +int uudecode(unsigned char *in, int num, unsigned char *out) +{ + int j,i,k; + unsigned int n,space=0; + u_int32_t l; + u_int32_t w,x,y,z; + unsigned int blank='\n'-' '; + + for (j=0; j 60) + { + fprintf(stderr,"uuencoded line length too long\n"); + return(-1); + } + j++; + + for (i=0; i 63) || (x > 63) || (y > 63) || (z > 63)) + { + k=0; + if (w == blank) k=1; + if (x == blank) k=2; + if (y == blank) k=3; + if (z == blank) k=4; + space=1; + switch (k) { + case 1: w=0; in--; + case 2: x=0; in--; + case 3: y=0; in--; + case 4: z=0; in--; + break; + case 0: + space=0; + fprintf(stderr,"bad uuencoded data values\n"); + w=x=y=z=0; + return(-1); + break; + } + } + l=(w<<18)|(x<<12)|(y<< 6)|(z ); + l2ccc(l,out); + } + if (*(in++) != '\n') + { + fprintf(stderr,"missing nl in uuencoded line\n"); + w=x=y=z=0; + return(-1); + } + j++; + } + *out='\0'; + w=x=y=z=0; + return(n); +} diff --git a/lib/des/des.man b/lib/des/des.man new file mode 100644 index 000000000..29b4fb495 --- /dev/null +++ b/lib/des/des.man @@ -0,0 +1,187 @@ +.TH DES 1 +.SH NAME +des - encrypt or decrypt data using Data Encryption Standard +.SH SYNOPSIS +.B des +( +.B \-e +| +.B \-E +) | ( +.B \-d +| +.B \-D +) | ( +.B \-\fR[\fPcC\fR][\fPckname\fR]\fP +) | +[ +.B \-b3hfs +] [ +.B \-k +.I key +] +] [ +.B \-u\fR[\fIuuname\fR] +[ +.I input-file +[ +.I output-file +] ] +.SH DESCRIPTION +.B des +encrypts and decrypts data using the +Data Encryption Standard algorithm. +One of +.B \-e, \-E +(for encrypt) or +.B \-d, \-D +(for decrypt) must be specified. +It is also possible to use +.B \-c +or +.B \-C +in conjunction or instead of the a encrypt/decrypt option to generate +a 16 character hexadecimal checksum, generated via the +.I des_cbc_cksum. +.LP +Two standard encryption modes are supported by the +.B des +program, Cipher Block Chaining (the default) and Electronic Code Book +(specified with +.B \-b +). +.LP +The key used for the DES +algorithm is obtained by prompting the user unless the +.B `\-k +.I key' +option is given. +If the key is an argument to the +.B des +command, it is potentially visible to users executing +.BR ps (1) +or a derivative. To minimise this possibility, +.B des +takes care to destroy the key argument immediately upon entry. +If your shell keeps a history file be careful to make sure it is not +world readable. +.LP +Since this program attempts to maintain compatability with sunOS's +des(1) command, there are 2 different methods used to convert the user +supplied key to a des key. +Whenever and one or more of +.B \-E, \-D, \-C +or +.B \-3 +options are used, the key conversion procedure will not be compatible +with the sunOS des(1) version but will use all the user supplied +character to generate the des key. +.B des +command reads from standard input unless +.I input-file +is specified and writes to standard output unless +.I output-file +is given. +.SH OPTIONS +.TP +.B \-b +Select ECB +(eight bytes at a time) encryption mode. +.TP +.B \-3 +Encrypt using triple encryption. +By default triple cbc encryption is used but if the +.B \-b +option is used then triple ecb encryption is performed. +If the key is less than 8 characters long, the flag has no effect. +.TP +.B \-e +Encrypt data using an 8 byte key in a manner compatible with sunOS +des(1). +.TP +.B \-E +Encrypt data using a key of nearly unlimited length (1024 bytes). +This will product a more secure encryption. +.TP +.B \-d +Decrypt data that was encrypted with the \-e option. +.TP +.B \-D +Decrypt data that was encrypted with the \-E option. +.TP +.B \-c +Generate a 16 character hexadecimal cbc checksum and output this to +stderr. +If a filename was specified after the +.B \-c +option, the checksum is output to that file. +The checksum is generated using a key generated in a sunOS compatible +manner. +.TP +.B \-C +A cbc checksum is generated in the same manner as described for the +.B \-c +option but the DES key is generated in the same manner as used for the +.B \-E +and +.B \-D +options +.TP +.B \-f +Does nothing - allowed for compatibility with sunOS des(1) command. +.TP +.B \-s +Does nothing - allowed for compatibility with sunOS des(1) command. +.TP +.B "\-k \fIkey\fP" +Use the encryption +.I key +specified. +.TP +.B "\-h" +The +.I key +is assumed to be a 16 character hexadecimal number. +If the +.B "\-3" +option is used the key is assumed to be a 32 character hexadecimal +number. +.TP +.B \-u +This flag is used to read and write uuencoded files. If decrypting, +the input file is assumed to contain uuencoded, DES encrypted data. +If encrypting, the characters following the -u are used as the name of +the uuencoded file to embed in the begin line of the uuencoded +output. If there is no name specified after the -u, the name text.des +will be embedded in the header. +.SH SEE ALSO +.B ps (1) +.B des_crypt(3) +.SH BUGS +.LP +The problem with using the +.B -e +option is the short key length. +It would be better to use a real 56-bit key rather than an +ASCII-based 56-bit pattern. Knowing that the key was derived from ASCII +radically reduces the time necessary for a brute-force cryptographic attack. +My attempt to remove this problem is to add an alternative text-key to +DES-key function. This alternative function (accessed via +.B -E, -D, -S +and +.B -3 +) +uses DES to help generate the key. +.LP +Be carefully when using the -u option. Doing des -ud will +not decrypt filename (the -u option will gobble the d option). +.LP +The VMS operating system operates in a world where files are always a +multiple of 512 bytes. This causes problems when encrypted data is +send from unix to VMS since a 88 byte file will suddenly be padded +with 424 null bytes. To get around this problem, use the -u option +to uuencode the data before it is send to the VMS system. +.SH AUTHOR +.LP +Eric Young (eay@psych.psy.uq.oz.au), Psychology Department, +University of Queensland, Australia. diff --git a/lib/des/des.pl b/lib/des/des.pl new file mode 100644 index 000000000..33754270d --- /dev/null +++ b/lib/des/des.pl @@ -0,0 +1,536 @@ +#!/usr/local/bin/perl +# Copyright (C) 1993 Eric Young +# des.pl - eric young 22/11/1991 eay@psych.psy.uq.oz.au +# eay - 92/08/31 - I think I have fixed all problems for 64bit +# versions of perl but I could be wrong since I have not tested it yet :-). +# +# This is an implementation of DES in perl. +# The two routines (des_set_key and des_ecb_encrypt) +# take 8 byte objects as arguments. +# +# des_set_key takes an 8 byte string as a key and returns a key schedule +# for use in calls to des_ecb_encrypt. +# des_ecb_encrypt takes three arguments, the first is a key schedule +# (make sure to pass it by reference with the *), the second is 1 +# to encrypt, 0 to decrypt. The third argument is an 8 byte object +# to encrypt. The function returns an 8 byte object that has been +# DES encrypted. +# +# example: +# require 'des.pl' +# +# $key =pack("C8",0x12,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); +# @ks= &des_set_key($key); +# +# $outbytes= &des_ecb_encrypt(*ks,1,$data); +# @enc =unpack("C8",$outbytes); +# + +package des; + +# The following 8 arrays are used in des_set_key +@skb0=( +# for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 +0x00000000,0x00000010,0x20000000,0x20000010, +0x00010000,0x00010010,0x20010000,0x20010010, +0x00000800,0x00000810,0x20000800,0x20000810, +0x00010800,0x00010810,0x20010800,0x20010810, +0x00000020,0x00000030,0x20000020,0x20000030, +0x00010020,0x00010030,0x20010020,0x20010030, +0x00000820,0x00000830,0x20000820,0x20000830, +0x00010820,0x00010830,0x20010820,0x20010830, +0x00080000,0x00080010,0x20080000,0x20080010, +0x00090000,0x00090010,0x20090000,0x20090010, +0x00080800,0x00080810,0x20080800,0x20080810, +0x00090800,0x00090810,0x20090800,0x20090810, +0x00080020,0x00080030,0x20080020,0x20080030, +0x00090020,0x00090030,0x20090020,0x20090030, +0x00080820,0x00080830,0x20080820,0x20080830, +0x00090820,0x00090830,0x20090820,0x20090830, +); +@skb1=( +# for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 +0x00000000,0x02000000,0x00002000,0x02002000, +0x00200000,0x02200000,0x00202000,0x02202000, +0x00000004,0x02000004,0x00002004,0x02002004, +0x00200004,0x02200004,0x00202004,0x02202004, +0x00000400,0x02000400,0x00002400,0x02002400, +0x00200400,0x02200400,0x00202400,0x02202400, +0x00000404,0x02000404,0x00002404,0x02002404, +0x00200404,0x02200404,0x00202404,0x02202404, +0x10000000,0x12000000,0x10002000,0x12002000, +0x10200000,0x12200000,0x10202000,0x12202000, +0x10000004,0x12000004,0x10002004,0x12002004, +0x10200004,0x12200004,0x10202004,0x12202004, +0x10000400,0x12000400,0x10002400,0x12002400, +0x10200400,0x12200400,0x10202400,0x12202400, +0x10000404,0x12000404,0x10002404,0x12002404, +0x10200404,0x12200404,0x10202404,0x12202404, +); +@skb2=( +# for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 +0x00000000,0x00000001,0x00040000,0x00040001, +0x01000000,0x01000001,0x01040000,0x01040001, +0x00000002,0x00000003,0x00040002,0x00040003, +0x01000002,0x01000003,0x01040002,0x01040003, +0x00000200,0x00000201,0x00040200,0x00040201, +0x01000200,0x01000201,0x01040200,0x01040201, +0x00000202,0x00000203,0x00040202,0x00040203, +0x01000202,0x01000203,0x01040202,0x01040203, +0x08000000,0x08000001,0x08040000,0x08040001, +0x09000000,0x09000001,0x09040000,0x09040001, +0x08000002,0x08000003,0x08040002,0x08040003, +0x09000002,0x09000003,0x09040002,0x09040003, +0x08000200,0x08000201,0x08040200,0x08040201, +0x09000200,0x09000201,0x09040200,0x09040201, +0x08000202,0x08000203,0x08040202,0x08040203, +0x09000202,0x09000203,0x09040202,0x09040203, +); +@skb3=( +# for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 +0x00000000,0x00100000,0x00000100,0x00100100, +0x00000008,0x00100008,0x00000108,0x00100108, +0x00001000,0x00101000,0x00001100,0x00101100, +0x00001008,0x00101008,0x00001108,0x00101108, +0x04000000,0x04100000,0x04000100,0x04100100, +0x04000008,0x04100008,0x04000108,0x04100108, +0x04001000,0x04101000,0x04001100,0x04101100, +0x04001008,0x04101008,0x04001108,0x04101108, +0x00020000,0x00120000,0x00020100,0x00120100, +0x00020008,0x00120008,0x00020108,0x00120108, +0x00021000,0x00121000,0x00021100,0x00121100, +0x00021008,0x00121008,0x00021108,0x00121108, +0x04020000,0x04120000,0x04020100,0x04120100, +0x04020008,0x04120008,0x04020108,0x04120108, +0x04021000,0x04121000,0x04021100,0x04121100, +0x04021008,0x04121008,0x04021108,0x04121108, +); +@skb4=( +# for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 +0x00000000,0x10000000,0x00010000,0x10010000, +0x00000004,0x10000004,0x00010004,0x10010004, +0x20000000,0x30000000,0x20010000,0x30010000, +0x20000004,0x30000004,0x20010004,0x30010004, +0x00100000,0x10100000,0x00110000,0x10110000, +0x00100004,0x10100004,0x00110004,0x10110004, +0x20100000,0x30100000,0x20110000,0x30110000, +0x20100004,0x30100004,0x20110004,0x30110004, +0x00001000,0x10001000,0x00011000,0x10011000, +0x00001004,0x10001004,0x00011004,0x10011004, +0x20001000,0x30001000,0x20011000,0x30011000, +0x20001004,0x30001004,0x20011004,0x30011004, +0x00101000,0x10101000,0x00111000,0x10111000, +0x00101004,0x10101004,0x00111004,0x10111004, +0x20101000,0x30101000,0x20111000,0x30111000, +0x20101004,0x30101004,0x20111004,0x30111004, +); +@skb5=( +# for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 +0x00000000,0x08000000,0x00000008,0x08000008, +0x00000400,0x08000400,0x00000408,0x08000408, +0x00020000,0x08020000,0x00020008,0x08020008, +0x00020400,0x08020400,0x00020408,0x08020408, +0x00000001,0x08000001,0x00000009,0x08000009, +0x00000401,0x08000401,0x00000409,0x08000409, +0x00020001,0x08020001,0x00020009,0x08020009, +0x00020401,0x08020401,0x00020409,0x08020409, +0x02000000,0x0A000000,0x02000008,0x0A000008, +0x02000400,0x0A000400,0x02000408,0x0A000408, +0x02020000,0x0A020000,0x02020008,0x0A020008, +0x02020400,0x0A020400,0x02020408,0x0A020408, +0x02000001,0x0A000001,0x02000009,0x0A000009, +0x02000401,0x0A000401,0x02000409,0x0A000409, +0x02020001,0x0A020001,0x02020009,0x0A020009, +0x02020401,0x0A020401,0x02020409,0x0A020409, +); +@skb6=( +# for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 +0x00000000,0x00000100,0x00080000,0x00080100, +0x01000000,0x01000100,0x01080000,0x01080100, +0x00000010,0x00000110,0x00080010,0x00080110, +0x01000010,0x01000110,0x01080010,0x01080110, +0x00200000,0x00200100,0x00280000,0x00280100, +0x01200000,0x01200100,0x01280000,0x01280100, +0x00200010,0x00200110,0x00280010,0x00280110, +0x01200010,0x01200110,0x01280010,0x01280110, +0x00000200,0x00000300,0x00080200,0x00080300, +0x01000200,0x01000300,0x01080200,0x01080300, +0x00000210,0x00000310,0x00080210,0x00080310, +0x01000210,0x01000310,0x01080210,0x01080310, +0x00200200,0x00200300,0x00280200,0x00280300, +0x01200200,0x01200300,0x01280200,0x01280300, +0x00200210,0x00200310,0x00280210,0x00280310, +0x01200210,0x01200310,0x01280210,0x01280310, +); +@skb7=( +# for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 +0x00000000,0x04000000,0x00040000,0x04040000, +0x00000002,0x04000002,0x00040002,0x04040002, +0x00002000,0x04002000,0x00042000,0x04042000, +0x00002002,0x04002002,0x00042002,0x04042002, +0x00000020,0x04000020,0x00040020,0x04040020, +0x00000022,0x04000022,0x00040022,0x04040022, +0x00002020,0x04002020,0x00042020,0x04042020, +0x00002022,0x04002022,0x00042022,0x04042022, +0x00000800,0x04000800,0x00040800,0x04040800, +0x00000802,0x04000802,0x00040802,0x04040802, +0x00002800,0x04002800,0x00042800,0x04042800, +0x00002802,0x04002802,0x00042802,0x04042802, +0x00000820,0x04000820,0x00040820,0x04040820, +0x00000822,0x04000822,0x00040822,0x04040822, +0x00002820,0x04002820,0x00042820,0x04042820, +0x00002822,0x04002822,0x00042822,0x04042822, +); + +@shifts2=(0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0); + +# used in ecb_encrypt +@SP0=( +0x00410100, 0x00010000, 0x40400000, 0x40410100, +0x00400000, 0x40010100, 0x40010000, 0x40400000, +0x40010100, 0x00410100, 0x00410000, 0x40000100, +0x40400100, 0x00400000, 0x00000000, 0x40010000, +0x00010000, 0x40000000, 0x00400100, 0x00010100, +0x40410100, 0x00410000, 0x40000100, 0x00400100, +0x40000000, 0x00000100, 0x00010100, 0x40410000, +0x00000100, 0x40400100, 0x40410000, 0x00000000, +0x00000000, 0x40410100, 0x00400100, 0x40010000, +0x00410100, 0x00010000, 0x40000100, 0x00400100, +0x40410000, 0x00000100, 0x00010100, 0x40400000, +0x40010100, 0x40000000, 0x40400000, 0x00410000, +0x40410100, 0x00010100, 0x00410000, 0x40400100, +0x00400000, 0x40000100, 0x40010000, 0x00000000, +0x00010000, 0x00400000, 0x40400100, 0x00410100, +0x40000000, 0x40410000, 0x00000100, 0x40010100, +); +@SP1=( +0x08021002, 0x00000000, 0x00021000, 0x08020000, +0x08000002, 0x00001002, 0x08001000, 0x00021000, +0x00001000, 0x08020002, 0x00000002, 0x08001000, +0x00020002, 0x08021000, 0x08020000, 0x00000002, +0x00020000, 0x08001002, 0x08020002, 0x00001000, +0x00021002, 0x08000000, 0x00000000, 0x00020002, +0x08001002, 0x00021002, 0x08021000, 0x08000002, +0x08000000, 0x00020000, 0x00001002, 0x08021002, +0x00020002, 0x08021000, 0x08001000, 0x00021002, +0x08021002, 0x00020002, 0x08000002, 0x00000000, +0x08000000, 0x00001002, 0x00020000, 0x08020002, +0x00001000, 0x08000000, 0x00021002, 0x08001002, +0x08021000, 0x00001000, 0x00000000, 0x08000002, +0x00000002, 0x08021002, 0x00021000, 0x08020000, +0x08020002, 0x00020000, 0x00001002, 0x08001000, +0x08001002, 0x00000002, 0x08020000, 0x00021000, +); +@SP2=( +0x20800000, 0x00808020, 0x00000020, 0x20800020, +0x20008000, 0x00800000, 0x20800020, 0x00008020, +0x00800020, 0x00008000, 0x00808000, 0x20000000, +0x20808020, 0x20000020, 0x20000000, 0x20808000, +0x00000000, 0x20008000, 0x00808020, 0x00000020, +0x20000020, 0x20808020, 0x00008000, 0x20800000, +0x20808000, 0x00800020, 0x20008020, 0x00808000, +0x00008020, 0x00000000, 0x00800000, 0x20008020, +0x00808020, 0x00000020, 0x20000000, 0x00008000, +0x20000020, 0x20008000, 0x00808000, 0x20800020, +0x00000000, 0x00808020, 0x00008020, 0x20808000, +0x20008000, 0x00800000, 0x20808020, 0x20000000, +0x20008020, 0x20800000, 0x00800000, 0x20808020, +0x00008000, 0x00800020, 0x20800020, 0x00008020, +0x00800020, 0x00000000, 0x20808000, 0x20000020, +0x20800000, 0x20008020, 0x00000020, 0x00808000, +); +@SP3=( +0x00080201, 0x02000200, 0x00000001, 0x02080201, +0x00000000, 0x02080000, 0x02000201, 0x00080001, +0x02080200, 0x02000001, 0x02000000, 0x00000201, +0x02000001, 0x00080201, 0x00080000, 0x02000000, +0x02080001, 0x00080200, 0x00000200, 0x00000001, +0x00080200, 0x02000201, 0x02080000, 0x00000200, +0x00000201, 0x00000000, 0x00080001, 0x02080200, +0x02000200, 0x02080001, 0x02080201, 0x00080000, +0x02080001, 0x00000201, 0x00080000, 0x02000001, +0x00080200, 0x02000200, 0x00000001, 0x02080000, +0x02000201, 0x00000000, 0x00000200, 0x00080001, +0x00000000, 0x02080001, 0x02080200, 0x00000200, +0x02000000, 0x02080201, 0x00080201, 0x00080000, +0x02080201, 0x00000001, 0x02000200, 0x00080201, +0x00080001, 0x00080200, 0x02080000, 0x02000201, +0x00000201, 0x02000000, 0x02000001, 0x02080200, +); +@SP4=( +0x01000000, 0x00002000, 0x00000080, 0x01002084, +0x01002004, 0x01000080, 0x00002084, 0x01002000, +0x00002000, 0x00000004, 0x01000004, 0x00002080, +0x01000084, 0x01002004, 0x01002080, 0x00000000, +0x00002080, 0x01000000, 0x00002004, 0x00000084, +0x01000080, 0x00002084, 0x00000000, 0x01000004, +0x00000004, 0x01000084, 0x01002084, 0x00002004, +0x01002000, 0x00000080, 0x00000084, 0x01002080, +0x01002080, 0x01000084, 0x00002004, 0x01002000, +0x00002000, 0x00000004, 0x01000004, 0x01000080, +0x01000000, 0x00002080, 0x01002084, 0x00000000, +0x00002084, 0x01000000, 0x00000080, 0x00002004, +0x01000084, 0x00000080, 0x00000000, 0x01002084, +0x01002004, 0x01002080, 0x00000084, 0x00002000, +0x00002080, 0x01002004, 0x01000080, 0x00000084, +0x00000004, 0x00002084, 0x01002000, 0x01000004, +); +@SP5=( +0x10000008, 0x00040008, 0x00000000, 0x10040400, +0x00040008, 0x00000400, 0x10000408, 0x00040000, +0x00000408, 0x10040408, 0x00040400, 0x10000000, +0x10000400, 0x10000008, 0x10040000, 0x00040408, +0x00040000, 0x10000408, 0x10040008, 0x00000000, +0x00000400, 0x00000008, 0x10040400, 0x10040008, +0x10040408, 0x10040000, 0x10000000, 0x00000408, +0x00000008, 0x00040400, 0x00040408, 0x10000400, +0x00000408, 0x10000000, 0x10000400, 0x00040408, +0x10040400, 0x00040008, 0x00000000, 0x10000400, +0x10000000, 0x00000400, 0x10040008, 0x00040000, +0x00040008, 0x10040408, 0x00040400, 0x00000008, +0x10040408, 0x00040400, 0x00040000, 0x10000408, +0x10000008, 0x10040000, 0x00040408, 0x00000000, +0x00000400, 0x10000008, 0x10000408, 0x10040400, +0x10040000, 0x00000408, 0x00000008, 0x10040008, +); +@SP6=( +0x00000800, 0x00000040, 0x00200040, 0x80200000, +0x80200840, 0x80000800, 0x00000840, 0x00000000, +0x00200000, 0x80200040, 0x80000040, 0x00200800, +0x80000000, 0x00200840, 0x00200800, 0x80000040, +0x80200040, 0x00000800, 0x80000800, 0x80200840, +0x00000000, 0x00200040, 0x80200000, 0x00000840, +0x80200800, 0x80000840, 0x00200840, 0x80000000, +0x80000840, 0x80200800, 0x00000040, 0x00200000, +0x80000840, 0x00200800, 0x80200800, 0x80000040, +0x00000800, 0x00000040, 0x00200000, 0x80200800, +0x80200040, 0x80000840, 0x00000840, 0x00000000, +0x00000040, 0x80200000, 0x80000000, 0x00200040, +0x00000000, 0x80200040, 0x00200040, 0x00000840, +0x80000040, 0x00000800, 0x80200840, 0x00200000, +0x00200840, 0x80000000, 0x80000800, 0x80200840, +0x80200000, 0x00200840, 0x00200800, 0x80000800, +); +@SP7=( +0x04100010, 0x04104000, 0x00004010, 0x00000000, +0x04004000, 0x00100010, 0x04100000, 0x04104010, +0x00000010, 0x04000000, 0x00104000, 0x00004010, +0x00104010, 0x04004010, 0x04000010, 0x04100000, +0x00004000, 0x00104010, 0x00100010, 0x04004000, +0x04104010, 0x04000010, 0x00000000, 0x00104000, +0x04000000, 0x00100000, 0x04004010, 0x04100010, +0x00100000, 0x00004000, 0x04104000, 0x00000010, +0x00100000, 0x00004000, 0x04000010, 0x04104010, +0x00004010, 0x04000000, 0x00000000, 0x00104000, +0x04100010, 0x04004010, 0x04004000, 0x00100010, +0x04104000, 0x00000010, 0x00100010, 0x04004000, +0x04104010, 0x00100000, 0x04100000, 0x04000010, +0x00104000, 0x00004010, 0x04004010, 0x04100000, +0x00000010, 0x04104000, 0x00104010, 0x00000000, +0x04000000, 0x04100010, 0x00004000, 0x00104010, +); + +sub main'des_set_key + { + local($param)=@_; + local(@key); + local($c,$d,$i,$s,$t); + local(@ks)=(); + + # Get the bytes in the order we want. + @key=unpack("C8",$param); + + $c= ($key[0] )| + ($key[1]<< 8)| + ($key[2]<<16)| + ($key[3]<<24); + $d= ($key[4] )| + ($key[5]<< 8)| + ($key[6]<<16)| + ($key[7]<<24); + + &doPC1(*c,*d); + + for $i (@shifts2) + { + if ($i) + { + $c=($c>>2)|($c<<26); + $d=($d>>2)|($d<<26); + } + else + { + $c=($c>>1)|($c<<27); + $d=($d>>1)|($d<<27); + } + $c&=0x0fffffff; + $d&=0x0fffffff; + $s= $skb0[ ($c )&0x3f ]| + $skb1[(($c>> 6)&0x03)|(($c>> 7)&0x3c)]| + $skb2[(($c>>13)&0x0f)|(($c>>14)&0x30)]| + $skb3[(($c>>20)&0x01)|(($c>>21)&0x06) | + (($c>>22)&0x38)]; + $t= $skb4[ ($d )&0x3f ]| + $skb5[(($d>> 7)&0x03)|(($d>> 8)&0x3c)]| + $skb6[ ($d>>15)&0x3f ]| + $skb7[(($d>>21)&0x0f)|(($d>>22)&0x30)]; + push(@ks,(($t<<16)|($s&0x0000ffff))&0xffffffff); + $s= ($s>>16)|($t&0xffff0000) ; + push(@ks,(($s<<4)|($s>>28))&0xffffffff); + } + @ks; + } + +sub doPC1 + { + local(*a,*b)=@_; + local($t); + + $t=(($b>>4)^$a)&0x0f0f0f0f; + $b^=($t<<4); $a^=$t; + # do $a first + $t=(($a<<18)^$a)&0xcccc0000; + $a=$a^$t^($t>>18); + $t=(($a<<17)^$a)&0xaaaa0000; + $a=$a^$t^($t>>17); + $t=(($a<< 8)^$a)&0x00ff0000; + $a=$a^$t^($t>> 8); + $t=(($a<<17)^$a)&0xaaaa0000; + $a=$a^$t^($t>>17); + + # now do $b + $t=(($b<<24)^$b)&0xff000000; + $b=$b^$t^($t>>24); + $t=(($b<< 8)^$b)&0x00ff0000; + $b=$b^$t^($t>> 8); + $t=(($b<<14)^$b)&0x33330000; + $b=$b^$t^($t>>14); + $b=(($b&0x00aa00aa)<<7)|(($b&0x55005500)>>7)|($b&0xaa55aa55); + $b=($b>>8)|(($a&0xf0000000)>>4); + $a&=0x0fffffff; + } + +sub doIP + { + local(*a,*b)=@_; + local($t); + + $t=(($b>> 4)^$a)&0x0f0f0f0f; + $b^=($t<< 4); $a^=$t; + $t=(($a>>16)^$b)&0x0000ffff; + $a^=($t<<16); $b^=$t; + $t=(($b>> 2)^$a)&0x33333333; + $b^=($t<< 2); $a^=$t; + $t=(($a>> 8)^$b)&0x00ff00ff; + $a^=($t<< 8); $b^=$t; + $t=(($b>> 1)^$a)&0x55555555; + $b^=($t<< 1); $a^=$t; + $t=$a; + $a=$b&0xffffffff; + $b=$t&0xffffffff; + } + +sub doFP + { + local(*a,*b)=@_; + local($t); + + $t=(($b>> 1)^$a)&0x55555555; + $b^=($t<< 1); $a^=$t; + $t=(($a>> 8)^$b)&0x00ff00ff; + $a^=($t<< 8); $b^=$t; + $t=(($b>> 2)^$a)&0x33333333; + $b^=($t<< 2); $a^=$t; + $t=(($a>>16)^$b)&0x0000ffff; + $a^=($t<<16); $b^=$t; + $t=(($b>> 4)^$a)&0x0f0f0f0f; + $b^=($t<< 4); $a^=$t; + $a&=0xffffffff; + $b&=0xffffffff; + } + +sub main'des_ecb_encrypt + { + local(*ks,$encrypt,$in)=@_; + local($l,$r,$inc,$start,$end,$i,$t,$u,@input); + + @input=unpack("C8",$in); + # Get the bytes in the order we want. + $l= ($input[0] )| + ($input[1]<< 8)| + ($input[2]<<16)| + ($input[3]<<24); + $r= ($input[4] )| + ($input[5]<< 8)| + ($input[6]<<16)| + ($input[7]<<24); + + $l&=0xffffffff; + $r&=0xffffffff; + &doIP(*l,*r); + if ($encrypt) + { + for ($i=0; $i<32; $i+=4) + { + $t=(($r<<1)|($r>>31))&0xffffffff; + $u=$t^$ks[$i ]; + $t=$t^$ks[$i+1]; + $t=(($t>>4)|($t<<28))&0xffffffff; + $l^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + + $t=(($l<<1)|($l>>31))&0xffffffff; + $u=$t^$ks[$i+2]; + $t=$t^$ks[$i+3]; + $t=(($t>>4)|($t<<28))&0xffffffff; + $r^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + } + } + else + { + for ($i=30; $i>0; $i-=4) + { + $t=(($r<<1)|($r>>31))&0xffffffff; + $u=$t^$ks[$i ]; + $t=$t^$ks[$i+1]; + $t=(($t>>4)|($t<<28))&0xffffffff; + $l^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + + $t=(($l<<1)|($l>>31))&0xffffffff; + $u=$t^$ks[$i-2]; + $t=$t^$ks[$i-1]; + $t=(($t>>4)|($t<<28))&0xffffffff; + $r^= $SP1[ $t &0x3f]| + $SP3[($t>> 8)&0x3f]| + $SP5[($t>>16)&0x3f]| + $SP7[($t>>24)&0x3f]| + $SP0[ $u &0x3f]| + $SP2[($u>> 8)&0x3f]| + $SP4[($u>>16)&0x3f]| + $SP6[($u>>24)&0x3f]; + } + } + &doFP(*l,*r); + pack("C8",$l&0xff,$l>>8,$l>>16,$l>>24, + $r&0xff,$r>>8,$r>>16,$r>>24); + } diff --git a/lib/des/des.x b/lib/des/des.x new file mode 100644 index 0000000000000000000000000000000000000000..2674b38b7f91caf6b77b54721e56bc535bbe5226 GIT binary patch literal 3920 zcmaE$GJDd`RBH(?^@k38I&;$*j4bwXOYbnvp4~iaPMSfWz+abMZ8hB;J^GbN$1IfZ zG8;cq&{JSlXkj;BApLlP^TX=bS^LfA(^2N#I%*-g<_0CV1?3uY zEPMIh?(ME!w%`BFJT+C8t&(Ae8@8_Jc^fYjUd%G(YEkOK#oG+_SgY+4Y4?9RcfIL7 zgR_Qj-ew-x30{By${N?dp4KzIhNm@~noTHsDXzusvi^lRDF=dZ3XU4U1{rX*P7k=^bJe4>_h17E*hm5ikb{6j~ee+17 zKz*P88Si;ZyB=QfC|p(j!|CR7&Wt$|CM`42IFb=JA)B-FT*lie5r>jRYUUa*U(sCp zv)omdsb7~V`n}BmSf6ty?P&%~T=BiVzucr* zF3c3QuxMxaHz(S2`oW#=*w^r{?%vUm!m;Sj8U@8WSM^RkvH5hWOGNPj<8h`5nFcmp zPqlmx`uioR)qhCp6I_`0v+4QP=$;({0rCG##iGlqUaR2oatNzt)l7FFHYkxc3{K4de-xa@Gx-`~I)BFFYqrH8h z>izTejtMQ{Uyi@D`)QK0muWN852ihm=N~=}x>}Fi5V@LYhpCR{qC*OjuKm?#nC%%uuCb#%u-vnLF8xN1g|-7 zzxyrwWy95fVWC^zzn9ni*gfC=*G?(HW6Iy@-q`r1a@Oq+lXYf0O`Nf3eeLwAj8`5Wocr458~eug zdWFc7|2z)e>{Z)+lINW1SKD0+-EJ`HR&j3Zieo=f^n+{3Pto_)@`gt`S2i0j&t4Ov zk$d2#fK9t~_IGPGp1<~HoNG(geLZsgM&nd#71=G*Jzsv~x%1N{ssGL!&*+tojgs<$ zvuiGV539X&Gx@@0u0?En*!o*rO%vO7mzL(Q&52puzHMT?gXF}w^ShT`b6!7FZ2i^? z^+}CpS6u^y8{Wxxd0tibw|nXku5wm$efN9OT?X@mzpk3r{-eG?a87=Brq4q^Mt*i&>OqTb~F`J17Ac7vAstrPN*n*}c)f3`Ev`@B=w z8cw^H1Kc?HYSxK$AWuwhBwL@3VmNQS2o3_hgfyGQ$*UWUOwP{fSpM`ZYcD$^T z(s+A&N8g{l{7e&tj1YC9I${WRw26*(QHt8Mf#c-r4C%}J_#Jo{D` zYilJ69N}rb%;mC6+Iw@b#QVe@5lvweem@kt{pGL!C041ACMw1MlpdMSabCK6^;2_y zhu#f)9eLL2rd^eo=K4WgnDc$yf`t!Ht6w(R*p$rSpL(aoyX~3BiYPm!*a$zRJgJB4 zUZ!b9K0b5%q}}hokIn?G4_TsRQ2zPr^Jf)j9lFyhR))x}*pSdS?UR(!>gw*}lR7vf znl3D@HhZ+caF)cuOH~W^2~G{XnB(uYU;*R%-zf(lt|`-9?(%wzr-Cp0%hZ+(?Vk-o zYnPmSRQxiZ$GhUeE~_tMQ!BQgT6S;7s_IvZubD47A*{FiGuKZ29ObEJdyUpMuNTXH zw{XLPxNg%=#oK-`U3}e|Y(HtXu8QF`y{8(hW`;NXWAtS%aG&iG_wfAUnekTbwztB2 ztHpwU?fYST>B*C=1uSddg*v@zYrMSMI7gB3^7J3iWPcru32a^NYyPZ_`(QrTkLA&h zwk7Oa_S{_0!nf+oz2(Our|$k98z1QwD&GB3TgFpP^2P>*J95*N|22L~GS&YWzSDg} zK+8L)Vm|M$1&REYd^v*6o)_muK6v$@Q%6EoaLRg%mZWV^SqL+>9QPrlvN1PiBC-Ur?YH`+J#rMsCMS zYzzzD!`yvD$H4C6Znl!8PfsoU+j3>eo(DAtE=`@d#%z@Oa8GX zTvt};b}>xR;v?H<2Tn^NXMc~0OMTwkPi-mJ+~%SpF3I9z?ySF=?f2TZw|wrde)H6M z$MtEp6>rbm{eJQEm&XLHs)-NX-8D;!Jdg9aE-F4<^f~zC#I|QCs z@V7N%{tv&6Z2|L*Ci3w_L|JZYx_nw}`UKr1p6d1GwsG<&_8%zw*eqG+;d5l^Lp^~* z{~o10YGZG`$6@g^CTfF%lAzFG0d|qO=dHx28#qqukXn4B-g?99C!UtG-SyIbc-8*g zV|sVi1@Vyc*5_R&+28xBSn|}_^l8< zcnf1<@(0N+h zv~xm2ra#|f^T0{i;=kV6C)x|I&Ck<3b#`(4wHpGJdEd&_Cuf*$o^n2RNy3MHi~D-6 zeKwifv-ZNo44Ds0FNQ6gvU*mq<-ex(Quebs-!C3Aw~Uur>vizuhbfNBmwu05@}Ga6 z*MrzOzLxCqi$7F^x@FZ|R+{sCW7E%eN zKiD2%5_$6V{p7QU72Nt-w!P5perzYOL;gaF$!qCg1+#x!gu|8`;GVbbTm7dE%RCN$zj#X6_$B|;{JBT> zYDQ^RUih%!+`l5dS6e&7R(4eW&0MfSGSkIv=jZmNp9~JBUG)@h<>ETZcQb41TCuAf zd~tis3u7Bjuh4KwO%*W|;0XHn^Y;0l5mGa();Zl;|8T?mo%@$8XE}c%Sg#|`a@kH6 zV~NwDm)Y3g3octD7M>QY)cEv&*{hH1!;M-Kt{K-q|012RPHI9QL(HoqOm_J%eLtjC zEih>{oR@I(ZcuK4ZdE~%t619O?hVNo94h*coM(420ZV*tJ%qtJ|i$^PXJvT1csXYgzXG|A&mjc6oKYTk>e}&%B8`#cWF~ zRNFos*>-8O*ZF*ZD<#RAD_dW796jljliBU-t(;Wa@FumyD>NuSdXrJIe59gR^!NHe zmZJfGmX&|o{3=iC-N9E}pI_g9nDXyjX^3O;&caPA=kec4T=(VabT{W>uC+IgS$vlE z{u_BBxXNobyY151SJW=uT%OSL{Kv(odD{XswEE#q1x0%<=_v~ycH@aYM>rq)9@a{*n$dsLBKh*>kM}l} zw}xywsmUA{TzyN=<5|hPJ%OD|zW)3jJz-+&sh8W1nPk4xUdP-r_seb`v86J*drAd7 zeb<!8C!0%QYXU^VQc2E3k+l;oByzL_g|^=Ty(tg!!*^j_7xSgx>tm6 zIr~%han|GsS8g9NRXbSGdwJb=g&4=l`Csn#zghZ5>VMDM%!S?$a%bGUa6IVQ13v~a_oJMNt6Xe0m=;Ja zYp>mR>+1S0!IXzZr|WsdOqt8(n*L+z{Or@}D^)Hq`IeM<&+gEBqHlw%JU*68xb*w6 z{Jvd#(JRS{H-1>Ry3-;d)av6-p7SO9O01-99)urIc)wgy@vqil j!w&%rHx4J7K5<*?_tRrxsklvz)ZT;9*M6mx#s~rc!zHO} literal 0 HcmV?d00001 diff --git a/lib/des/des_crypt.3 b/lib/des/des_crypt.3 new file mode 100644 index 000000000..aa6675016 --- /dev/null +++ b/lib/des/des_crypt.3 @@ -0,0 +1,381 @@ +.\" $Source$ +.\" $Author$ +.\" $Header$ +.\" Copyright 1989 by the Massachusetts Institute of Technology. +.\" +.\" For copying and distribution information, +.\" please see the file . +.\" +.TH DES_CRYPT 3 "Kerberos Version 4.0" "MIT Project Athena" +.SH NAME +des_read_password, des_string_to_key, des_random_key, des_set_key, +des_ecb_encrypt, des_cbc_encrypt, des_pcbc_encrypt, des_cbc_cksum, +des_quad_cksum, \- (new) DES encryption +.SH SYNOPSIS +.nf +.nj +.ft B +#include +.PP +.ft B +.B int des_read_password(key,prompt,verify) +des_cblock *key; +char *prompt; +int verify; +.PP +.ft B +int des_string_to_key(str,key) +char *str; +des_cblock key; +.PP +.ft B +int des_random_key(key) +des_cblock *key; +.PP +.ft B +int des_set_key(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.ft B +int des_ecb_encrypt(input,output,schedule,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule schedule; +int encrypt; +.PP +.ft B +int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.ft B +int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.ft B +unsigned long des_cbc_cksum(input,output,length,schedule,ivec) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.ft B +unsigned long quad_cksum(input,output,length,out_count,seed) +des_cblock *input; +des_cblock *output; +long length; +int out_count; +des_cblock *seed; +.PP +.fi +.SH DESCRIPTION +This library supports various DES encryption related operations. It differs +from the +.I crypt, setkey, and encrypt +library routines in that it provides +a true DES encryption, without modifying the algorithm, +and executes much faster. +.PP +For each key that may be simultaneously active, create a +.B des_key_schedule +struct, +defined in "des.h". Next, create key schedules (from the 8-byte keys) as +needed, via +.I des_set_key, +prior to using the encryption or checksum routines. Then +setup the input and output areas. Make sure to note the restrictions +on lengths being multiples of eight bytes. Finally, invoke the +encryption/decryption routines, +.I des_ecb_encrypt +or +.I des_cbc_encrypt +or +.I des_pcbc_encrypt, +or, to generate a cryptographic checksum, use +.I quad_cksum +(fast) or +.I des_cbc_cksum +(slow). +.PP +A +.I des_cblock +struct is an 8 byte block used as the fundamental unit for DES data and +keys, and is defined as: +.PP +.B typedef unsigned char des_cblock[8]; +.PP +and a +.I des_key_schedule, +is defined as: +.PP +.B typedef struct des_ks_struct {des_cblock _;} des_key_schedule[16]; +.PP +.I des_read_password +writes the string specified by +.I prompt +to the standard +output, turns off echo (if possible) +and reads an input string from standard input until terminated with a newline. +If +.I verify +is non-zero, it prompts and reads input again, for use +in applications such as changing a password; both +versions are compared, and the input is requested repeatedly until they +match. Then +.I des_read_password +converts the input string into a valid DES key, internally +using the +.I des_string_to_key +routine. The newly created key is copied to the +area pointed to by the +.I key +argument. +.I des_read_password +returns a zero if no errors occurred, or a -1 +indicating that an error +occurred trying to manipulate the terminal echo. +.PP +.PP +.I des_string_to_key +converts an arbitrary length null-terminated string +to an 8 byte DES key, with odd byte parity, per FIPS specification. +A one-way function is used to convert the string to a key, making it +very difficult to reconstruct the string from the key. +The +.I str +argument is a pointer to the string, and +.I key +should +point to a +.I des_cblock +supplied by the caller to receive the generated key. +No meaningful value is returned. Void is not used for compatibility with +other compilers. +.PP +.PP +.I des_random_key +generates a random DES encryption key (eight bytes), set to odd parity per +FIPS +specifications. +This routine uses the current time, process id, and a counter +as a seed for the random number generator. +The caller must supply space for the output key, pointed to +by argument +.I key, +then after calling +.I des_random_key +should +call the +.I des_set_key +routine when needed. +No meaningful value is returned. Void is not used for compatibility +with other compilers. +.PP +.PP +.I des_set_key +calculates a key schedule from all eight bytes of the input key, pointed +to by the +.I key +argument, and outputs the schedule into the +.I des_key_schedule +indicated by the +.I schedule +argument. Make sure to pass a valid eight byte +key; no padding is done. The key schedule may then be used in subsequent +encryption/decryption/checksum operations. Many key schedules may be +cached for later use. The user is responsible to clear keys and schedules +as soon as no longer needed, to prevent their disclosure. +The routine also checks the key +parity, and returns a zero if the key parity is correct (odd), a -1 +indicating a key parity error, or a -2 indicating use of an illegal +weak key. If an error is returned, the key schedule was not created. +.PP +.PP +.I des_ecb_encrypt +is the basic DES encryption routine that encrypts or decrypts a single 8-byte +block in +.B electronic code book +mode. It always transforms the input data, pointed to by +.I input, +into the output data, pointed to by the +.I output +argument. +.PP +If the +.I encrypt +argument is non-zero, the +.I input +(cleartext) is encrypted into the +.I output +(ciphertext) using the key_schedule specified by the +.I schedule +argument, previously set via +.I des_set_key +.PP +If encrypt is zero, the +.I input +(now ciphertext) is decrypted into the +.I output +(now cleartext). +.PP +Input and output may overlap. +.PP +No meaningful value is returned. Void is not used for compatibility +with other compilers. +.PP +.PP +.I des_cbc_encrypt +encrypts/decrypts using the +.B cipher-block-chaining mode of DES. +If the +.I encrypt +argument is non-zero, the routine cipher-block-chain encrypts +the cleartext data pointed to by the +.I input +argument into the ciphertext pointed to by the +.I output +argument, using the key schedule provided by the +.I schedule +argument, and initialization vector provided by the +.I ivec +argument. +If the +.I length +argument is not an integral +multiple of eight bytes, the last block is copied to a temp and zero +filled (highest addresses). The output is ALWAYS an integral multiple +of eight bytes. +.PP +If +.I encrypt +is zero, the routine cipher-block chain decrypts the (now) ciphertext +data pointed to by the +.I input +argument into (now) cleartext pointed to by the +.I output +argument using the key schedule provided by the +.I schedule +argument, and initialization vector provided by the +.I ivec +argument. Decryption ALWAYS operates on integral +multiples of 8 bytes, so it will round the +.I length +provided up to the +appropriate multiple. Consequently, it will always produce the rounded-up +number of bytes of output cleartext. The application must determine if +the output cleartext was zero-padded due to original cleartext lengths that +were not integral multiples of 8. +.PP +No errors or meaningful values are returned. Void is not used for +compatibility with other compilers. +.PP +A characteristic of cbc mode is that changing a single bit of the +cleartext, then encrypting using cbc mode, +affects ALL the subsequent ciphertext. This makes cryptanalysis +much more difficult. However, modifying a single bit of the ciphertext, +then decrypting, only affects the resulting cleartext from +the modified block and the succeeding block. Therefore, +.I des_pcbc_encrypt +is STRONGLY recommended for applications where +indefinite propagation of errors is required in order to detect modifications. +.PP +.PP +.I des_pcbc_encrypt +encrypts/decrypts using a modified block chaining mode. Its calling +sequence is identical to +.I des_cbc_encrypt. +It differs in its error propagation characteristics. +.PP +.I des_pcbc_encrypt +is highly recommended for most encryption purposes, in that +modification of a single bit of the ciphertext will affect ALL the +subsequent (decrypted) cleartext. Similarly, modifying a single bit of +the cleartext will affect ALL the subsequent (encrypted) ciphertext. +"PCBC" mode, on encryption, "xors" both the +cleartext of block N and the ciphertext resulting from block N with the +cleartext for block N+1 prior to encrypting block N+1. +.PP +.I des_cbc_cksum +produces an 8 byte cryptographic checksum by cipher-block-chain +encrypting the cleartext data pointed to by the +.I input +argument. All of the ciphertext output is discarded, except the +last 8-byte ciphertext block, which is written into the area pointed to by +the +.I output +argument. +It uses the key schedule, +provided by the +.I schedule +argument and initialization vector provided by the +.I ivec +argument. +If the +.I length +argument is not an integral +multiple of eight bytes, the last cleartext block is copied to a temp and zero +filled (highest addresses). The output is ALWAYS eight bytes. +.PP +The routine also returns an unsigned long, which is the last (highest address) +half of the 8 byte checksum computed. +.PP +.PP +.I quad_cksum +produces a checksum by chaining quadratic operations on the cleartext data +pointed to by the +.I input +argument. The +.I length +argument specifies the length of the +input -- only exactly that many bytes are included for the checksum, +without any padding. +.PP +The algorithm may be iterated over the same input data, if the +.I out_count +argument is 2, 3 or 4, and the optional +.I output +argument is a non-null pointer . +The default is one iteration, and it will not run +more than 4 times. Multiple iterations run slower, but provide +a longer checksum if desired. The +.I seed +argument provides an 8-byte seed for the first iteration. If multiple iterations are +requested, the results of one iteration are automatically used as +the seed for the next iteration. +.PP +It returns both an unsigned long checksum value, and +if the +.I output +argument is not a null pointer, up to 16 bytes of +the computed checksum are written into the output. +.PP +.PP +.SH FILES +/usr/include/des.h +.br +/usr/lib/libdes.a +.SH "SEE ALSO" +.SH DIAGNOSTICS +.SH BUGS +This software has not yet been compiled or tested on machines other than the +VAX and the IBM PC. +.SH AUTHORS +Steve Miller, MIT Project Athena/Digital Equipment Corporation +.SH RESTRICTIONS +COPYRIGHT 1985,1986 Massachusetts Institute of Technology +.PP +This software may not be exported outside of the US without a special +license from the US Dept of Commerce. It may be replaced by any secret +key block cipher with block length and key length of 8 bytes, as long +as the interface is the same as described here. diff --git a/lib/des/des_crypt.man b/lib/des/des_crypt.man new file mode 100644 index 000000000..c05e07085 --- /dev/null +++ b/lib/des/des_crypt.man @@ -0,0 +1,502 @@ +.TH DES_CRYPT 3 +.SH NAME +des_read_password, des_read_2password, +des_string_to_key, des_string_to_2key, des_read_pw_string, +des_random_key, des_set_key, +des_key_sched, des_ecb_encrypt, des_3ecb_encrypt, des_cbc_encrypt, +des_3cbc_encrypt, +des_pcbc_encrypt, des_cfb_encrypt, des_ofb_encrypt, +des_cbc_cksum, des_quad_cksum, +des_enc_read, des_enc_write, des_set_odd_parity, +des_is_weak_key, crypt \- (non USA) DES encryption +.SH SYNOPSIS +.nf +.nj +.ft B +#include +.PP +.B int des_read_password(key,prompt,verify) +des_cblock *key; +char *prompt; +int verify; +.PP +.B int des_read_2password(key1,key2,prompt,verify) +des_cblock *key1,*key2; +char *prompt; +int verify; +.PP +.B int des_string_to_key(str,key) +char *str; +des_cblock *key; +.PP +.B int des_string_to_2keys(str,key1,key2) +char *str; +des_cblock *key1,*key2; +.PP +.B int des_read_pw_string(buf,length,prompt,verify) +char *buf; +int length; +char *prompt; +int verify; +.PP +.B int des_random_key(key) +des_cblock *key; +.PP +.B int des_set_key(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.B int des_key_sched(key,schedule) +des_cblock *key; +des_key_schedule schedule; +.PP +.B int des_ecb_encrypt(input,output,schedule,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule schedule; +int encrypt; +.PP +.B int des_3ecb_encrypt(input,output,ks1,ks2,encrypt) +des_cblock *input; +des_cblock *output; +des_key_schedule ks1,ks2; +int encrypt; +.PP +.B int des_cbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_3cbc_encrypt(input,output,length,sk1,sk2,ivec1,ivec2,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule sk1; +des_key_schedule sk2; +des_cblock *ivec1; +des_cblock *ivec2; +int encrypt; +.PP +.B int des_pcbc_encrypt(input,output,length,schedule,ivec,encrypt) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_cfb_encrypt(input,output,numbits,length,schedule,ivec,encrypt) +unsigned char *input; +unsigned char *output; +int numbits; +long length; +des_key_schedule schedule; +des_cblock *ivec; +int encrypt; +.PP +.B int des_ofb_encrypt(input,output,numbits,length,schedule,ivec) +unsigned char *input,*output; +int numbits; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.B unsigned long des_cbc_cksum(input,output,length,schedule,ivec) +des_cblock *input; +des_cblock *output; +long length; +des_key_schedule schedule; +des_cblock *ivec; +.PP +.B unsigned long des_quad_cksum(input,output,length,out_count,seed) +des_cblock *input; +des_cblock *output; +long length; +int out_count; +des_cblock *seed; +.PP +.B int des_check_key; +.PP +.B int des_enc_read(fd,buf,len,sched,iv) +int fd; +char *buf; +int len; +des_key_schedule sched; +des_cblock *iv; +.PP +.B int des_enc_write(fd,buf,len,sched,iv) +int fd; +char *buf; +int len; +des_key_schedule sched; +des_cblock *iv; +.PP +.B extern int des_rw_mode; +.PP +.B void des_set_odd_parity(key) +des_cblock *key; +.PP +.B int des_is_weak_key(key) +des_cblock *key; +.PP +.B char *crypt(passwd,salt) +char *passwd; +char *salt; +.PP +.fi +.SH DESCRIPTION +This library contains a fast implementation of the DES encryption +algorithm. +.PP +There are two phases to the use of DES encryption. +The first is the generation of a +.I des_key_schedule +from a key, +the second is the actual encryption. +A des key is of type +.I des_cblock. +This type is made from 8 characters with odd parity. +The least significant bit in the character is the parity bit. +The key schedule is an expanded form of the key; it is used to speed the +encryption process. +.PP +.I des_read_password +writes the string specified by prompt to the standard output, +turns off echo and reads an input string from standard input +until terminated with a newline. +If verify is non-zero, it prompts and reads the input again and verifies +that both entered passwords are the same. +The entered string is converted into a des key by using the +.I des_string_to_key +routine. +The new key is placed in the +.I des_cblock +that was passed (by reference) to the routine. +If there were no errors, +.I des_read_password +returns 0, +-1 is returned if there was a terminal error and 1 is returned for +any other error. +.PP +.I des_read_2password +operates in the same way as +.I des_read_password +except that it generates 2 keys by using the +.I des_string_to_2key +function. +.PP +.I des_read_pw_string +is called by +.I des_read_password +to read and verify a string from a terminal device. +The string is returned in +.I buf. +The size of +.I buf +is passed to the routine via the +.I length +parameter. +.PP +.I des_string_to_key +converts a string into a valid des key. +.PP +.I des_string_to_2key +converts a string into 2 valid des keys. +This routine is best suited for used to generate keys for use with +.I des_3ecb_encrypt. +.PP +.I des_random_key +returns a random key that is made of a combination of process id, +time and an increasing counter. +.PP +Before a des key can be used it is converted into a +.I des_key_schedule +via the +.I des_set_key +routine. +If the +.I des_check_key +flag is non-zero, +.I des_set_key +will check that the key passed is of odd parity and is not a week or +semi-weak key. +If the parity is wrong, +then -1 is returned. +If the key is a weak key, +then -2 is returned. +If an error is returned, +the key schedule is not generated. +.PP +.I des_key_sched +is another name for the +.I des_set_key +function. +.PP +The following routines mostly operate on an input and output stream of +.I des_cblock's. +.PP +.I des_ecb_encrypt +is the basic DES encryption routine that encrypts or decrypts a single 8-byte +.I des_cblock +in +.I electronic code book +mode. +It always transforms the input data, pointed to by +.I input, +into the output data, +pointed to by the +.I output +argument. +If the +.I encrypt +argument is non-zero (DES_ENCRYPT), +the +.I input +(cleartext) is encrypted in to the +.I output +(ciphertext) using the key_schedule specified by the +.I schedule +argument, +previously set via +.I des_set_key. +If +.I encrypt +is zero (DES_DECRYPT), +the +.I input +(now ciphertext) +is decrypted into the +.I output +(now cleartext). +Input and output may overlap. +No meaningful value is returned. +.PP +.I des_3ecb_encrypt +encrypts/decrypts the +.I input +block by using triple ecb DES encryption. +This involves encrypting the input with +.I ks1, +decryption with the key schedule +.I ks2, +and then encryption with the first again. +This routine greatly reduces the chances of brute force breaking of +DES and has the advantage of if +.I ks1 +and +.I ks2 +are the same, it is equivalent to just encryption using ecb mode and +.I ks1 +as the key. +.PP +.I des_cbc_encrypt +encrypts/decrypts using the +.I cipher-block-chaining +mode of DES. +If the +.I encrypt +argument is non-zero, +the routine cipher-block-chain encrypts the cleartext data pointed to by the +.I input +argument into the ciphertext pointed to by the +.I output +argument, +using the key schedule provided by the +.I schedule +argument, +and initialisation vector provided by the +.I ivec +argument. +If the +.I length +argument is not an integral multiple of eight bytes, +the last block is copied to a temporary area and zero filled. +The output is always +an integral multiple of eight bytes. +To make multiple cbc encrypt calls on a large amount of data appear to +be one +.I des_cbc_encrypt +call, the +.I ivec +of subsequent calls should be the last 8 bytes of the output. +.PP +.I des_3cbc_encrypt +encrypts/decrypts the +.I input +block by using triple cbc DES encryption. +This involves encrypting the input with key schedule +.I ks1, +decryption with the key schedule +.I ks2, +and then encryption with the first again. +2 initialisation vectors are required, +.I ivec1 +and +.I ivec2. +Unlike +.I des_cbc_encrypt, +these initialisation vectors are modified by the subroutine. +This routine greatly reduces the chances of brute force breaking of +DES and has the advantage of if +.I ks1 +and +.I ks2 +are the same, it is equivalent to just encryption using cbc mode and +.I ks1 +as the key. +.PP +.I des_pcbc_encrypt +encrypt/decrypts using a modified block chaining mode. +It provides better error propagation characteristics than cbc +encryption. +.PP +.I des_cfb_encrypt +encrypt/decrypts using cipher feedback mode. This method takes an +array of characters as input and outputs and array of characters. It +does not require any padding to 8 character groups. Note: the ivec +variable is changed and the new changed value needs to be passed to +the next call to this function. Since this function runs a complete +DES ecb encryption per numbits, this function is only suggested for +use when sending small numbers of characters. +.PP +.I des_ofb_encrypt +encrypt using output feedback mode. This method takes an +array of characters as input and outputs and array of characters. It +does not require any padding to 8 character groups. Note: the ivec +variable is changed and the new changed value needs to be passed to +the next call to this function. Since this function runs a complete +DES ecb encryption per numbits, this function is only suggested for +use when sending small numbers of characters. +.PP +.I des_cbc_cksum +produces an 8 byte checksum based on the input stream (via cbc encryption). +The last 4 bytes of the checksum is returned and the complete 8 bytes is +placed in +.I output. +.PP +.I des_quad_cksum +returns a 4 byte checksum from the input bytes. +The algorithm can be iterated over the input, +depending on +.I out_count, +1, 2, 3 or 4 times. +If +.I output +is non-NULL, +the 8 bytes generated by each pass are written into +.I output. +.PP +.I des_enc_write +is used to write +.I len +bytes +to file descriptor +.I fd +from buffer +.I buf. +The data is encrypted via +.I pcbc_encrypt +(default) using +.I sched +for the key and +.I iv +as a starting vector. +The actual data send down +.I fd +consists of 4 bytes (in network byte order) containing the length of the +following encrypted data. The encrypted data then follows, padded with random +data out to a multiple of 8 bytes. +.PP +.I des_enc_read +is used to read +.I len +bytes +from file descriptor +.I fd +into buffer +.I buf. +The data being read from +.I fd +is assumed to have come from +.I des_enc_write +and is decrypted using +.I sched +for the key schedule and +.I iv +for the initial vector. +The +.I des_enc_read/des_enc_write +pair can be used to read/write to files, pipes and sockets. +I have used them in implementing a version of rlogin in which all +data is encrypted. +.PP +.I des_rw_mode +is used to specify the encryption mode to use with +.I des_enc_read +and +.I des_end_write. +If set to +.I DES_PCBC_MODE +(the default), des_pcbc_encrypt is used. +If set to +.I DES_CBC_MODE +des_cbc_encrypt is used. +These two routines and the variable are not part of the normal MIT library. +.PP +.I des_set_odd_parity +sets the parity of the passed +.I key +to odd. This routine is not part of the standard MIT library. +.PP +.I des_is_weak_key +returns 1 is the passed key is a weak key (pick again :-), +0 if it is ok. +This routine is not part of the standard MIT library. +.PP +.I crypt +is a replacement for the normal system crypt. +It is much faster than the system crypt. +.PP +.SH FILES +/usr/include/des.h +.br +/usr/lib/libdes.a +.PP +The encryption routines have been tested on 16bit, 32bit and 64bit +machines of various endian and even works under VMS. +.PP +.SH BUGS +.PP +If you think this manual is sparse, +read the des_crypt(3) manual from the MIT kerberos (or bones outside +of the USA) distribution. +.PP +.I des_cfb_encrypt +and +.I des_ofb_encrypt +operates on input of 8 bits. What this means is that if you set +numbits to 12, and length to 2, the first 12 bits will come from the 1st +input byte and the low half of the second input byte. The second 12 +bits will have the low 8 bits taken from the 3rd input byte and the +top 4 bits taken from the 4th input byte. The same holds for output. +This function has been implemented this way because most people will +be using a multiple of 8 and because once you get into pulling bytes input +bytes apart things get ugly! +.PP +.I des_read_pw_string +is the most machine/OS dependent function and normally generates the +most problems when porting this code. +.PP +.I des_string_to_key +is probably different from the MIT version since there are lots +of fun ways to implement one-way encryption of a text string. +.PP +The routines are optimised for 32 bit machines and so are not efficient +on IBM PCs. +.SH AUTHOR +Eric Young (eay@psych.psy.uq.oz.au), +Psychology Department, +University of Queensland, Australia. diff --git a/lib/des/des_locl.h b/lib/des/des_locl.h new file mode 100644 index 000000000..b8b46a60a --- /dev/null +++ b/lib/des/des_locl.h @@ -0,0 +1,174 @@ +/* des_locl.h */ +/* Copyright (C) 1993 Eric Young - see README for more details */ + +#ifndef __des_locl_h +#define __des_locl_h + +#include "config.h" +#include "protos.h" + +#include +#include + +#include +#include +#include +#include +#include + +#include "des.h" + +#define ITERATIONS 16 +#define HALF_ITERATIONS 8 + +/* used in des_read and des_write */ +#define MAXWRITE (1024*16) +#define BSIZE (MAXWRITE+4) + +#define c2l(c,l) (l =((u_int32_t)(*((c)++))) , \ + l|=((u_int32_t)(*((c)++)))<< 8, \ + l|=((u_int32_t)(*((c)++)))<<16, \ + l|=((u_int32_t)(*((c)++)))<<24) + +/* NOTE - c is not incremented as per c2l */ +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2|=((u_int32_t)(*(--(c))))<<24; \ + case 7: l2|=((u_int32_t)(*(--(c))))<<16; \ + case 6: l2|=((u_int32_t)(*(--(c))))<< 8; \ + case 5: l2|=((u_int32_t)(*(--(c)))); \ + case 4: l1|=((u_int32_t)(*(--(c))))<<24; \ + case 3: l1|=((u_int32_t)(*(--(c))))<<16; \ + case 2: l1|=((u_int32_t)(*(--(c))))<< 8; \ + case 1: l1|=((u_int32_t)(*(--(c)))); \ + } \ + } + +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24)&0xff)) + +/* replacements for htonl and ntohl since I have no idea what to do + * when faced with machines with 8 byte longs. */ +#define HDRSIZE 4 + +#define n2l(c,l) (l =((u_int32_t)(*((c)++)))<<24, \ + l|=((u_int32_t)(*((c)++)))<<16, \ + l|=((u_int32_t)(*((c)++)))<< 8, \ + l|=((u_int32_t)(*((c)++)))) + +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +/* The changes to this macro may help or hinder, depending on the + * compiler and the achitecture. gcc2 always seems to do well :-). + * Inspired by Dana How + * DO NOT use the alternative version on machines with 8 byte longs. */ +#ifdef ALT_ECB +#define D_ENCRYPT(L,R,S) \ + u=((R^s[S ])<<2); \ + t= R^s[S+1]; \ + t=((t>>2)+(t<<30)); \ + L^= \ + *(u_int32_t *)(des_SP+0x0100+((t )&0xfc))+ \ + *(u_int32_t *)(des_SP+0x0300+((t>> 8)&0xfc))+ \ + *(u_int32_t *)(des_SP+0x0500+((t>>16)&0xfc))+ \ + *(u_int32_t *)(des_SP+0x0700+((t>>24)&0xfc))+ \ + *(u_int32_t *)(des_SP+ ((u )&0xfc))+ \ + *(u_int32_t *)(des_SP+0x0200+((u>> 8)&0xfc))+ \ + *(u_int32_t *)(des_SP+0x0400+((u>>16)&0xfc))+ \ + *(u_int32_t *)(des_SP+0x0600+((u>>24)&0xfc)); +#else /* original version */ +#ifdef MSDOS +#define D_ENCRYPT(L,R,S) \ + U.l=R^s[S+1]; \ + T.s[0]=((U.s[0]>>4)|(U.s[1]<<12))&0x3f3f; \ + T.s[1]=((U.s[1]>>4)|(U.s[0]<<12))&0x3f3f; \ + U.l=(R^s[S ])&0x3f3f3f3f; \ + L^= des_SPtrans[1][(T.c[0])]| \ + des_SPtrans[3][(T.c[1])]| \ + des_SPtrans[5][(T.c[2])]| \ + des_SPtrans[7][(T.c[3])]| \ + des_SPtrans[0][(U.c[0])]| \ + des_SPtrans[2][(U.c[1])]| \ + des_SPtrans[4][(U.c[2])]| \ + des_SPtrans[6][(U.c[3])]; +#else +#define D_ENCRYPT(L,R,S) \ + u=(R^s[S ]); \ + t=R^s[S+1]; \ + t=((t>>4)+(t<<28)); \ + L^= des_SPtrans[1][(t )&0x3f]| \ + des_SPtrans[3][(t>> 8)&0x3f]| \ + des_SPtrans[5][(t>>16)&0x3f]| \ + des_SPtrans[7][(t>>24)&0x3f]| \ + des_SPtrans[0][(u )&0x3f]| \ + des_SPtrans[2][(u>> 8)&0x3f]| \ + des_SPtrans[4][(u>>16)&0x3f]| \ + des_SPtrans[6][(u>>24)&0x3f]; +#endif +#endif + + /* IP and FP + * The problem is more of a geometric problem that random bit fiddling. + 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 + 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 + 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 + 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 + + 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 + 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 + 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 + 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 + + The output has been subject to swaps of the form + 0 1 -> 3 1 but the odd and even bits have been put into + 2 3 2 0 + different words. The main trick is to remember that + t=((l>>size)^r)&(mask); + r^=t; + l^=(t<>(n))^(b))&(m)),\ + (b)^=(t),\ + (a)^=((t)<<(n))) + + +#endif /* __des_locl_h */ diff --git a/lib/des/destest.c b/lib/des/destest.c new file mode 100644 index 000000000..7cc3650ca --- /dev/null +++ b/lib/des/destest.c @@ -0,0 +1,373 @@ +/* destest.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include +#include "des_locl.h" /* for des.h and bcopy macros */ +/* tisk tisk - the test keys don't all have odd parity :-( */ + +#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) +#include +#define bcopy(f,t,n) memcpy(t,f,(size_t)(n)) +#define bzero(s,n) memset(s,0,(size_t)(n)) +#define bcmp(a,b,n) memcmp(a, b,(size_t)(n)) +#define index(s,c) strchr(s,c) +#endif + +/* test data */ +#define NUM_TESTS 34 +static unsigned char key_data[NUM_TESTS][8]={ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, + 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, + 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, + 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, + 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, + 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, + 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, + 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, + 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, + 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, + 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, + 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, + 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, + 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, + 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, + 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, + 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, + 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, + 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, + 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10}; + +static unsigned char plain_data[NUM_TESTS][8]={ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, + 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, + 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, + 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, + 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, + 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, + 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, + 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, + 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, + 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, + 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, + 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, + 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, + 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, + 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, + 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, + 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, + 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, + 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}; + +static unsigned char cipher_data[NUM_TESTS][8]={ + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, + 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, + 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, + 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, + 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, + 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, + 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, + 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, + 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, + 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, + 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, + 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, + 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, + 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, + 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, + 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, + 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, + 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, + 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, + 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, + 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, + 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, + 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, + 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, + 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, + 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, + 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, + 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, + 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, + 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, + 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2}; + +static unsigned char cbc_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; +static unsigned char cbc_iv[8]={0xfe,0xdc,0xba,0x98,0x76,0x54,0x32,0x10}; +static unsigned char cbc_data[40]="7654321 Now is the time for "; + +static unsigned char cbc_ok[32]={ + 0xcc,0xd1,0x73,0xff,0xab,0x20,0x39,0xf4, + 0xac,0xd8,0xae,0xfd,0xdf,0xd8,0xa1,0xeb, + 0x46,0x8e,0x91,0x15,0x78,0x88,0xba,0x68, + 0x1d,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; + +static unsigned char pcbc_ok[32]={ + 0xcc,0xd1,0x73,0xff,0xab,0x20,0x39,0xf4, + 0x6d,0xec,0xb4,0x70,0xa0,0xe5,0x6b,0x15, + 0xae,0xa6,0xbf,0x61,0xed,0x7d,0x9c,0x9f, + 0xf7,0x17,0x46,0x3b,0x8a,0xb3,0xcc,0x88}; + +static unsigned char cksum_ok[8]={ + 0x1d,0x26,0x93,0x97,0xf7,0xfe,0x62,0xb4}; + +static unsigned char cfb_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; +static unsigned char cfb_iv[8]={0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef}; +static unsigned char cfb_buf1[24],cfb_buf2[24],cfb_tmp[8]; +static unsigned char cfb_plain[24]= +{ + 0x4e,0x6f,0x77,0x20,0x69,0x73, + 0x20,0x74,0x68,0x65,0x20,0x74, + 0x69,0x6d,0x65,0x20,0x66,0x6f, + 0x72,0x20,0x61,0x6c,0x6c,0x20 +}; +static unsigned char cfb_cipher[24]= +{ + 0xf3,0x1f,0xda,0x07,0x01,0x14, + 0x62,0xee,0x18,0x7f,0x43,0xd8, + 0x0a,0x7c,0xd9,0xb5,0xb0,0xd2, + 0x90,0xda,0x6e,0x5b,0x9a,0x87 +}; + +static unsigned char ofb_key[8]={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; +static unsigned char ofb_iv[8]={0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef}; +static unsigned char ofb_plain[24]= +{ + 0x4e,0x6f,0x77,0x20,0x69,0x73, + 0x20,0x74,0x68,0x65,0x20,0x74, + 0x69,0x6d,0x65,0x20,0x66,0x6f, + 0x72,0x20,0x61,0x6c,0x6c,0x20 +}; +static unsigned char ofb_buf1[24],ofb_buf2[24],ofb_tmp[8]; +static unsigned char ofb_cipher[24]= +{ + 0xf3,0x09,0x62,0x49,0xc7,0xf4,0x6e,0x51, + 0x35,0xf2,0x4a,0x24,0x2e,0xeb,0x3d,0x3f, + 0x3d,0x6d,0x5b,0xe3,0x25,0x5a,0xf8,0xc3 +}; + +char *malloc(size_t); +char *pt(unsigned char *p); + +int +main(void) +{ + int i,j; + des_cblock in,out,outin; + des_key_schedule ks; + unsigned char cbc_in[40],cbc_out[40]; + u_int32_t cs; + unsigned char qret[4][4]; + u_int32_t lqret[4]; + char *str; + + printf("Doing ecb\n"); + for (i=0; i>4)&0xf]; + ret[i*2+1]=f[p[i]&0xf]; + } + ret[16]='\0'; + return(ret); +} + diff --git a/lib/des/doIP b/lib/des/doIP new file mode 100755 index 000000000..18cf23130 --- /dev/null +++ b/lib/des/doIP @@ -0,0 +1,46 @@ +#!/usr/local/bin/perl + +@l=( + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31 + ); +@r=( + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63 + ); + +require 'shifts.pl'; + +sub PERM_OP + { + local(*a,*b,*t,$n,$m)=@_; + + @z=&shift(*a,-$n); + @z=&xor(*b,*z); + @z=&and(*z,$m); + @b=&xor(*b,*z); + @z=&shift(*z,$n); + @a=&xor(*a,*z); + } + + +@L=@l; +@R=@r; +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); +&PERM_OP(*L,*R,*T,16,0x0000ffff); +&PERM_OP(*R,*L,*T,2,0x33333333); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); +&PERM_OP(*R,*L,*T,1,0x55555555); + &printit(@L); + &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); +&PERM_OP(*R,*L,*T,2,0x33333333); +&PERM_OP(*L,*R,*T,16,0x0000ffff); +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); + &printit(@L); + &printit(@R); diff --git a/lib/des/doPC1 b/lib/des/doPC1 new file mode 100755 index 000000000..096afd8c4 --- /dev/null +++ b/lib/des/doPC1 @@ -0,0 +1,110 @@ +#!/usr/local/bin/perl + +@l=( + 0, 1, 2, 3, 4, 5, 6, 7, + 8, 9,10,11,12,13,14,15, + 16,17,18,19,20,21,22,23, + 24,25,26,27,28,29,30,31 + ); +@r=( + 32,33,34,35,36,37,38,39, + 40,41,42,43,44,45,46,47, + 48,49,50,51,52,53,54,55, + 56,57,58,59,60,61,62,63 + ); + +require 'shifts.pl'; + +sub PERM_OP + { + local(*a,*b,*t,$n,$m)=@_; + + @z=&shift(*a,-$n); + @z=&xor(*b,*z); + @z=&and(*z,$m); + @b=&xor(*b,*z); + @z=&shift(*z,$n); + @a=&xor(*a,*z); + } + +sub HPERM_OP2 + { + local(*a,*t,$n,$m)=@_; + local(@x,@y,$i); + + @z=&shift(*a,16-$n); + @z=&xor(*a,*z); + @z=&and(*z,$m); + @a=&xor(*a,*z); + @z=&shift(*z,$n-16); + @a=&xor(*a,*z); + } + +sub HPERM_OP + { + local(*a,*t,$n,$m)=@_; + local(@x,@y,$i); + + for ($i=0; $i<16; $i++) + { + $x[$i]=$a[$i]; + $y[$i]=$a[16+$i]; + } + @z=&shift(*x,-$n); + @z=&xor(*y,*z); + @z=&and(*z,$m); + @y=&xor(*y,*z); + @z=&shift(*z,$n); + @x=&xor(*x,*z); + for ($i=0; $i<16; $i++) + { + $a[$i]=$x[$i]; + $a[16+$i]=$y[$i]; + } + } + +@L=@l; +@R=@r; + + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,4,0x0f0f0f0f); + print "---\n"; &printit(@R); +&HPERM_OP2(*L,*T,-2,0xcccc0000); +&HPERM_OP2(*R,*T,-2,0xcccc0000); + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); + print "---\n"; &printit(@R); +&PERM_OP(*L,*R,*T,8,0x00ff00ff); + print "---\n"; &printit(@R); +&PERM_OP(*R,*L,*T,1,0x55555555); + print "---\n"; &printit(@R); +# &printit(@L); + &printit(@R); +print <<"EOF"; +============================== +63 55 47 39 31 23 15 7 +62 54 46 38 30 22 14 6 +61 53 45 37 29 21 13 5 +60 52 44 36 -- -- -- -- + +57 49 41 33 25 17 9 1 +58 50 42 34 26 18 10 2 +59 51 43 35 27 19 11 3 +28 20 12 4 -- -- -- -- +EOF +exit(1); +@A=&and(*R,0x000000ff); +@A=&shift(*A,16); +@B=&and(*R,0x0000ff00); +@C=&and(*R,0x00ff0000); +@C=&shift(*C,-16); +@D=&and(*L,0xf0000000); +@D=&shift(*D,-4); +@A=&or(*A,*B); +@B=&or(*D,*C); +@R=&or(*A,*B); +@L=&and(*L,0x0fffffff); + + &printit(@L); + &printit(@R); + diff --git a/lib/des/doPC2 b/lib/des/doPC2 new file mode 100755 index 000000000..fa5cf74cf --- /dev/null +++ b/lib/des/doPC2 @@ -0,0 +1,94 @@ +#!/usr/local/bin/perl + +@PC2_C=(14,17,11,24, 1, 5, + 3,28,15, 6,21,10, + 23,19,12, 4,26, 8, + 16, 7,27,20,13, 2, + ); + +@PC2_D=(41,52,31,37,47,55, + 30,40,51,45,33,48, + 44,49,39,56,34,53, + 46,42,50,36,29,32, + ); + +$i=0; +foreach (@PC2_C) { + $_--; +# printf "%2d,",$_; + $C{$_}=$i; + ++$i; +# print "\n" if ((($i) % 8) == 0); + } +$i=0; +#print "\n"; +foreach (@PC2_D) { + $_-=28; + $_--; +# printf "%2d,",$_; + $D{$_}=$i; + $i++; +# print "\n" if ((($i) % 8) == 0); + } + +#print "\n"; +foreach $i (0 .. 27) + { + $_=$C{$i}; +# printf "%2d,",$_; + $i++; +# print "\n" if ((($i) % 8) == 0); + } +#print "\n"; + +#print "\n"; +foreach $i (0 .. 27) + { + $_=$D{$i}; +# printf "%2d,",$_; + $i++; +# print "\n" if ((($i) % 8) == 0); + } +#print "\n"; + +print "static ulong skb[8][64]={\n"; +&doit("C",*C, 0, 1, 2, 3, 4, 5); +&doit("C",*C, 6, 7, 9,10,11,12); +&doit("C",*C,13,14,15,16,18,19); +&doit("C",*C,20,22,23,25,26,27); + +&doit("D",*D, 0, 1, 2, 3, 4, 5); +&doit("D",*D, 7, 8,10,11,12,13); +&doit("D",*D,15,16,17,18,19,20); +&doit("D",*D,21,22,23,24,26,27); +print "};\n"; + +sub doit + { + local($l,*A,@b)=@_; + local(@out); + + printf("/* for $l bits (numbered as per FIPS 46) %d %d %d %d %d %d */\n", + $b[0]+1, $b[1]+1, $b[2]+1, $b[3]+1, $b[4]+1, $b[5]+1); + for ($i=0; $i<64; $i++) + { + $out[$i]=0; + $j=1; +#print "\n"; + for ($k=0; $k<6; $k++) + { + $l=$A{$b[$k]}; +#print"$l - "; + if ((1<<$k) & $i) + { + $ll=int($l/6)*8+($l%6); + $out[$i]|=1<<($ll); + } + } + $pp=$out[$i]; + $pp=($pp&0xff0000ff)| (($pp&0x00ff0000)>>8)| + (($pp&0x0000ff00)<<8); + printf("0x%08X,",$pp); + print "\n" if (($i+1) % 4 == 0); + } + } diff --git a/lib/des/ecb_enc.c b/lib/des/ecb_enc.c new file mode 100644 index 000000000..cd9a473dc --- /dev/null +++ b/lib/des/ecb_enc.c @@ -0,0 +1,110 @@ +/* ecb_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" +#include "spr.h" + +int des_ecb_encrypt(des_cblock (*input), des_cblock (*output), struct des_ks_struct *ks, int encrypt) +{ + register u_int32_t l0,l1; + register unsigned char *in,*out; + u_int32_t ll[2]; + + in=(unsigned char *)input; + out=(unsigned char *)output; + c2l(in,l0); + c2l(in,l1); + ll[0]=l0; + ll[1]=l1; + des_encrypt(ll,ll,ks,encrypt); + l0=ll[0]; + l1=ll[1]; + l2c(l0,out); + l2c(l1,out); + l0=l1=ll[0]=ll[1]=0; + return(0); +} + +int des_encrypt(u_int32_t *input, u_int32_t *output, struct des_ks_struct *ks, int encrypt) +{ + register u_int32_t l,r,t,u; +#ifdef ALT_ECB + register unsigned char *des_SP=(unsigned char *)des_SPtrans; +#endif +#ifdef MSDOS + union fudge { + u_int32_t l; + unsigned short s[2]; + unsigned char c[4]; + } U,T; +#endif + register int i; + register u_int32_t *s; + + l=input[0]; + r=input[1]; + + /* do IP */ + PERM_OP(r,l,t, 4,0x0f0f0f0f); + PERM_OP(l,r,t,16,0x0000ffff); + PERM_OP(r,l,t, 2,0x33333333); + PERM_OP(l,r,t, 8,0x00ff00ff); + PERM_OP(r,l,t, 1,0x55555555); + /* r and l are reversed - remember that :-) - fix + * it in the next step */ + + /* Things have been modified so that the initial rotate is + * done outside the loop. This required the + * des_SPtrans values in sp.h to be rotated 1 bit to the right. + * One perl script later and things have a 5% speed up on a sparc2. + * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> + * for pointing this out. */ + t=(r<<1)|(r>>31); + r=(l<<1)|(l>>31); + l=t; + + /* clear the top bits on machines with 8byte longs */ + l&=0xffffffff; + r&=0xffffffff; + + s=(u_int32_t *)ks; + /* I don't know if it is worth the effort of loop unrolling the + * inner loop */ + if (encrypt) + { + for (i=0; i<32; i+=4) + { + D_ENCRYPT(l,r,i+0); /* 1 */ + D_ENCRYPT(r,l,i+2); /* 2 */ + } + } + else + { + for (i=30; i>0; i-=4) + { + D_ENCRYPT(l,r,i-0); /* 16 */ + D_ENCRYPT(r,l,i-2); /* 15 */ + } + } + l=(l>>1)|(l<<31); + r=(r>>1)|(r<<31); + /* clear the top bits on machines with 8byte longs */ + l&=0xffffffff; + r&=0xffffffff; + + /* swap l and r + * we will not do the swap so just remember they are + * reversed for the rest of the subroutine + * luckily FP fixes this problem :-) */ + + PERM_OP(r,l,t, 1,0x55555555); + PERM_OP(l,r,t, 8,0x00ff00ff); + PERM_OP(r,l,t, 2,0x33333333); + PERM_OP(l,r,t,16,0x0000ffff); + PERM_OP(r,l,t, 4,0x0f0f0f0f); + + output[0]=l; + output[1]=r; + l=r=t=u=0; + return(0); +} + diff --git a/lib/des/enc_read.c b/lib/des/enc_read.c new file mode 100644 index 000000000..0e91d0ea4 --- /dev/null +++ b/lib/des/enc_read.c @@ -0,0 +1,155 @@ +/* enc_read.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ + +#include +#include +#include "des_locl.h" + +/* This has some uglies in it but it works - even over sockets. */ +extern int errno; +int des_rw_mode=DES_PCBC_MODE; + +int des_enc_read(int fd, char *buf, int len, struct des_ks_struct *sched, des_cblock (*iv)) +{ + /* data to be unencrypted */ + int net_num=0; + unsigned char net[BSIZE]; + /* extra unencrypted data + * for when a block of 100 comes in but is des_read one byte at + * a time. */ + static char unnet[BSIZE]; + static int unnet_start=0; + static int unnet_left=0; + int i; + long num=0,rnum; + unsigned char *p; + + /* left over data from last decrypt */ + if (unnet_left != 0) + { + if (unnet_left < len) + { + /* we still still need more data but will return + * with the number of bytes we have - should always + * check the return value */ + memcpy(buf,&(unnet[unnet_start]),unnet_left); + /* eay 26/08/92 I had the next 2 lines + * reversed :-( */ + i=unnet_left; + unnet_start=unnet_left=0; + } + else + { + memcpy(buf,&(unnet[unnet_start]),len); + unnet_start+=len; + unnet_left-=len; + i=len; + } + return(i); + } + + /* We need to get more data. */ + if (len > MAXWRITE) len=MAXWRITE; + + /* first - get the length */ + net_num=0; + while (net_num < HDRSIZE) + { + i=read(fd,&(net[net_num]),HDRSIZE-net_num); + if ((i == -1) && (errno == EINTR)) continue; + if (i <= 0) return(0); + net_num+=i; + } + + /* we now have at net_num bytes in net */ + p=net; + num=0; + n2l(p,num); + /* num should be rounded up to the next group of eight + * we make sure that we have read a multiple of 8 bytes from the net. + */ + if ((num > MAXWRITE) || (num < 0)) /* error */ + return(-1); + rnum=(num < 8)?8:((num+7)/8*8); + + net_num=0; + while (net_num < rnum) + { + i=read(fd,&(net[net_num]),rnum-net_num); + if ((i == -1) && (errno == EINTR)) continue; + if (i <= 0) return(0); + net_num+=i; + } + + /* Check if there will be data left over. */ + if (len < num) + { + if (des_rw_mode & DES_PCBC_MODE) + des_pcbc_encrypt((des_cblock *)net,(des_cblock *)unnet, + num,sched,iv,DES_DECRYPT); + else + des_cbc_encrypt((des_cblock *)net,(des_cblock *)unnet, + num,sched,iv,DES_DECRYPT); + memcpy(buf,unnet,len); + unnet_start=len; + unnet_left=num-len; + + /* The following line is done because we return num + * as the number of bytes read. */ + num=len; + } + else + { + /* >output is a multiple of 8 byes, if len < rnum + * >we must be careful. The user must be aware that this + * >routine will write more bytes than he asked for. + * >The length of the buffer must be correct. + * FIXED - Should be ok now 18-9-90 - eay */ + if (len < rnum) + { + char tmpbuf[BSIZE]; + + if (des_rw_mode & DES_PCBC_MODE) + des_pcbc_encrypt((des_cblock *)net, + (des_cblock *)tmpbuf, + num,sched,iv,DES_DECRYPT); + else + des_cbc_encrypt((des_cblock *)net, + (des_cblock *)tmpbuf, + num,sched,iv,DES_DECRYPT); + + /* eay 26/08/92 fix a bug that returned more + * bytes than you asked for (returned len bytes :-( */ + memcpy(buf,tmpbuf,num); + } + else if (num >= 8) + { + if (des_rw_mode & DES_PCBC_MODE) + des_pcbc_encrypt((des_cblock *)net, + (des_cblock *)buf,num,sched,iv, + DES_DECRYPT); + else + des_cbc_encrypt((des_cblock *)net, + (des_cblock *)buf,num,sched,iv, + DES_DECRYPT); + } + else + { + if (des_rw_mode & DES_PCBC_MODE) + des_pcbc_encrypt((des_cblock *)net, + (des_cblock *)buf,8,sched,iv, + DES_DECRYPT); + else + des_cbc_encrypt((des_cblock *)net, + (des_cblock *)buf,8,sched,iv, + DES_DECRYPT); +#ifdef LEFT_JUSTIFIED + memcpy(buf, buf, num); +#else + memcpy(buf, buf+(8-num), num); +#endif + } + } + return(num); +} + diff --git a/lib/des/enc_writ.c b/lib/des/enc_writ.c new file mode 100644 index 000000000..220c1b790 --- /dev/null +++ b/lib/des/enc_writ.c @@ -0,0 +1,94 @@ +/* enc_writ.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ + +#include +#include +#include "des_locl.h" + +int des_enc_write(int fd, char *buf, int len, struct des_ks_struct *sched, des_cblock (*iv)) +{ + long rnum; + int i,j,k,outnum; + char outbuf[BSIZE+HDRSIZE]; + char shortbuf[8]; + char *p; + static int start=1; + + /* If we are sending less than 8 bytes, the same char will look + * the same if we don't pad it out with random bytes */ + if (start) + { + start=0; + srand(time(NULL)); + } + + /* lets recurse if we want to send the data in small chunks */ + if (len > MAXWRITE) + { + j=0; + for (i=0; i MAXWRITE)?MAXWRITE:(len-i),sched,iv); + if (k < 0) + return(k); + else + j+=k; + } + return(j); + } + + /* write length first */ + p=outbuf; + l2n(len,p); + + /* pad short strings */ + if (len < 8) + { +#ifdef LEFT_JUSTIFIED + p=shortbuf; + memcpy(shortbuf,buf,len); + for (i=len; i<8; i++) + shortbuf[i]=rand(); + rnum=8; +#else + p=shortbuf; + for (i=0; i<8-len; i++) + shortbuf[i]=rand(); + memcpy(shortbuf + 8 - len, buf, len); + rnum=8; +#endif + } + else + { + p=buf; + rnum=((len+7)/8*8); /* round up to nearest eight */ + } + + if (des_rw_mode & DES_PCBC_MODE) + des_pcbc_encrypt((des_cblock *)p,(des_cblock *)&(outbuf[HDRSIZE]), + (long)((len<8)?8:len),sched,iv,DES_ENCRYPT); + else + des_cbc_encrypt((des_cblock *)p,(des_cblock *)&(outbuf[HDRSIZE]), + (long)((len<8)?8:len),sched,iv,DES_ENCRYPT); + + /* output */ + outnum=rnum+HDRSIZE; + + for (j=0; j + +/* Eric Young. + * This version of crypt has been developed from my MIT compatable + * DES library. + * The library is available at pub/DES at ftp.psy.uq.oz.au + * eay@psych.psy.uq.oz.au + */ + +typedef unsigned char des_cblock[8]; + +typedef struct des_ks_struct +{ + union { + des_cblock _; + /* make sure things are correct size on machines with + * 8 byte longs */ + u_int32_t pad[2]; + } ks; +#define _ ks._ +} des_key_schedule[16]; + +#define DES_KEY_SZ (sizeof(des_cblock)) +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define ITERATIONS 16 +#define HALF_ITERATIONS 8 + +#define c2l(c,l) (l =((u_int32_t)(*((c)++))) , \ + l|=((u_int32_t)(*((c)++)))<< 8, \ + l|=((u_int32_t)(*((c)++)))<<16, \ + l|=((u_int32_t)(*((c)++)))<<24) + +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24)&0xff)) + +static u_int32_t SPtrans[8][64]={ + /* nibble 0 */ + 0x00820200, 0x00020000, 0x80800000, 0x80820200, + 0x00800000, 0x80020200, 0x80020000, 0x80800000, + 0x80020200, 0x00820200, 0x00820000, 0x80000200, + 0x80800200, 0x00800000, 0x00000000, 0x80020000, + 0x00020000, 0x80000000, 0x00800200, 0x00020200, + 0x80820200, 0x00820000, 0x80000200, 0x00800200, + 0x80000000, 0x00000200, 0x00020200, 0x80820000, + 0x00000200, 0x80800200, 0x80820000, 0x00000000, + 0x00000000, 0x80820200, 0x00800200, 0x80020000, + 0x00820200, 0x00020000, 0x80000200, 0x00800200, + 0x80820000, 0x00000200, 0x00020200, 0x80800000, + 0x80020200, 0x80000000, 0x80800000, 0x00820000, + 0x80820200, 0x00020200, 0x00820000, 0x80800200, + 0x00800000, 0x80000200, 0x80020000, 0x00000000, + 0x00020000, 0x00800000, 0x80800200, 0x00820200, + 0x80000000, 0x80820000, 0x00000200, 0x80020200, + /* nibble 1 */ + 0x10042004, 0x00000000, 0x00042000, 0x10040000, + 0x10000004, 0x00002004, 0x10002000, 0x00042000, + 0x00002000, 0x10040004, 0x00000004, 0x10002000, + 0x00040004, 0x10042000, 0x10040000, 0x00000004, + 0x00040000, 0x10002004, 0x10040004, 0x00002000, + 0x00042004, 0x10000000, 0x00000000, 0x00040004, + 0x10002004, 0x00042004, 0x10042000, 0x10000004, + 0x10000000, 0x00040000, 0x00002004, 0x10042004, + 0x00040004, 0x10042000, 0x10002000, 0x00042004, + 0x10042004, 0x00040004, 0x10000004, 0x00000000, + 0x10000000, 0x00002004, 0x00040000, 0x10040004, + 0x00002000, 0x10000000, 0x00042004, 0x10002004, + 0x10042000, 0x00002000, 0x00000000, 0x10000004, + 0x00000004, 0x10042004, 0x00042000, 0x10040000, + 0x10040004, 0x00040000, 0x00002004, 0x10002000, + 0x10002004, 0x00000004, 0x10040000, 0x00042000, + /* nibble 2 */ + 0x41000000, 0x01010040, 0x00000040, 0x41000040, + 0x40010000, 0x01000000, 0x41000040, 0x00010040, + 0x01000040, 0x00010000, 0x01010000, 0x40000000, + 0x41010040, 0x40000040, 0x40000000, 0x41010000, + 0x00000000, 0x40010000, 0x01010040, 0x00000040, + 0x40000040, 0x41010040, 0x00010000, 0x41000000, + 0x41010000, 0x01000040, 0x40010040, 0x01010000, + 0x00010040, 0x00000000, 0x01000000, 0x40010040, + 0x01010040, 0x00000040, 0x40000000, 0x00010000, + 0x40000040, 0x40010000, 0x01010000, 0x41000040, + 0x00000000, 0x01010040, 0x00010040, 0x41010000, + 0x40010000, 0x01000000, 0x41010040, 0x40000000, + 0x40010040, 0x41000000, 0x01000000, 0x41010040, + 0x00010000, 0x01000040, 0x41000040, 0x00010040, + 0x01000040, 0x00000000, 0x41010000, 0x40000040, + 0x41000000, 0x40010040, 0x00000040, 0x01010000, + /* nibble 3 */ + 0x00100402, 0x04000400, 0x00000002, 0x04100402, + 0x00000000, 0x04100000, 0x04000402, 0x00100002, + 0x04100400, 0x04000002, 0x04000000, 0x00000402, + 0x04000002, 0x00100402, 0x00100000, 0x04000000, + 0x04100002, 0x00100400, 0x00000400, 0x00000002, + 0x00100400, 0x04000402, 0x04100000, 0x00000400, + 0x00000402, 0x00000000, 0x00100002, 0x04100400, + 0x04000400, 0x04100002, 0x04100402, 0x00100000, + 0x04100002, 0x00000402, 0x00100000, 0x04000002, + 0x00100400, 0x04000400, 0x00000002, 0x04100000, + 0x04000402, 0x00000000, 0x00000400, 0x00100002, + 0x00000000, 0x04100002, 0x04100400, 0x00000400, + 0x04000000, 0x04100402, 0x00100402, 0x00100000, + 0x04100402, 0x00000002, 0x04000400, 0x00100402, + 0x00100002, 0x00100400, 0x04100000, 0x04000402, + 0x00000402, 0x04000000, 0x04000002, 0x04100400, + /* nibble 4 */ + 0x02000000, 0x00004000, 0x00000100, 0x02004108, + 0x02004008, 0x02000100, 0x00004108, 0x02004000, + 0x00004000, 0x00000008, 0x02000008, 0x00004100, + 0x02000108, 0x02004008, 0x02004100, 0x00000000, + 0x00004100, 0x02000000, 0x00004008, 0x00000108, + 0x02000100, 0x00004108, 0x00000000, 0x02000008, + 0x00000008, 0x02000108, 0x02004108, 0x00004008, + 0x02004000, 0x00000100, 0x00000108, 0x02004100, + 0x02004100, 0x02000108, 0x00004008, 0x02004000, + 0x00004000, 0x00000008, 0x02000008, 0x02000100, + 0x02000000, 0x00004100, 0x02004108, 0x00000000, + 0x00004108, 0x02000000, 0x00000100, 0x00004008, + 0x02000108, 0x00000100, 0x00000000, 0x02004108, + 0x02004008, 0x02004100, 0x00000108, 0x00004000, + 0x00004100, 0x02004008, 0x02000100, 0x00000108, + 0x00000008, 0x00004108, 0x02004000, 0x02000008, + /* nibble 5 */ + 0x20000010, 0x00080010, 0x00000000, 0x20080800, + 0x00080010, 0x00000800, 0x20000810, 0x00080000, + 0x00000810, 0x20080810, 0x00080800, 0x20000000, + 0x20000800, 0x20000010, 0x20080000, 0x00080810, + 0x00080000, 0x20000810, 0x20080010, 0x00000000, + 0x00000800, 0x00000010, 0x20080800, 0x20080010, + 0x20080810, 0x20080000, 0x20000000, 0x00000810, + 0x00000010, 0x00080800, 0x00080810, 0x20000800, + 0x00000810, 0x20000000, 0x20000800, 0x00080810, + 0x20080800, 0x00080010, 0x00000000, 0x20000800, + 0x20000000, 0x00000800, 0x20080010, 0x00080000, + 0x00080010, 0x20080810, 0x00080800, 0x00000010, + 0x20080810, 0x00080800, 0x00080000, 0x20000810, + 0x20000010, 0x20080000, 0x00080810, 0x00000000, + 0x00000800, 0x20000010, 0x20000810, 0x20080800, + 0x20080000, 0x00000810, 0x00000010, 0x20080010, + /* nibble 6 */ + 0x00001000, 0x00000080, 0x00400080, 0x00400001, + 0x00401081, 0x00001001, 0x00001080, 0x00000000, + 0x00400000, 0x00400081, 0x00000081, 0x00401000, + 0x00000001, 0x00401080, 0x00401000, 0x00000081, + 0x00400081, 0x00001000, 0x00001001, 0x00401081, + 0x00000000, 0x00400080, 0x00400001, 0x00001080, + 0x00401001, 0x00001081, 0x00401080, 0x00000001, + 0x00001081, 0x00401001, 0x00000080, 0x00400000, + 0x00001081, 0x00401000, 0x00401001, 0x00000081, + 0x00001000, 0x00000080, 0x00400000, 0x00401001, + 0x00400081, 0x00001081, 0x00001080, 0x00000000, + 0x00000080, 0x00400001, 0x00000001, 0x00400080, + 0x00000000, 0x00400081, 0x00400080, 0x00001080, + 0x00000081, 0x00001000, 0x00401081, 0x00400000, + 0x00401080, 0x00000001, 0x00001001, 0x00401081, + 0x00400001, 0x00401080, 0x00401000, 0x00001001, + /* nibble 7 */ + 0x08200020, 0x08208000, 0x00008020, 0x00000000, + 0x08008000, 0x00200020, 0x08200000, 0x08208020, + 0x00000020, 0x08000000, 0x00208000, 0x00008020, + 0x00208020, 0x08008020, 0x08000020, 0x08200000, + 0x00008000, 0x00208020, 0x00200020, 0x08008000, + 0x08208020, 0x08000020, 0x00000000, 0x00208000, + 0x08000000, 0x00200000, 0x08008020, 0x08200020, + 0x00200000, 0x00008000, 0x08208000, 0x00000020, + 0x00200000, 0x00008000, 0x08000020, 0x08208020, + 0x00008020, 0x08000000, 0x00000000, 0x00208000, + 0x08200020, 0x08008020, 0x08008000, 0x00200020, + 0x08208000, 0x00000020, 0x00200020, 0x08008000, + 0x08208020, 0x00200000, 0x08200000, 0x08000020, + 0x00208000, 0x00008020, 0x08008020, 0x08200000, + 0x00000020, 0x08208000, 0x00208020, 0x00000000, + 0x08000000, 0x08200020, 0x00008000, 0x00208020}; + +static u_int32_t skb[8][64]={ + /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ + 0x00000000,0x00000010,0x20000000,0x20000010, + 0x00010000,0x00010010,0x20010000,0x20010010, + 0x00000800,0x00000810,0x20000800,0x20000810, + 0x00010800,0x00010810,0x20010800,0x20010810, + 0x00000020,0x00000030,0x20000020,0x20000030, + 0x00010020,0x00010030,0x20010020,0x20010030, + 0x00000820,0x00000830,0x20000820,0x20000830, + 0x00010820,0x00010830,0x20010820,0x20010830, + 0x00080000,0x00080010,0x20080000,0x20080010, + 0x00090000,0x00090010,0x20090000,0x20090010, + 0x00080800,0x00080810,0x20080800,0x20080810, + 0x00090800,0x00090810,0x20090800,0x20090810, + 0x00080020,0x00080030,0x20080020,0x20080030, + 0x00090020,0x00090030,0x20090020,0x20090030, + 0x00080820,0x00080830,0x20080820,0x20080830, + 0x00090820,0x00090830,0x20090820,0x20090830, + /* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ + 0x00000000,0x02000000,0x00002000,0x02002000, + 0x00200000,0x02200000,0x00202000,0x02202000, + 0x00000004,0x02000004,0x00002004,0x02002004, + 0x00200004,0x02200004,0x00202004,0x02202004, + 0x00000400,0x02000400,0x00002400,0x02002400, + 0x00200400,0x02200400,0x00202400,0x02202400, + 0x00000404,0x02000404,0x00002404,0x02002404, + 0x00200404,0x02200404,0x00202404,0x02202404, + 0x10000000,0x12000000,0x10002000,0x12002000, + 0x10200000,0x12200000,0x10202000,0x12202000, + 0x10000004,0x12000004,0x10002004,0x12002004, + 0x10200004,0x12200004,0x10202004,0x12202004, + 0x10000400,0x12000400,0x10002400,0x12002400, + 0x10200400,0x12200400,0x10202400,0x12202400, + 0x10000404,0x12000404,0x10002404,0x12002404, + 0x10200404,0x12200404,0x10202404,0x12202404, + /* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ + 0x00000000,0x00000001,0x00040000,0x00040001, + 0x01000000,0x01000001,0x01040000,0x01040001, + 0x00000002,0x00000003,0x00040002,0x00040003, + 0x01000002,0x01000003,0x01040002,0x01040003, + 0x00000200,0x00000201,0x00040200,0x00040201, + 0x01000200,0x01000201,0x01040200,0x01040201, + 0x00000202,0x00000203,0x00040202,0x00040203, + 0x01000202,0x01000203,0x01040202,0x01040203, + 0x08000000,0x08000001,0x08040000,0x08040001, + 0x09000000,0x09000001,0x09040000,0x09040001, + 0x08000002,0x08000003,0x08040002,0x08040003, + 0x09000002,0x09000003,0x09040002,0x09040003, + 0x08000200,0x08000201,0x08040200,0x08040201, + 0x09000200,0x09000201,0x09040200,0x09040201, + 0x08000202,0x08000203,0x08040202,0x08040203, + 0x09000202,0x09000203,0x09040202,0x09040203, + /* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ + 0x00000000,0x00100000,0x00000100,0x00100100, + 0x00000008,0x00100008,0x00000108,0x00100108, + 0x00001000,0x00101000,0x00001100,0x00101100, + 0x00001008,0x00101008,0x00001108,0x00101108, + 0x04000000,0x04100000,0x04000100,0x04100100, + 0x04000008,0x04100008,0x04000108,0x04100108, + 0x04001000,0x04101000,0x04001100,0x04101100, + 0x04001008,0x04101008,0x04001108,0x04101108, + 0x00020000,0x00120000,0x00020100,0x00120100, + 0x00020008,0x00120008,0x00020108,0x00120108, + 0x00021000,0x00121000,0x00021100,0x00121100, + 0x00021008,0x00121008,0x00021108,0x00121108, + 0x04020000,0x04120000,0x04020100,0x04120100, + 0x04020008,0x04120008,0x04020108,0x04120108, + 0x04021000,0x04121000,0x04021100,0x04121100, + 0x04021008,0x04121008,0x04021108,0x04121108, + /* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ + 0x00000000,0x10000000,0x00010000,0x10010000, + 0x00000004,0x10000004,0x00010004,0x10010004, + 0x20000000,0x30000000,0x20010000,0x30010000, + 0x20000004,0x30000004,0x20010004,0x30010004, + 0x00100000,0x10100000,0x00110000,0x10110000, + 0x00100004,0x10100004,0x00110004,0x10110004, + 0x20100000,0x30100000,0x20110000,0x30110000, + 0x20100004,0x30100004,0x20110004,0x30110004, + 0x00001000,0x10001000,0x00011000,0x10011000, + 0x00001004,0x10001004,0x00011004,0x10011004, + 0x20001000,0x30001000,0x20011000,0x30011000, + 0x20001004,0x30001004,0x20011004,0x30011004, + 0x00101000,0x10101000,0x00111000,0x10111000, + 0x00101004,0x10101004,0x00111004,0x10111004, + 0x20101000,0x30101000,0x20111000,0x30111000, + 0x20101004,0x30101004,0x20111004,0x30111004, + /* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ + 0x00000000,0x08000000,0x00000008,0x08000008, + 0x00000400,0x08000400,0x00000408,0x08000408, + 0x00020000,0x08020000,0x00020008,0x08020008, + 0x00020400,0x08020400,0x00020408,0x08020408, + 0x00000001,0x08000001,0x00000009,0x08000009, + 0x00000401,0x08000401,0x00000409,0x08000409, + 0x00020001,0x08020001,0x00020009,0x08020009, + 0x00020401,0x08020401,0x00020409,0x08020409, + 0x02000000,0x0A000000,0x02000008,0x0A000008, + 0x02000400,0x0A000400,0x02000408,0x0A000408, + 0x02020000,0x0A020000,0x02020008,0x0A020008, + 0x02020400,0x0A020400,0x02020408,0x0A020408, + 0x02000001,0x0A000001,0x02000009,0x0A000009, + 0x02000401,0x0A000401,0x02000409,0x0A000409, + 0x02020001,0x0A020001,0x02020009,0x0A020009, + 0x02020401,0x0A020401,0x02020409,0x0A020409, + /* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ + 0x00000000,0x00000100,0x00080000,0x00080100, + 0x01000000,0x01000100,0x01080000,0x01080100, + 0x00000010,0x00000110,0x00080010,0x00080110, + 0x01000010,0x01000110,0x01080010,0x01080110, + 0x00200000,0x00200100,0x00280000,0x00280100, + 0x01200000,0x01200100,0x01280000,0x01280100, + 0x00200010,0x00200110,0x00280010,0x00280110, + 0x01200010,0x01200110,0x01280010,0x01280110, + 0x00000200,0x00000300,0x00080200,0x00080300, + 0x01000200,0x01000300,0x01080200,0x01080300, + 0x00000210,0x00000310,0x00080210,0x00080310, + 0x01000210,0x01000310,0x01080210,0x01080310, + 0x00200200,0x00200300,0x00280200,0x00280300, + 0x01200200,0x01200300,0x01280200,0x01280300, + 0x00200210,0x00200310,0x00280210,0x00280310, + 0x01200210,0x01200310,0x01280210,0x01280310, + /* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ + 0x00000000,0x04000000,0x00040000,0x04040000, + 0x00000002,0x04000002,0x00040002,0x04040002, + 0x00002000,0x04002000,0x00042000,0x04042000, + 0x00002002,0x04002002,0x00042002,0x04042002, + 0x00000020,0x04000020,0x00040020,0x04040020, + 0x00000022,0x04000022,0x00040022,0x04040022, + 0x00002020,0x04002020,0x00042020,0x04042020, + 0x00002022,0x04002022,0x00042022,0x04042022, + 0x00000800,0x04000800,0x00040800,0x04040800, + 0x00000802,0x04000802,0x00040802,0x04040802, + 0x00002800,0x04002800,0x00042800,0x04042800, + 0x00002802,0x04002802,0x00042802,0x04042802, + 0x00000820,0x04000820,0x00040820,0x04040820, + 0x00000822,0x04000822,0x00040822,0x04040822, + 0x00002820,0x04002820,0x00042820,0x04042820, + 0x00002822,0x04002822,0x00042822,0x04042822, +}; + +/* See ecb_encrypt.c for a pseudo description of these macros. */ +#define PERM_OP(a,b,t,n,m) ((t)=((((a)>>(n))^(b))&(m)),\ + (b)^=(t),\ + (a)^=((t)<<(n))) + +#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ + (a)=(a)^(t)^(t>>(16-(n))))\ + +static char shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; + +static int body(u_int32_t *out0, u_int32_t *out1, des_key_schedule (*ks), u_int32_t Eswap0, u_int_32t Eswap1); +static int des_set_key(des_cblock (*key), struct des_ks_struct *schedule); + +static int des_set_key(des_cblock (*key), struct des_ks_struct *schedule) +{ + register u_int32_t c,d,t,s; + register unsigned char *in; + register u_int32_t *k; + register int i; + + k=(u_int32_t *)schedule; + in=(unsigned char *)key; + + c2l(in,c); + c2l(in,d); + + /* I now do it in 47 simple operations :-) + * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) + * for the inspiration. :-) */ + PERM_OP (d,c,t,4,0x0f0f0f0f); + HPERM_OP(c,t,-2,0xcccc0000); + HPERM_OP(d,t,-2,0xcccc0000); + PERM_OP (d,c,t,1,0x55555555); + PERM_OP (c,d,t,8,0x00ff00ff); + PERM_OP (d,c,t,1,0x55555555); + d= (((d&0x000000ff)<<16)| (d&0x0000ff00) | + ((d&0x00ff0000)>>16)|((c&0xf0000000)>>4)); + c&=0x0fffffff; + + for (i=0; i>2)|(c<<26)); d=((d>>2)|(d<<26)); } + else + { c=((c>>1)|(c<<27)); d=((d>>1)|(d<<27)); } + c&=0x0fffffff; + d&=0x0fffffff; + /* could be a few less shifts but I am to lazy at this + * point in time to investigate */ + s= skb[0][ (c )&0x3f ]| + skb[1][((c>> 6)&0x03)|((c>> 7)&0x3c)]| + skb[2][((c>>13)&0x0f)|((c>>14)&0x30)]| + skb[3][((c>>20)&0x01)|((c>>21)&0x06) | + ((c>>22)&0x38)]; + t= skb[4][ (d )&0x3f ]| + skb[5][((d>> 7)&0x03)|((d>> 8)&0x3c)]| + skb[6][ (d>>15)&0x3f ]| + skb[7][((d>>21)&0x0f)|((d>>22)&0x30)]; + + /* table contained 0213 4657 */ + *(k++)=((t<<16)|(s&0x0000ffff))&0xffffffff; + s= ((s>>16)|(t&0xffff0000)); + + s=(s<<4)|(s>>28); + *(k++)=s&0xffffffff; + } + return(0); +} + +/****************************************************************** + * modified stuff for crypt. + ******************************************************************/ + +/* The changes to this macro may help or hinder, depending on the + * compiler and the achitecture. gcc2 always seems to do well :-). + * Inspired by Dana How + * DO NOT use the alternative version on machines with 8 byte longs. + */ +#ifdef ALT_ECB +#define D_ENCRYPT(L,R,S) \ +v=(R^(R>>16)); \ +u=(v&E0); \ +v=(v&E1); \ +u=((u^(u<<16))^R^s[S ])<<2; \ +t=(v^(v<<16))^R^s[S+1]; \ +t=(t>>2)|(t<<30); \ +L^= \ +*(u_int32_t *)(des_SP+0x0100+((t )&0xfc))+ \ +*(u_int32_t *)(des_SP+0x0300+((t>> 8)&0xfc))+ \ +*(u_int32_t *)(des_SP+0x0500+((t>>16)&0xfc))+ \ +*(u_int32_t *)(des_SP+0x0700+((t>>24)&0xfc))+ \ +*(u_int32_t *)(des_SP+ ((u )&0xfc))+ \ +*(u_int32_t *)(des_SP+0x0200+((u>> 8)&0xfc))+ \ +*(u_int32_t *)(des_SP+0x0400+((u>>16)&0xfc))+ \ +*(u_int32_t *)(des_SP+0x0600+((u>>24)&0xfc)); +#else /* original version */ +#define D_ENCRYPT(L,R,S) \ +v=(R^(R>>16)); \ +u=(v&E0); \ +v=(v&E1); \ +u=(u^(u<<16))^R^s[S ]; \ +t=(v^(v<<16))^R^s[S+1]; \ +t=(t>>4)|(t<<28); \ +L^= SPtrans[1][(t )&0x3f]| \ +SPtrans[3][(t>> 8)&0x3f]| \ + SPtrans[5][(t>>16)&0x3f]| \ + SPtrans[7][(t>>24)&0x3f]| \ + SPtrans[0][(u )&0x3f]| \ + SPtrans[2][(u>> 8)&0x3f]| \ + SPtrans[4][(u>>16)&0x3f]| \ + SPtrans[6][(u>>24)&0x3f]; +#endif + +unsigned char con_salt[128]={ + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09, + 0x0A,0x0B,0x05,0x06,0x07,0x08,0x09,0x0A, + 0x0B,0x0C,0x0D,0x0E,0x0F,0x10,0x11,0x12, + 0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A, + 0x1B,0x1C,0x1D,0x1E,0x1F,0x20,0x21,0x22, + 0x23,0x24,0x25,0x20,0x21,0x22,0x23,0x24, + 0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C, + 0x2D,0x2E,0x2F,0x30,0x31,0x32,0x33,0x34, + 0x35,0x36,0x37,0x38,0x39,0x3A,0x3B,0x3C, + 0x3D,0x3E,0x3F,0x00,0x00,0x00,0x00,0x00, +}; + +unsigned char cov_2char[64]={ + 0x2E,0x2F,0x30,0x31,0x32,0x33,0x34,0x35, + 0x36,0x37,0x38,0x39,0x41,0x42,0x43,0x44, + 0x45,0x46,0x47,0x48,0x49,0x4A,0x4B,0x4C, + 0x4D,0x4E,0x4F,0x50,0x51,0x52,0x53,0x54, + 0x55,0x56,0x57,0x58,0x59,0x5A,0x61,0x62, + 0x63,0x64,0x65,0x66,0x67,0x68,0x69,0x6A, + 0x6B,0x6C,0x6D,0x6E,0x6F,0x70,0x71,0x72, + 0x73,0x74,0x75,0x76,0x77,0x78,0x79,0x7A +}; + +char * +crypt(char *buf, char *salt); + +char * +crypt(char *buf, char *salt) +{ + unsigned int i,j,x,y; + u_int32_t Eswap0=0,Eswap1=0; + u_int32_t out[2],ll; + des_cblock key; + des_key_schedule ks; + static unsigned char buff[20]; + unsigned char bb[9]; + unsigned char *b=bb; + unsigned char c,u; + + /* eay 25/08/92 + * If you call crypt("pwd","*") as often happens when you + * have * as the pwd field in /etc/passwd, the function + * returns *\0XXXXXXXXX + * The \0 makes the string look like * so the pwd "*" would + * crypt to "*". This was found when replacing the crypt in + * our shared libraries. People found that the disbled + * accounts effectivly had no passwd :-(. */ + if (salt[0] == '\0') salt[0]='A'; + if (salt[1] == '\0') salt[1]='A'; + x=buff[0]=salt[0]; + Eswap0=con_salt[x]; + x=buff[1]=salt[1]; + Eswap1=con_salt[x]<<4; + + for (i=0; i<8; i++) + { + c= *(buf++); + if (!c) break; + key[i]=(c<<1); + } + for (; i<8; i++) + key[i]=0; + + des_set_key((des_cblock *)(key),ks); + body(&out[0],&out[1],&ks,Eswap0,Eswap1); + + ll=out[0]; l2c(ll,b); + ll=out[1]; l2c(ll,b); + y=0; + u=0x80; + bb[8]=0; + for (i=2; i<13; i++) + { + c=0; + for (j=0; j<6; j++) + { + c<<=1; + if (bb[y] & u) c|=1; + u>>=1; + if (!u) + { + y++; + u=0x80; + } + } + buff[i]=cov_2char[c]; + } + return((char *)buff); +} + +static int body(u_int32_t *out0, u_int32_t *out1, des_key_schedule (*ks), u_int32_t Eswap0, u_int32_t Eswap1) +{ + register u_int32_t l,r,t,u,v; +#ifdef ALT_ECB + register unsigned char *des_SP=(unsigned char *)SPtrans; +#endif + register u_int32_t *s; + register int i,j; + register u_int32_t E0,E1; + + l=0; + r=0; + + s=(u_int32_t *)ks; + E0=Eswap0; + E1=Eswap1; + + for (j=0; j<25; j++) + { + for (i=0; i<(ITERATIONS*2); i+=4) + { + D_ENCRYPT(l,r, i); /* 1 */ + D_ENCRYPT(r,l, i+2); /* 2 */ + } + t=l; + l=r; + r=t; + } + t=r; + r=(l>>1)|(l<<31); + l=(t>>1)|(t<<31); + /* clear the top bits on machines with 8byte longs */ + l&=0xffffffff; + r&=0xffffffff; + + PERM_OP(r,l,t, 1,0x55555555); + PERM_OP(l,r,t, 8,0x00ff00ff); + PERM_OP(r,l,t, 2,0x33333333); + PERM_OP(l,r,t,16,0x0000ffff); + PERM_OP(r,l,t, 4,0x0f0f0f0f); + + *out0=l; + *out1=r; + return(0); +} diff --git a/lib/des/ofb_enc.c b/lib/des/ofb_enc.c new file mode 100644 index 000000000..d62663ddb --- /dev/null +++ b/lib/des/ofb_enc.c @@ -0,0 +1,62 @@ +/* ofb_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +/* The input and output are loaded in multiples of 8 bits. + * What this means is that if you hame numbits=12 and length=2 + * the first 12 bits will be retrieved from the first byte and half + * the second. The second 12 bits will come from the 3rd and half the 4th + * byte. + */ +int des_ofb_encrypt(unsigned char *in, unsigned char *out, int numbits, long int length, struct des_ks_struct *schedule, des_cblock (*ivec)) +{ + register u_int32_t d0,d1,v0,v1,n=(numbits+7)/8; + register u_int32_t mask0,mask1; + register long l=length; + register int num=numbits; + u_int32_t ti[2]; + unsigned char *iv; + + if (num > 64) return(0); + if (num > 32) + { + mask0=0xffffffff; + if (num >= 64) + mask1=mask0; + else + mask1=(1L<<(num-32))-1; + } + else + { + if (num == 32) + mask0=0xffffffff; + else + mask0=(1L< 0) + { + des_encrypt(ti,ti, + schedule,DES_ENCRYPT); + c2ln(in,d0,d1,n); + in+=n; + d0=(d0^ti[0])&mask0; + d1=(d1^ti[1])&mask1; + l2cn(d0,d1,out,n); + out+=n; + } + v0=ti[0]; + v1=ti[1]; + iv=(unsigned char *)ivec; + l2c(v0,iv); + l2c(v1,iv); + v0=v1=d0=d1=ti[0]=ti[1]=0; + return(0); +} + diff --git a/lib/des/pcbc_enc.c b/lib/des/pcbc_enc.c new file mode 100644 index 000000000..aa25c86fc --- /dev/null +++ b/lib/des/pcbc_enc.c @@ -0,0 +1,67 @@ +/* pcbc_enc.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +int des_pcbc_encrypt(des_cblock (*input), des_cblock (*output), long int length, struct des_ks_struct *schedule, des_cblock (*ivec), int encrypt) +{ + register u_int32_t sin0,sin1,xor0,xor1,tout0,tout1; + u_int32_t tin[2],tout[2]; + unsigned char *in,*out,*iv; + + in=(unsigned char *)input; + out=(unsigned char *)output; + iv=(unsigned char *)ivec; + + if (encrypt) + { + c2l(iv,xor0); + c2l(iv,xor1); + for (; length>0; length-=8) + { + if (length >= 8) + { + c2l(in,sin0); + c2l(in,sin1); + } + else + c2ln(in,sin0,sin1,length); + tin[0]=sin0^xor0; + tin[1]=sin1^xor1; + des_encrypt(tin,tout, + schedule,encrypt); + tout0=tout[0]; + tout1=tout[1]; + xor0=sin0^tout[0]; + xor1=sin1^tout[1]; + l2c(tout0,out); + l2c(tout1,out); + } + } + else + { + c2l(iv,xor0); c2l(iv,xor1); + for (; length>0; length-=8) + { + c2l(in,sin0); + c2l(in,sin1); + tin[0]=sin0; + tin[1]=sin1; + des_encrypt(tin,tout, + schedule,encrypt); + tout0=tout[0]^xor0; + tout1=tout[1]^xor1; + if (length >= 8) + { + l2c(tout0,out); + l2c(tout1,out); + } + else + l2cn(tout0,tout1,out,length); + xor0=tout0^sin0; + xor1=tout1^sin1; + } + } + tin[0]=tin[1]=tout[0]=tout[1]=0; + sin0=sin1=xor0=xor1=tout0=tout1=0; + return(0); +} diff --git a/lib/des/podd.h b/lib/des/podd.h new file mode 100644 index 000000000..1b51aaae1 --- /dev/null +++ b/lib/des/podd.h @@ -0,0 +1,19 @@ +/* podd.h */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +static unsigned char odd_parity[256]={ + 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, + 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, + 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, + 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, + 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, + 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, + 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, +112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, +128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, +145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, +161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, +176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, +193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, +208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, +224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, +241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; diff --git a/lib/des/qud_cksm.c b/lib/des/qud_cksm.c new file mode 100644 index 000000000..3ea470345 --- /dev/null +++ b/lib/des/qud_cksm.c @@ -0,0 +1,83 @@ +/* qud_cksm.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +/* From "Message Authentication" R.R. Jueneman, S.M. Matyas, C.H. Meyer + * IEEE Communications Magazine Sept 1985 Vol. 23 No. 9 p 29-40 + * This module in only based on the code in this paper and is + * almost definitely not the same as the MIT implementation. + */ +#include "des_locl.h" + +/* bug fix for dos - 7/6/91 - Larry hughes@logos.ucs.indiana.edu */ +#define B0(a) (((u_int32_t)(a))) +#define B1(a) (((u_int32_t)(a))<<8) +#define B2(a) (((u_int32_t)(a))<<16) +#define B3(a) (((u_int32_t)(a))<<24) + +/* used to scramble things a bit */ +/* Got the value MIT uses via brute force :-) 2/10/90 eay */ +#define NOISE ((u_int32_t)83653421) + +u_int32_t des_quad_cksum(des_cblock (*input), des_cblock (*output), long int length, int out_count, des_cblock (*seed)) +{ + u_int32_t z0,z1,t0,t1; + int i; + long l=0; + unsigned char *cp; + unsigned char *lp; + + if (out_count < 1) out_count=1; + lp=(unsigned char *)output; + + z0=B0((*seed)[0])|B1((*seed)[1])|B2((*seed)[2])|B3((*seed)[3]); + z1=B0((*seed)[4])|B1((*seed)[5])|B2((*seed)[6])|B3((*seed)[7]); + + for (i=0; ((i<4)&&(i 0) + { + if (l > 1) + { + t0= (u_int32_t)(*(cp++)); + t0|=(u_int32_t)B1(*(cp++)); + l--; + } + else + t0= (u_int32_t)(*(cp++)); + l--; + /* add */ + t0+=z0; + t0&=0xffffffff; + t1=z1; + /* square, well sort of square */ + z0=((((t0*t0)&0xffffffff)+((t1*t1)&0xffffffff)) + &0xffffffff)%0x7fffffff; + z1=((t0*((t1+NOISE)&0xffffffff))&0xffffffff)%0x7fffffff; + } + if (lp != NULL) + { + /* I believe I finally have things worked out. + * The MIT library assumes that the checksum + * is one huge number and it is returned in a + * host dependant byte order. + */ + static u_int32_t l=1; + static unsigned char *c=(unsigned char *)&l; + + if (c[0]) + { + l2c(z0,lp); + l2c(z1,lp); + } + else + { + lp=output[out_count-i-1]; + l2n(z1,lp); + l2n(z0,lp); + } + } + } + return(z0); +} + diff --git a/lib/des/rand_key.c b/lib/des/rand_key.c new file mode 100644 index 000000000..acf39704a --- /dev/null +++ b/lib/des/rand_key.c @@ -0,0 +1,44 @@ +/* rand_key.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +int des_random_key(unsigned char *ret) +{ + des_key_schedule ks; + static u_int32_t c=0; + static unsigned short pid=0; + static des_cblock data={0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef}; + des_cblock key; + unsigned char *p; + u_int32_t t, now; + + now=(unsigned long)time(NULL); +#ifdef MSDOS + pid=1; +#else + if (!pid) pid=getpid(); +#endif + try_again: + p=key; + t=now; + l2c(t,p); + t=(u_int32_t)((pid)|((c++)<<16)); + l2c(t,p); + + des_set_odd_parity((des_cblock *)data); + des_set_key((des_cblock *)data,ks); + des_cbc_cksum((des_cblock *)key,(des_cblock *)key, + (long)sizeof(key),ks,(des_cblock *)data); + des_set_odd_parity((des_cblock *)key); + des_cbc_cksum((des_cblock *)key,(des_cblock *)key, + (long)sizeof(key),ks,(des_cblock *)data); + + memcpy(ret,key,sizeof(key)); + memset(key,0,sizeof(key)); + memset(ks,0,sizeof(ks)); + t=0; + /* random key must have odd parity and not be weak */ + des_set_odd_parity((des_cblock *)ret); + if (des_is_weak_key((des_cblock *)ret)) goto try_again; + return(0); +} diff --git a/lib/des/rpw.c b/lib/des/rpw.c new file mode 100644 index 000000000..2b3872276 --- /dev/null +++ b/lib/des/rpw.c @@ -0,0 +1,37 @@ +/* rpw.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include +#include "des.h" + +void +main(void) +{ + des_cblock k,k1; + int i; + + printf("read passwd\n"); + if ((i=des_read_password((des_cblock *)k,"Enter password:",0)) == 0) + { + printf("password = "); + for (i=0; i<8; i++) + printf("%02x ",k[i]); + } + else + printf("error %d\n",i); + printf("\n"); + printf("read 2passwds and verify\n"); + if ((i=des_read_2passwords((des_cblock *)k,(des_cblock *)k1, + "Enter verified password:",1)) == 0) + { + printf("password1 = "); + for (i=0; i<8; i++) + printf("%02x ",k[i]); + printf("\n"); + printf("password2 = "); + for (i=0; i<8; i++) + printf("%02x ",k1[i]); + printf("\n"); + } + else + printf("error %d\n",i); +} diff --git a/lib/des/shifts.pl b/lib/des/shifts.pl new file mode 100644 index 000000000..3c4039eb9 --- /dev/null +++ b/lib/des/shifts.pl @@ -0,0 +1,160 @@ +sub lab_shift + { + local(*a,$n)=@_; + local(@r,$i,$j,$k,$d,@z); + + @r=&shift(*a,$n); + foreach $i (0 .. 31) + { + @z=split(/\^/,$r[$i]); + for ($j=0; $j <= $#z; $j++) + { + ($d)=($z[$j] =~ /^(..)/); + ($k)=($z[$j] =~ /\[(.*)\]$/); + $k.=",$n" if ($k ne ""); + $k="$n" if ($k eq ""); + $d="$d[$k]"; + $z[$j]=$d; + } + $r[$i]=join('^',@z); + } + return(@r); + } + +sub shift + { + local(*a,$n)=@_; + local(@f); + + if ($n > 0) + { + @f=&shiftl(*a,$n); + } + else + { + @f=&shiftr(*a,-$n); + } + return(@f); + } + +sub shiftr + { + local(*a,$n)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + if (($i+$n) > 31) + { + $r[$i]="--"; + } + else + { + $r[$i]=$a[$i+$n]; + } + } + return(@r); + } + +sub shiftl + { + local(*a,$n)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + if ($i < $n) + { + $r[$i]="--"; + } + else + { + $r[$i]=$a[$i-$n]; + } + } + return(@r); + } + +sub printit + { + local(@a)=@_; + local($i); + + foreach $i (0 .. 31) + { + printf "%2s ",$a[$i]; + print "\n" if (($i%8) == 7); + } + print "\n"; + } + +sub xor + { + local(*a,*b)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]=&compress($a[$i].'^'.$b[$i]); +# $r[$i]=$a[$i]."^".$b[$i]; + } + return(@r); + } + +sub and + { + local(*a,$m)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]=(($m & (1<<$i))?($a[$i]):('--')); + } + return(@r); + } + +sub or + { + local(*a,*b)=@_; + local(@r,$i); + + $#r=31; + foreach $i (0 .. 31) + { + $r[$i]='--' if (($a[$i] eq '--') && ($b[$i] eq '--')); + $r[$i]=$a[$i] if (($a[$i] ne '--') && ($b[$i] eq '--')); + $r[$i]=$b[$i] if (($a[$i] eq '--') && ($b[$i] ne '--')); + $r[$i]='++' if (($a[$i] ne '--') && ($b[$i] ne '--')); + } + return(@r); + } + +sub compress + { + local($s)=@_; + local($_,$i,@a,%a,$r); + + $s =~ s/\^\^/\^/g; + $s =~ s/^\^//; + $s =~ s/\^$//; + @a=split(/\^/,$s); + + while ($#a >= 0) + { + $_=shift(@a); + next unless /\d/; + $a{$_}++; + } + foreach $i (sort keys %a) + { + next if ($a{$i}%2 == 0); + $r.="$i^"; + } + chop($r); + return($r); + } +1; diff --git a/lib/des/sk.h b/lib/des/sk.h new file mode 100644 index 000000000..1b9a103b4 --- /dev/null +++ b/lib/des/sk.h @@ -0,0 +1,140 @@ +/* sk.h */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +static u_int32_t des_skb[8][64]={ +/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000,0x00000010,0x20000000,0x20000010, +0x00010000,0x00010010,0x20010000,0x20010010, +0x00000800,0x00000810,0x20000800,0x20000810, +0x00010800,0x00010810,0x20010800,0x20010810, +0x00000020,0x00000030,0x20000020,0x20000030, +0x00010020,0x00010030,0x20010020,0x20010030, +0x00000820,0x00000830,0x20000820,0x20000830, +0x00010820,0x00010830,0x20010820,0x20010830, +0x00080000,0x00080010,0x20080000,0x20080010, +0x00090000,0x00090010,0x20090000,0x20090010, +0x00080800,0x00080810,0x20080800,0x20080810, +0x00090800,0x00090810,0x20090800,0x20090810, +0x00080020,0x00080030,0x20080020,0x20080030, +0x00090020,0x00090030,0x20090020,0x20090030, +0x00080820,0x00080830,0x20080820,0x20080830, +0x00090820,0x00090830,0x20090820,0x20090830, +/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ +0x00000000,0x02000000,0x00002000,0x02002000, +0x00200000,0x02200000,0x00202000,0x02202000, +0x00000004,0x02000004,0x00002004,0x02002004, +0x00200004,0x02200004,0x00202004,0x02202004, +0x00000400,0x02000400,0x00002400,0x02002400, +0x00200400,0x02200400,0x00202400,0x02202400, +0x00000404,0x02000404,0x00002404,0x02002404, +0x00200404,0x02200404,0x00202404,0x02202404, +0x10000000,0x12000000,0x10002000,0x12002000, +0x10200000,0x12200000,0x10202000,0x12202000, +0x10000004,0x12000004,0x10002004,0x12002004, +0x10200004,0x12200004,0x10202004,0x12202004, +0x10000400,0x12000400,0x10002400,0x12002400, +0x10200400,0x12200400,0x10202400,0x12202400, +0x10000404,0x12000404,0x10002404,0x12002404, +0x10200404,0x12200404,0x10202404,0x12202404, +/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ +0x00000000,0x00000001,0x00040000,0x00040001, +0x01000000,0x01000001,0x01040000,0x01040001, +0x00000002,0x00000003,0x00040002,0x00040003, +0x01000002,0x01000003,0x01040002,0x01040003, +0x00000200,0x00000201,0x00040200,0x00040201, +0x01000200,0x01000201,0x01040200,0x01040201, +0x00000202,0x00000203,0x00040202,0x00040203, +0x01000202,0x01000203,0x01040202,0x01040203, +0x08000000,0x08000001,0x08040000,0x08040001, +0x09000000,0x09000001,0x09040000,0x09040001, +0x08000002,0x08000003,0x08040002,0x08040003, +0x09000002,0x09000003,0x09040002,0x09040003, +0x08000200,0x08000201,0x08040200,0x08040201, +0x09000200,0x09000201,0x09040200,0x09040201, +0x08000202,0x08000203,0x08040202,0x08040203, +0x09000202,0x09000203,0x09040202,0x09040203, +/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ +0x00000000,0x00100000,0x00000100,0x00100100, +0x00000008,0x00100008,0x00000108,0x00100108, +0x00001000,0x00101000,0x00001100,0x00101100, +0x00001008,0x00101008,0x00001108,0x00101108, +0x04000000,0x04100000,0x04000100,0x04100100, +0x04000008,0x04100008,0x04000108,0x04100108, +0x04001000,0x04101000,0x04001100,0x04101100, +0x04001008,0x04101008,0x04001108,0x04101108, +0x00020000,0x00120000,0x00020100,0x00120100, +0x00020008,0x00120008,0x00020108,0x00120108, +0x00021000,0x00121000,0x00021100,0x00121100, +0x00021008,0x00121008,0x00021108,0x00121108, +0x04020000,0x04120000,0x04020100,0x04120100, +0x04020008,0x04120008,0x04020108,0x04120108, +0x04021000,0x04121000,0x04021100,0x04121100, +0x04021008,0x04121008,0x04021108,0x04121108, +/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000,0x10000000,0x00010000,0x10010000, +0x00000004,0x10000004,0x00010004,0x10010004, +0x20000000,0x30000000,0x20010000,0x30010000, +0x20000004,0x30000004,0x20010004,0x30010004, +0x00100000,0x10100000,0x00110000,0x10110000, +0x00100004,0x10100004,0x00110004,0x10110004, +0x20100000,0x30100000,0x20110000,0x30110000, +0x20100004,0x30100004,0x20110004,0x30110004, +0x00001000,0x10001000,0x00011000,0x10011000, +0x00001004,0x10001004,0x00011004,0x10011004, +0x20001000,0x30001000,0x20011000,0x30011000, +0x20001004,0x30001004,0x20011004,0x30011004, +0x00101000,0x10101000,0x00111000,0x10111000, +0x00101004,0x10101004,0x00111004,0x10111004, +0x20101000,0x30101000,0x20111000,0x30111000, +0x20101004,0x30101004,0x20111004,0x30111004, +/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ +0x00000000,0x08000000,0x00000008,0x08000008, +0x00000400,0x08000400,0x00000408,0x08000408, +0x00020000,0x08020000,0x00020008,0x08020008, +0x00020400,0x08020400,0x00020408,0x08020408, +0x00000001,0x08000001,0x00000009,0x08000009, +0x00000401,0x08000401,0x00000409,0x08000409, +0x00020001,0x08020001,0x00020009,0x08020009, +0x00020401,0x08020401,0x00020409,0x08020409, +0x02000000,0x0A000000,0x02000008,0x0A000008, +0x02000400,0x0A000400,0x02000408,0x0A000408, +0x02020000,0x0A020000,0x02020008,0x0A020008, +0x02020400,0x0A020400,0x02020408,0x0A020408, +0x02000001,0x0A000001,0x02000009,0x0A000009, +0x02000401,0x0A000401,0x02000409,0x0A000409, +0x02020001,0x0A020001,0x02020009,0x0A020009, +0x02020401,0x0A020401,0x02020409,0x0A020409, +/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ +0x00000000,0x00000100,0x00080000,0x00080100, +0x01000000,0x01000100,0x01080000,0x01080100, +0x00000010,0x00000110,0x00080010,0x00080110, +0x01000010,0x01000110,0x01080010,0x01080110, +0x00200000,0x00200100,0x00280000,0x00280100, +0x01200000,0x01200100,0x01280000,0x01280100, +0x00200010,0x00200110,0x00280010,0x00280110, +0x01200010,0x01200110,0x01280010,0x01280110, +0x00000200,0x00000300,0x00080200,0x00080300, +0x01000200,0x01000300,0x01080200,0x01080300, +0x00000210,0x00000310,0x00080210,0x00080310, +0x01000210,0x01000310,0x01080210,0x01080310, +0x00200200,0x00200300,0x00280200,0x00280300, +0x01200200,0x01200300,0x01280200,0x01280300, +0x00200210,0x00200310,0x00280210,0x00280310, +0x01200210,0x01200310,0x01280210,0x01280310, +/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ +0x00000000,0x04000000,0x00040000,0x04040000, +0x00000002,0x04000002,0x00040002,0x04040002, +0x00002000,0x04002000,0x00042000,0x04042000, +0x00002002,0x04002002,0x00042002,0x04042002, +0x00000020,0x04000020,0x00040020,0x04040020, +0x00000022,0x04000022,0x00040022,0x04040022, +0x00002020,0x04002020,0x00042020,0x04042020, +0x00002022,0x04002022,0x00042022,0x04042022, +0x00000800,0x04000800,0x00040800,0x04040800, +0x00000802,0x04000802,0x00040802,0x04040802, +0x00002800,0x04002800,0x00042800,0x04042800, +0x00002802,0x04002802,0x00042802,0x04042802, +0x00000820,0x04000820,0x00040820,0x04040820, +0x00000822,0x04000822,0x00040822,0x04040822, +0x00002820,0x04002820,0x00042820,0x04042820, +0x00002822,0x04002822,0x00042822,0x04042822, +}; diff --git a/lib/des/speed.c b/lib/des/speed.c new file mode 100644 index 000000000..519ee8557 --- /dev/null +++ b/lib/des/speed.c @@ -0,0 +1,205 @@ +/* speed.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */ +/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */ + +#ifndef MSDOS +#define TIMES +#endif + +#include +#include +#ifndef VMS +#if !(defined(_IRIX) || defined(sgi)) +#include +#endif +#ifdef TIMES +#include +#include +#endif /* TIMES */ +#else /* VMS */ +#include +struct tms { + time_t tms_utime; + time_t tms_stime; + time_t tms_uchild; /* I dunno... */ + time_t tms_uchildsys; /* so these names are a guess :-) */ +} +#endif +#ifndef TIMES +#include +#endif +#include "des.h" + +/* The following if from times(3) man page. It may need to be changed */ +#ifndef CLK_TCK +#ifndef VMS +#define HZ 60.0 +#else /* VMS */ +#define HZ 100.0 +#endif +#else /* CLK_TCK */ +#define HZ ((double)CLK_TCK) +#endif + +#define BUFSIZE ((long)1024*8) +long run=0; + +#ifdef SIGALRM +#ifdef __STDC__ +#define SIGRETTYPE void +#else +#define SIGRETTYPE int +#endif + +static SIGRETTYPE +sig_done(int sig) +{ + signal(SIGALRM,sig_done); + run=0; +} + +unsigned int alarm(int seconds); +#endif + +#define START 0 +#define STOP 1 + +static double +Time_F(int s) +{ + double ret; +#ifdef TIMES + static struct tms tstart,tend; + + if (s == START) + { + times(&tstart); + return(0); + } + else + { + times(&tend); + ret=((double)(tend.tms_utime-tstart.tms_utime))/HZ; + return((ret == 0.0)?1e-6:ret); + } +#else /* !times() */ + static struct timeb tstart,tend; + long i; + + if (s == START) + { + ftime(&tstart); + return(0); + } + else + { + ftime(&tend); + i=(long)tend.millitm-(long)tstart.millitm; + ret=((double)(tend.time-tstart.time))+((double)i)/1000.0; + return((ret == 0.0)?1e-6:ret); + } +#endif +} + +void +main(int argc, char **argv) +{ + long count; + static unsigned char buf[BUFSIZE]; + static des_cblock key={0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0}; + des_key_schedule sch; + double d,a,b,c; +#ifndef SIGALRM + long ca,cb,cc,cd; +#endif + +#ifndef TIMES + printf("To get the most acurate results, try to run this\n"); + printf("program when this computer is idle.\n"); +#endif + +#ifndef SIGALRM + printf("First we calculate the aproximate speed ...\n"); + des_set_key((des_cblock *)key,sch); + count=10; + do { + int i; + count*=2; + Time_F(START); + for (i=count; i; i--) + des_ecb_encrypt((des_cblock *)buf,(des_cblock *)buf, + &(sch[0]),DES_ENCRYPT); + d=Time_F(STOP); + } while (d <3); + ca=count; + cb=count*10; + cc=count*10*8/BUFSIZE+1; + cd=count/20+1; + printf("Doing set_key %ld times\n",ca); +#define COND(d) (count != (d)) +#define COUNT(d) (d) +#else +#define COND(c) (run) +#define COUNT(d) (count) + signal(SIGALRM,sig_done); + printf("Doing set_key for 10 seconds\n"); + alarm(10); +#endif + + Time_F(START); + for (count=0,run=1; COND(ca); count++) + des_set_key((des_cblock *)key,sch); + d=Time_F(STOP); + printf("%ld set_key's in %.2f seconds\n",count,d); + a=((double)COUNT(ca))/d; + +#ifdef SIGALRM + printf("Doing des_ecb_encrypt's for 10 seconds\n"); + alarm(10); +#else + printf("Doing des_ecb_encrypt %ld times\n",cb); +#endif + Time_F(START); + for (count=0,run=1; COND(cb); count++) + des_ecb_encrypt((des_cblock *)buf,(des_cblock *)buf, + &(sch[0]),DES_ENCRYPT); + d=Time_F(STOP); + printf("%ld des_ecb_encrypt's in %.2f second\n",count,d); + b=((double)COUNT(cb)*8)/d; + +#ifdef SIGALRM + printf("Doing des_cbc_encrypt on %ld byte blocks for 10 seconds\n", + BUFSIZE); + alarm(10); +#else + printf("Doing des_cbc_encrypt %ld times on %ld byte blocks\n",cc, + BUFSIZE); +#endif + Time_F(START); + for (count=0,run=1; COND(cc); count++) + des_cbc_encrypt((des_cblock *)buf,(des_cblock *)buf,BUFSIZE,&(sch[0]), + (des_cblock *)&(key[0]),DES_ENCRYPT); + d=Time_F(STOP); + printf("%ld des_cbc_encrypt's of %ld byte blocks in %.2f second\n", + count,BUFSIZE,d); + c=((double)COUNT(cc)*BUFSIZE)/d; + +#ifdef SIGALRM + printf("Doing crypt for 10 seconds\n"); + alarm(10); +#else + printf("Doing crypt %ld times\n",cd); +#endif + Time_F(START); + for (count=0,run=1; COND(cd); count++) + crypt("testing1","ef"); + d=Time_F(STOP); + printf("%ld crypts in %.2f second\n",count,d); + d=((double)COUNT(cd))/d; + + printf("set_key per sec = %12.2f (%5.1fuS)\n",a,1.0e6/a); + printf("DES ecb bytes per sec = %12.2f (%5.1fuS)\n",b,8.0e6/b); + printf("DES cbc bytes per sec = %12.2f (%5.1fuS)\n",c,8.0e6/c); + printf("crypt per sec = %12.2f (%5.1fuS)\n",d,1.0e6/d); +} diff --git a/lib/des/spr.h b/lib/des/spr.h new file mode 100644 index 000000000..26b5a0d4f --- /dev/null +++ b/lib/des/spr.h @@ -0,0 +1,146 @@ +/* spr.h */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +static u_int32_t des_SPtrans[8][64]={ +/* nibble 0 */ +0x00820200, 0x00020000, 0x80800000, 0x80820200, +0x00800000, 0x80020200, 0x80020000, 0x80800000, +0x80020200, 0x00820200, 0x00820000, 0x80000200, +0x80800200, 0x00800000, 0x00000000, 0x80020000, +0x00020000, 0x80000000, 0x00800200, 0x00020200, +0x80820200, 0x00820000, 0x80000200, 0x00800200, +0x80000000, 0x00000200, 0x00020200, 0x80820000, +0x00000200, 0x80800200, 0x80820000, 0x00000000, +0x00000000, 0x80820200, 0x00800200, 0x80020000, +0x00820200, 0x00020000, 0x80000200, 0x00800200, +0x80820000, 0x00000200, 0x00020200, 0x80800000, +0x80020200, 0x80000000, 0x80800000, 0x00820000, +0x80820200, 0x00020200, 0x00820000, 0x80800200, +0x00800000, 0x80000200, 0x80020000, 0x00000000, +0x00020000, 0x00800000, 0x80800200, 0x00820200, +0x80000000, 0x80820000, 0x00000200, 0x80020200, + +/* nibble 1 */ +0x10042004, 0x00000000, 0x00042000, 0x10040000, +0x10000004, 0x00002004, 0x10002000, 0x00042000, +0x00002000, 0x10040004, 0x00000004, 0x10002000, +0x00040004, 0x10042000, 0x10040000, 0x00000004, +0x00040000, 0x10002004, 0x10040004, 0x00002000, +0x00042004, 0x10000000, 0x00000000, 0x00040004, +0x10002004, 0x00042004, 0x10042000, 0x10000004, +0x10000000, 0x00040000, 0x00002004, 0x10042004, +0x00040004, 0x10042000, 0x10002000, 0x00042004, +0x10042004, 0x00040004, 0x10000004, 0x00000000, +0x10000000, 0x00002004, 0x00040000, 0x10040004, +0x00002000, 0x10000000, 0x00042004, 0x10002004, +0x10042000, 0x00002000, 0x00000000, 0x10000004, +0x00000004, 0x10042004, 0x00042000, 0x10040000, +0x10040004, 0x00040000, 0x00002004, 0x10002000, +0x10002004, 0x00000004, 0x10040000, 0x00042000, + +/* nibble 2 */ +0x41000000, 0x01010040, 0x00000040, 0x41000040, +0x40010000, 0x01000000, 0x41000040, 0x00010040, +0x01000040, 0x00010000, 0x01010000, 0x40000000, +0x41010040, 0x40000040, 0x40000000, 0x41010000, +0x00000000, 0x40010000, 0x01010040, 0x00000040, +0x40000040, 0x41010040, 0x00010000, 0x41000000, +0x41010000, 0x01000040, 0x40010040, 0x01010000, +0x00010040, 0x00000000, 0x01000000, 0x40010040, +0x01010040, 0x00000040, 0x40000000, 0x00010000, +0x40000040, 0x40010000, 0x01010000, 0x41000040, +0x00000000, 0x01010040, 0x00010040, 0x41010000, +0x40010000, 0x01000000, 0x41010040, 0x40000000, +0x40010040, 0x41000000, 0x01000000, 0x41010040, +0x00010000, 0x01000040, 0x41000040, 0x00010040, +0x01000040, 0x00000000, 0x41010000, 0x40000040, +0x41000000, 0x40010040, 0x00000040, 0x01010000, + +/* nibble 3 */ +0x00100402, 0x04000400, 0x00000002, 0x04100402, +0x00000000, 0x04100000, 0x04000402, 0x00100002, +0x04100400, 0x04000002, 0x04000000, 0x00000402, +0x04000002, 0x00100402, 0x00100000, 0x04000000, +0x04100002, 0x00100400, 0x00000400, 0x00000002, +0x00100400, 0x04000402, 0x04100000, 0x00000400, +0x00000402, 0x00000000, 0x00100002, 0x04100400, +0x04000400, 0x04100002, 0x04100402, 0x00100000, +0x04100002, 0x00000402, 0x00100000, 0x04000002, +0x00100400, 0x04000400, 0x00000002, 0x04100000, +0x04000402, 0x00000000, 0x00000400, 0x00100002, +0x00000000, 0x04100002, 0x04100400, 0x00000400, +0x04000000, 0x04100402, 0x00100402, 0x00100000, +0x04100402, 0x00000002, 0x04000400, 0x00100402, +0x00100002, 0x00100400, 0x04100000, 0x04000402, +0x00000402, 0x04000000, 0x04000002, 0x04100400, + +/* nibble 4 */ +0x02000000, 0x00004000, 0x00000100, 0x02004108, +0x02004008, 0x02000100, 0x00004108, 0x02004000, +0x00004000, 0x00000008, 0x02000008, 0x00004100, +0x02000108, 0x02004008, 0x02004100, 0x00000000, +0x00004100, 0x02000000, 0x00004008, 0x00000108, +0x02000100, 0x00004108, 0x00000000, 0x02000008, +0x00000008, 0x02000108, 0x02004108, 0x00004008, +0x02004000, 0x00000100, 0x00000108, 0x02004100, +0x02004100, 0x02000108, 0x00004008, 0x02004000, +0x00004000, 0x00000008, 0x02000008, 0x02000100, +0x02000000, 0x00004100, 0x02004108, 0x00000000, +0x00004108, 0x02000000, 0x00000100, 0x00004008, +0x02000108, 0x00000100, 0x00000000, 0x02004108, +0x02004008, 0x02004100, 0x00000108, 0x00004000, +0x00004100, 0x02004008, 0x02000100, 0x00000108, +0x00000008, 0x00004108, 0x02004000, 0x02000008, + +/* nibble 5 */ +0x20000010, 0x00080010, 0x00000000, 0x20080800, +0x00080010, 0x00000800, 0x20000810, 0x00080000, +0x00000810, 0x20080810, 0x00080800, 0x20000000, +0x20000800, 0x20000010, 0x20080000, 0x00080810, +0x00080000, 0x20000810, 0x20080010, 0x00000000, +0x00000800, 0x00000010, 0x20080800, 0x20080010, +0x20080810, 0x20080000, 0x20000000, 0x00000810, +0x00000010, 0x00080800, 0x00080810, 0x20000800, +0x00000810, 0x20000000, 0x20000800, 0x00080810, +0x20080800, 0x00080010, 0x00000000, 0x20000800, +0x20000000, 0x00000800, 0x20080010, 0x00080000, +0x00080010, 0x20080810, 0x00080800, 0x00000010, +0x20080810, 0x00080800, 0x00080000, 0x20000810, +0x20000010, 0x20080000, 0x00080810, 0x00000000, +0x00000800, 0x20000010, 0x20000810, 0x20080800, +0x20080000, 0x00000810, 0x00000010, 0x20080010, + +/* nibble 6 */ +0x00001000, 0x00000080, 0x00400080, 0x00400001, +0x00401081, 0x00001001, 0x00001080, 0x00000000, +0x00400000, 0x00400081, 0x00000081, 0x00401000, +0x00000001, 0x00401080, 0x00401000, 0x00000081, +0x00400081, 0x00001000, 0x00001001, 0x00401081, +0x00000000, 0x00400080, 0x00400001, 0x00001080, +0x00401001, 0x00001081, 0x00401080, 0x00000001, +0x00001081, 0x00401001, 0x00000080, 0x00400000, +0x00001081, 0x00401000, 0x00401001, 0x00000081, +0x00001000, 0x00000080, 0x00400000, 0x00401001, +0x00400081, 0x00001081, 0x00001080, 0x00000000, +0x00000080, 0x00400001, 0x00000001, 0x00400080, +0x00000000, 0x00400081, 0x00400080, 0x00001080, +0x00000081, 0x00001000, 0x00401081, 0x00400000, +0x00401080, 0x00000001, 0x00001001, 0x00401081, +0x00400001, 0x00401080, 0x00401000, 0x00001001, + +/* nibble 7 */ +0x08200020, 0x08208000, 0x00008020, 0x00000000, +0x08008000, 0x00200020, 0x08200000, 0x08208020, +0x00000020, 0x08000000, 0x00208000, 0x00008020, +0x00208020, 0x08008020, 0x08000020, 0x08200000, +0x00008000, 0x00208020, 0x00200020, 0x08008000, +0x08208020, 0x08000020, 0x00000000, 0x00208000, +0x08000000, 0x00200000, 0x08008020, 0x08200020, +0x00200000, 0x00008000, 0x08208000, 0x00000020, +0x00200000, 0x00008000, 0x08000020, 0x08208020, +0x00008020, 0x08000000, 0x00000000, 0x00208000, +0x08200020, 0x08008020, 0x08008000, 0x00200020, +0x08208000, 0x00000020, 0x00200020, 0x08008000, +0x08208020, 0x00200000, 0x08200000, 0x08000020, +0x00208000, 0x00008020, 0x08008020, 0x08200000, +0x00000020, 0x08208000, 0x00208020, 0x00000000, +0x08000000, 0x08200020, 0x00008000, 0x00208020}; diff --git a/lib/des/str2key.c b/lib/des/str2key.c new file mode 100644 index 000000000..17d023b66 --- /dev/null +++ b/lib/des/str2key.c @@ -0,0 +1,112 @@ +/* str2key.c */ +/* Copyright (C) 1993 Eric Young - see README for more details */ +#include "des_locl.h" + +extern int des_check_key; + +int des_string_to_key(char *str, des_cblock (*key)) +{ + des_key_schedule ks; + int i,length; + register unsigned char j; + + memset(key,0,8); + length=strlen(str); +#ifdef OLD_STR_TO_KEY + for (i=0; i>4)&0x0f); + j=((j<<2)&0xcc)|((j>>2)&0x33); + j=((j<<1)&0xaa)|((j>>1)&0x55); + (*key)[7-(i%8)]^=j; + } + } +#endif + des_set_odd_parity((des_cblock *)key); + i=des_check_key; + des_check_key=0; + des_set_key((des_cblock *)key,ks); + des_check_key=i; + des_cbc_cksum((des_cblock *)str,(des_cblock *)key,(long)length,ks, + (des_cblock *)key); + memset(ks,0,sizeof(ks)); + des_set_odd_parity((des_cblock *)key); + return(0); +} + +int des_string_to_2keys(char *str, des_cblock (*key1), des_cblock (*key2)) +{ + des_key_schedule ks; + int i,length; + register unsigned char j; + + memset(key1,0,8); + memset(key2,0,8); + length=strlen(str); +#ifdef OLD_STR_TO_KEY + if (length <= 8) + { + for (i=0; i>4)&0x0f); + j=((j<<2)&0xcc)|((j>>2)&0x33); + j=((j<<1)&0xaa)|((j>>1)&0x55); + if ((i%16) < 8) + (*key1)[7-(i%8)]^=j; + else + (*key2)[7-(i%8)]^=j; + } + } + if (length <= 8) memcpy(key2,key1,8); +#endif + des_set_odd_parity((des_cblock *)key1); + des_set_odd_parity((des_cblock *)key2); + i=des_check_key; + des_check_key=0; + des_set_key((des_cblock *)key1,ks); + des_cbc_cksum((des_cblock *)str,(des_cblock *)key1,(long)length,ks, + (des_cblock *)key1); + des_set_key((des_cblock *)key2,ks); + des_cbc_cksum((des_cblock *)str,(des_cblock *)key2,(long)length,ks, + (des_cblock *)key2); + des_check_key=i; + memset(ks,0,sizeof(ks)); + des_set_odd_parity(key1); + des_set_odd_parity(key2); + return(0); +} diff --git a/lib/des/testdes.pl b/lib/des/testdes.pl new file mode 100755 index 000000000..01a165a96 --- /dev/null +++ b/lib/des/testdes.pl @@ -0,0 +1,167 @@ +#!/usr/local/bin/perl + +# des.pl tesing code + +require 'des.pl'; + +$num_tests=34; +@key_data=( + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + 0x7C,0xA1,0x10,0x45,0x4A,0x1A,0x6E,0x57, + 0x01,0x31,0xD9,0x61,0x9D,0xC1,0x37,0x6E, + 0x07,0xA1,0x13,0x3E,0x4A,0x0B,0x26,0x86, + 0x38,0x49,0x67,0x4C,0x26,0x02,0x31,0x9E, + 0x04,0xB9,0x15,0xBA,0x43,0xFE,0xB5,0xB6, + 0x01,0x13,0xB9,0x70,0xFD,0x34,0xF2,0xCE, + 0x01,0x70,0xF1,0x75,0x46,0x8F,0xB5,0xE6, + 0x43,0x29,0x7F,0xAD,0x38,0xE3,0x73,0xFE, + 0x07,0xA7,0x13,0x70,0x45,0xDA,0x2A,0x16, + 0x04,0x68,0x91,0x04,0xC2,0xFD,0x3B,0x2F, + 0x37,0xD0,0x6B,0xB5,0x16,0xCB,0x75,0x46, + 0x1F,0x08,0x26,0x0D,0x1A,0xC2,0x46,0x5E, + 0x58,0x40,0x23,0x64,0x1A,0xBA,0x61,0x76, + 0x02,0x58,0x16,0x16,0x46,0x29,0xB0,0x07, + 0x49,0x79,0x3E,0xBC,0x79,0xB3,0x25,0x8F, + 0x4F,0xB0,0x5E,0x15,0x15,0xAB,0x73,0xA7, + 0x49,0xE9,0x5D,0x6D,0x4C,0xA2,0x29,0xBF, + 0x01,0x83,0x10,0xDC,0x40,0x9B,0x26,0xD6, + 0x1C,0x58,0x7F,0x1C,0x13,0x92,0x4F,0xEF, + 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, + 0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E, + 0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFE,0xDC,0xBA,0x98,0x76,0x54,0x32,0x10, + ); + +@plain_data=( + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x01, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x11,0x11,0x11,0x11,0x11,0x11,0x11,0x11, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0xA1,0xD6,0xD0,0x39,0x77,0x67,0x42, + 0x5C,0xD5,0x4C,0xA8,0x3D,0xEF,0x57,0xDA, + 0x02,0x48,0xD4,0x38,0x06,0xF6,0x71,0x72, + 0x51,0x45,0x4B,0x58,0x2D,0xDF,0x44,0x0A, + 0x42,0xFD,0x44,0x30,0x59,0x57,0x7F,0xA2, + 0x05,0x9B,0x5E,0x08,0x51,0xCF,0x14,0x3A, + 0x07,0x56,0xD8,0xE0,0x77,0x47,0x61,0xD2, + 0x76,0x25,0x14,0xB8,0x29,0xBF,0x48,0x6A, + 0x3B,0xDD,0x11,0x90,0x49,0x37,0x28,0x02, + 0x26,0x95,0x5F,0x68,0x35,0xAF,0x60,0x9A, + 0x16,0x4D,0x5E,0x40,0x4F,0x27,0x52,0x32, + 0x6B,0x05,0x6E,0x18,0x75,0x9F,0x5C,0xCA, + 0x00,0x4B,0xD6,0xEF,0x09,0x17,0x60,0x62, + 0x48,0x0D,0x39,0x00,0x6E,0xE7,0x62,0xF2, + 0x43,0x75,0x40,0xC8,0x69,0x8F,0x3C,0xFA, + 0x07,0x2D,0x43,0xA0,0x77,0x07,0x52,0x92, + 0x02,0xFE,0x55,0x77,0x81,0x17,0xF1,0x2A, + 0x1D,0x9D,0x5C,0x50,0x18,0xF7,0x28,0xC2, + 0x30,0x55,0x32,0x28,0x6D,0x6F,0x29,0x5A, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0x01,0x23,0x45,0x67,0x89,0xAB,0xCD,0xEF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF); + +@cipher_data=( + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0x73,0x59,0xB2,0x16,0x3E,0x4E,0xDC,0x58, + 0x95,0x8E,0x6E,0x62,0x7A,0x05,0x55,0x7B, + 0xF4,0x03,0x79,0xAB,0x9E,0x0E,0xC5,0x33, + 0x17,0x66,0x8D,0xFC,0x72,0x92,0x53,0x2D, + 0x8A,0x5A,0xE1,0xF8,0x1A,0xB8,0xF2,0xDD, + 0x8C,0xA6,0x4D,0xE9,0xC1,0xB1,0x23,0xA7, + 0xED,0x39,0xD9,0x50,0xFA,0x74,0xBC,0xC4, + 0x69,0x0F,0x5B,0x0D,0x9A,0x26,0x93,0x9B, + 0x7A,0x38,0x9D,0x10,0x35,0x4B,0xD2,0x71, + 0x86,0x8E,0xBB,0x51,0xCA,0xB4,0x59,0x9A, + 0x71,0x78,0x87,0x6E,0x01,0xF1,0x9B,0x2A, + 0xAF,0x37,0xFB,0x42,0x1F,0x8C,0x40,0x95, + 0x86,0xA5,0x60,0xF1,0x0E,0xC6,0xD8,0x5B, + 0x0C,0xD3,0xDA,0x02,0x00,0x21,0xDC,0x09, + 0xEA,0x67,0x6B,0x2C,0xB7,0xDB,0x2B,0x7A, + 0xDF,0xD6,0x4A,0x81,0x5C,0xAF,0x1A,0x0F, + 0x5C,0x51,0x3C,0x9C,0x48,0x86,0xC0,0x88, + 0x0A,0x2A,0xEE,0xAE,0x3F,0xF4,0xAB,0x77, + 0xEF,0x1B,0xF0,0x3E,0x5D,0xFA,0x57,0x5A, + 0x88,0xBF,0x0D,0xB6,0xD7,0x0D,0xEE,0x56, + 0xA1,0xF9,0x91,0x55,0x41,0x02,0x0B,0x56, + 0x6F,0xBF,0x1C,0xAF,0xCF,0xFD,0x05,0x56, + 0x2F,0x22,0xE4,0x9B,0xAB,0x7C,0xA1,0xAC, + 0x5A,0x6B,0x61,0x2C,0xC2,0x6C,0xCE,0x4A, + 0x5F,0x4C,0x03,0x8E,0xD1,0x2B,0x2E,0x41, + 0x63,0xFA,0xC0,0xD0,0x34,0xD9,0xF7,0x93, + 0x61,0x7B,0x3A,0x0C,0xE8,0xF0,0x71,0x00, + 0xDB,0x95,0x86,0x05,0xF8,0xC8,0xC6,0x06, + 0xED,0xBF,0xD1,0xC6,0x6C,0x29,0xCC,0xC7, + 0x35,0x55,0x50,0xB2,0x15,0x0E,0x24,0x51, + 0xCA,0xAA,0xAF,0x4D,0xEA,0xF1,0xDB,0xAE, + 0xD5,0xD4,0x4F,0xF7,0x20,0x68,0x3D,0x0D, + 0x2A,0x2B,0xB0,0x08,0xDF,0x97,0xC2,0xF2); + +print "Doing ecb tests\n"; +for ($i=0; $i<$num_tests; $i++) + { + printf "Doing test $i\n"; + $key =pack("C8",splice(@key_data ,0,8)); + $data=pack("C8",splice(@plain_data ,0,8)); + $res =pack("C8",splice(@cipher_data,0,8)); + + @ks= &des_set_key($key); + $out1= &des_ecb_encrypt(*ks,1,$data); + $out2= &des_ecb_encrypt(*ks,0,$out1); + $out3= &des_ecb_encrypt(*ks,0,$res); + &eprint("encryption failure",$res,$out1) + if ($out1 ne $res); + &eprint("encryption/decryption failure",$data,$out2) + if ($out2 ne $data); + &eprint("decryption failure",$data,$out3) + if ($data ne $out3); + } +print "Done\n"; + +print "doing speed test over 30 seconds\n"; +$SIG{'ALRM'}='done'; +sub done {$done=1;} +$done=0; + +$count=0; +$d=pack("C8",0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef); +@ks= &des_set_key($d); +alarm(30); +$start=(times)[0]; +while (!$done) + { + $count++; + $d=&des_ecb_encrypt(*ks,1,$d); + } +$end=(times)[0]; +$t=$end-$start; +printf "$count DESs in %.2f seconds is %.2f DESs/sec or %.2f bytes/sec\n", + 1.0*$t,1.0*$count/$t,$count*8.0/$t; + +sub eprint + { + local($s,$c,$e)=@_; + local(@k); + + @k=unpack("C8",$c); + printf "%02x%02x%02x%02x %02x%02x%02x%02x - ",unpack("C8",$c); + printf "%02x%02x%02x%02x %02x%02x%02x%02x :",unpack("C8",$e); + print " $s\n"; + } diff --git a/lib/des/times b/lib/des/times new file mode 100644 index 000000000..d191333e8 --- /dev/null +++ b/lib/des/times @@ -0,0 +1,77 @@ +DEC Alpha DEC 4000/610 AXP OSF/1 v 1.3 - gcc v 2.3.3 +set_key per sec = 101840.19 ( 9.8uS) +DES ecb bytes per sec = 1223712.35 ( 6.5uS) +DES cbc bytes per sec = 1230542.98 ( 6.5uS) +crypt per sec = 6428.75 (155.6uS) + +DEC Alpha DEC 4000/610 APX OSF/1 v 1.3 - cc -O2 - OSF/1 AXP +set_key per sec = 114198.91 ( 8.8uS) +DES ecb bytes per sec = 1022710.93 ( 7.8uS) +DES cbc bytes per sec = 1008821.93 ( 7.9uS) +crypt per sec = 5454.13 (183.3uS) + +DEC Alpha - DEC 3000/500 AXP OSF/1 - cc -O2 - 02/12/92 +set_key per sec = 83587.04 ( 12.0uS) +DES ecb bytes per sec = 822620.82 ( 9.7uS) +DES cbc bytes per sec = 832929.60 ( 9.6uS) +crypt per sec = 4807.62 (208.0uS) + +sun sparc 10/30 - gcc -O2 +set_key per sec = 42005.24 ( 23.8uS) +DES ecb bytes per sec = 555949.47 ( 14.4uS) +DES cbc bytes per sec = 549440.28 ( 14.6uS) +crypt per sec = 2580.25 (387.6uS) + +PA-RISC 1.1 HP 710 +set_key per sec = 38916.86 +DES ecb bytes per sec = 505971.82 +DES cbc bytes per sec = 515381.13 +crypt per sec = 2438.24 + +sun sparc 10/30 - cc -O4 +set_key per sec = 38379.86 ( 26.1uS) +DES ecb bytes per sec = 460051.34 ( 17.4uS) +DES cbc bytes per sec = 464970.54 ( 17.2uS) +crypt per sec = 2092.64 (477.9uS) + +sun sparc 2 - gcc2 -O2 +set_key per sec = 21559.10 +DES ecb bytes per sec = 305566.92 +DES cbc bytes per sec = 303497.50 +crypt per sec = 1410.48 + +RS/6000 model 320 +set_key per sec = 14371.93 +DES ecb bytes per sec = 222231.26 +DES cbc bytes per sec = 223926.79 +crypt per sec = 981.20 + +68030 HP400 +set_key per sec = 5251.28 +DES ecb bytes per sec = 56186.56 +DES cbc bytes per sec = 58681.53 +crypt per sec = 276.15 + +80486sx/33MHz MSDOS Turbo C v 2.0 +set_key per sec = 1883.22 (531.0uS) +DES ecb bytes per sec = 63393.31 (126.2uS) +DES cbc bytes per sec = 63416.83 (126.1uS) +crypt per sec = 158.71 (6300.6uS) + +80486sx/33MHz MSDOS djgpp gcc 1.39 (32bit compiler) +set_key per sec = 12603.08 (79.3) +DES ecb bytes per sec = 158875.15 (50.4) +DES cbc bytes per sec = 159893.85 (50.0) +crypt per sec = 780.24 (1281.7) + +Version 1.99 26/08/92 +8MHz 68000 Atari-ST gcc 2.1 -O2 MiNT 0.94 +set_key per sec = 325.68 (3070.5uS) +DES ecb bytes per sec = 4173.67 (1916.8uS) +DES cbc bytes per sec = 4249.89 (1882.4uS) +crypt per sec = 20.19 (49521.6uS) + +8088/4.77mh MSDOS Turbo C v 2.0 +set_key per sec = 35.09 +DES ecb bytes per sec = 563.63 +crypt per sec = 2.69 diff --git a/lib/des/vms.com b/lib/des/vms.com new file mode 100644 index 000000000..885ea8e36 --- /dev/null +++ b/lib/des/vms.com @@ -0,0 +1,90 @@ +$! --- VMS.com --- +$! +$ GoSub defines +$ GoSub linker_options +$ If (P1 .nes. "") +$ Then +$ GoSub 'P1' +$ Else +$ GoSub lib +$ GoSub destest +$ GoSub rpw +$ GoSub speed +$ GoSub des +$ EndIF +$! +$ Exit +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DEFINES: +$ OPT_FILE := "VAX_LINKER_OPTIONS.OPT" +$! +$ CC_OPTS := "/NODebug/OPTimize/NOWarn" +$! +$ LINK_OPTS := "/NODebug/NOTraceback/Contiguous" +$! +$ OBJS = "cbc_cksm.obj,cbc_enc.obj,ecb_enc.obj,pcbc_enc.obj," + - + "qud_cksm.obj,rand_key.obj,read_pwd.obj,set_key.obj," + - + "str2key.obj,enc_read.obj,enc_writ.obj,fcrypt.obj," + - + "cfb_enc.obj,3ecb_enc.obj,ofb_enc.obj" + + +$! +$ LIBDES = "cbc_cksm.c,cbc_enc.c,ecb_enc.c,enc_read.c," + - + "enc_writ.c,pcbc_enc.c,qud_cksm.c,rand_key.c," + - + "read_pwd.c,set_key.c,str2key.c,fcrypt.c," + - + "cfb_enc.c,3ecb_enc.c,ofb_enc.c" +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$LINKER_OPTIONS: +$ If (f$search(OPT_FILE) .eqs. "") +$ Then +$ Create 'OPT_FILE' +$DECK +! Default system options file to link against the sharable C runtime library +! +Sys$Share:VAXcRTL.exe/Share +$EOD +$ EndIF +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$LIB: +$ CC 'CC_OPTS' 'LIBDES' +$ If (f$search("LIBDES.OLB") .nes. "") +$ Then Library /Object /Replace libdes 'OBJS' +$ Else Library /Create /Object libdes 'OBJS' +$ EndIF +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DESTEST: +$ CC 'CC_OPTS' destest +$ Link 'link_opts' /Exec=destest destest.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$RPW: +$ CC 'CC_OPTS' rpw +$ Link 'link_opts' /Exec=rpw rpw.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$SPEED: +$ CC 'CC_OPTS' speed +$ Link 'link_opts' /Exec=speed speed.obj,libdes/LIBRARY,'opt_file'/Option +$ Return +$! +$!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +$! +$DES: +$ CC 'CC_OPTS' des +$ Link 'link_opts' /Exec=des des.obj,libdes/LIBRARY,'opt_file'/Option +$ Return diff --git a/lib/roken/getopt.c b/lib/roken/getopt.c new file mode 100644 index 000000000..b7ad10c21 --- /dev/null +++ b/lib/roken/getopt.c @@ -0,0 +1,128 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)getopt.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef __STDC__ +#define const +#endif +#include +#include +#include + +/* + * get option letter from argument vector + */ +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +int +getopt(nargc, nargv, ostr) + int nargc; + char * const *nargv; + const char *ostr; +{ + static char *place = EMSG; /* option letter processing */ + register char *oli; /* option letter list index */ + char *p; + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return(EOF); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return(EOF); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means EOF. + */ + if (optopt == (int)'-') + return(EOF); + if (!*place) + ++optind; + if (opterr && *ostr != ':') { + if (!(p = strrchr(*nargv, '/'))) + p = *nargv; + else + ++p; + (void)fprintf(stderr, "%s: illegal option -- %c\n", + p, optopt); + } + return(BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (!(p = strrchr(*nargv, '/'))) + p = *nargv; + else + ++p; + if (*ostr == ':') + return(BADARG); + if (opterr) + (void)fprintf(stderr, + "%s: option requires an argument -- %c\n", + p, optopt); + return(BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return(optopt); /* dump back option letter */ +} diff --git a/lib/roken/strcasecmp.c b/lib/roken/strcasecmp.c new file mode 100644 index 000000000..142a2289e --- /dev/null +++ b/lib/roken/strcasecmp.c @@ -0,0 +1,122 @@ +/* + * Copyright (c) 1987, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef __STDC__ +#define const +#endif + +#include +#include +#ifdef NO_STRING_H +#include +#else +#include +#endif + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +/* + * This array is designed for mapping upper and lower case letter + * together for a case independent comparison. The mappings are + * based upon ascii character sequences. + */ +static const u_char charmap[] = { + '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007', + '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017', + '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027', + '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037', + '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047', + '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057', + '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067', + '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077', + '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137', + '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147', + '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157', + '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167', + '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177', + '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207', + '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217', + '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227', + '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237', + '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247', + '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257', + '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267', + '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277', + '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307', + '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317', + '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327', + '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337', + '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347', + '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357', + '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367', + '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377', +}; + +int +strcasecmp(s1, s2) + const char *s1, *s2; +{ + register const u_char *cm = charmap, + *us1 = (const u_char *)s1, + *us2 = (const u_char *)s2; + + while (cm[*us1] == cm[*us2++]) + if (*us1++ == '\0') + return (0); + return (cm[*us1] - cm[*--us2]); +} + +int +strncasecmp(s1, s2, n) + const char *s1, *s2; + register size_t n; +{ + if (n != 0) { + register const u_char *cm = charmap, + *us1 = (const u_char *)s1, + *us2 = (const u_char *)s2; + + do { + if (cm[*us1] != cm[*us2++]) + return (cm[*us1] - cm[*--us2]); + if (*us1++ == '\0') + break; + } while (--n != 0); + } + return (0); +} diff --git a/lib/roken/strftime.c b/lib/roken/strftime.c new file mode 100644 index 000000000..5b5ed7857 --- /dev/null +++ b/lib/roken/strftime.c @@ -0,0 +1,315 @@ +/* + * Copyright (c) 1989, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strftime.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ + +#ifndef __STDC__ +#define const +#endif + +#include +#include +#ifdef notdef +#include +#else +#define TM_YEAR_BASE 1900 /* from */ +#endif +#ifdef NO_STRING_H +#include +#else +#include +#endif + +static char *afmt[] = { + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", +}; +static char *Afmt[] = { + "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", + "Saturday", +}; +static char *bfmt[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", + "Oct", "Nov", "Dec", +}; +static char *Bfmt[] = { + "January", "February", "March", "April", "May", "June", "July", + "August", "September", "October", "November", "December", +}; + +static size_t gsize; +static char *pt; +#ifndef __P +#define __P(x) () +#endif +static int _add __P((char *)); +static int _conv __P((int, int, int)); +#ifndef NO_MKTIME +static int _secs __P((const struct tm *)); +#endif /* NO_MKTIME */ +static size_t _fmt __P((const char *, const struct tm *)); + +size_t +strftime(s, maxsize, format, t) + char *s; + size_t maxsize; + const char *format; + const struct tm *t; +{ + + pt = s; + if ((gsize = maxsize) < 1) + return(0); + if (_fmt(format, t)) { + *pt = '\0'; + return(maxsize - gsize); + } + return(0); +} + +static size_t +_fmt(format, t) + register const char *format; + const struct tm *t; +{ + for (; *format; ++format) { + if (*format == '%') + switch(*++format) { + case '\0': + --format; + break; + case 'A': + if (t->tm_wday < 0 || t->tm_wday > 6) + return(0); + if (!_add(Afmt[t->tm_wday])) + return(0); + continue; + case 'a': + if (t->tm_wday < 0 || t->tm_wday > 6) + return(0); + if (!_add(afmt[t->tm_wday])) + return(0); + continue; + case 'B': + if (t->tm_mon < 0 || t->tm_mon > 11) + return(0); + if (!_add(Bfmt[t->tm_mon])) + return(0); + continue; + case 'b': + case 'h': + if (t->tm_mon < 0 || t->tm_mon > 11) + return(0); + if (!_add(bfmt[t->tm_mon])) + return(0); + continue; + case 'C': + if (!_fmt("%a %b %e %H:%M:%S %Y", t)) + return(0); + continue; + case 'c': + if (!_fmt("%m/%d/%y %H:%M:%S", t)) + return(0); + continue; + case 'D': + if (!_fmt("%m/%d/%y", t)) + return(0); + continue; + case 'd': + if (!_conv(t->tm_mday, 2, '0')) + return(0); + continue; + case 'e': + if (!_conv(t->tm_mday, 2, ' ')) + return(0); + continue; + case 'H': + if (!_conv(t->tm_hour, 2, '0')) + return(0); + continue; + case 'I': + if (!_conv(t->tm_hour % 12 ? + t->tm_hour % 12 : 12, 2, '0')) + return(0); + continue; + case 'j': + if (!_conv(t->tm_yday + 1, 3, '0')) + return(0); + continue; + case 'k': + if (!_conv(t->tm_hour, 2, ' ')) + return(0); + continue; + case 'l': + if (!_conv(t->tm_hour % 12 ? + t->tm_hour % 12 : 12, 2, ' ')) + return(0); + continue; + case 'M': + if (!_conv(t->tm_min, 2, '0')) + return(0); + continue; + case 'm': + if (!_conv(t->tm_mon + 1, 2, '0')) + return(0); + continue; + case 'n': + if (!_add("\n")) + return(0); + continue; + case 'p': + if (!_add(t->tm_hour >= 12 ? "PM" : "AM")) + return(0); + continue; + case 'R': + if (!_fmt("%H:%M", t)) + return(0); + continue; + case 'r': + if (!_fmt("%I:%M:%S %p", t)) + return(0); + continue; + case 'S': + if (!_conv(t->tm_sec, 2, '0')) + return(0); + continue; +#ifndef NO_MKTIME + case 's': + if (!_secs(t)) + return(0); + continue; +#endif /* NO_MKTIME */ + case 'T': + case 'X': + if (!_fmt("%H:%M:%S", t)) + return(0); + continue; + case 't': + if (!_add("\t")) + return(0); + continue; + case 'U': + if (!_conv((t->tm_yday + 7 - t->tm_wday) / 7, + 2, '0')) + return(0); + continue; + case 'W': + if (!_conv((t->tm_yday + 7 - + (t->tm_wday ? (t->tm_wday - 1) : 6)) + / 7, 2, '0')) + return(0); + continue; + case 'w': + if (!_conv(t->tm_wday, 1, '0')) + return(0); + continue; + case 'x': + if (!_fmt("%m/%d/%y", t)) + return(0); + continue; + case 'y': + if (!_conv((t->tm_year + TM_YEAR_BASE) + % 100, 2, '0')) + return(0); + continue; + case 'Y': + if (!_conv(t->tm_year + TM_YEAR_BASE, 4, '0')) + return(0); + continue; +#ifdef notdef + case 'Z': + if (!t->tm_zone || !_add(t->tm_zone)) + return(0); + continue; +#endif + case '%': + /* + * X311J/88-090 (4.12.3.5): if conversion char is + * undefined, behavior is undefined. Print out the + * character itself as printf(3) does. + */ + default: + break; + } + if (!gsize--) + return(0); + *pt++ = *format; + } + return(gsize); +} + +#ifndef NO_MKTIME +static int +_secs(t) + const struct tm *t; +{ + static char buf[15]; + register time_t s; + register char *p; + struct tm tmp; + + /* Make a copy, mktime(3) modifies the tm struct. */ + tmp = *t; + s = mktime(&tmp); + for (p = buf + sizeof(buf) - 2; s > 0 && p > buf; s /= 10) + *p-- = s % 10 + '0'; + return(_add(++p)); +} +#endif /* NO_MKTIME */ + +static int +_conv(n, digits, pad) + int n, digits, pad; +{ + static char buf[10]; + register char *p; + + for (p = buf + sizeof(buf) - 2; n > 0 && p > buf; n /= 10, --digits) + *p-- = n % 10 + '0'; + while (p > buf && digits-- > 0) + *p-- = pad; + return(_add(++p)); +} + +static int +_add(str) + register char *str; +{ + for (;; ++pt, --gsize) { + if (!gsize) + return(0); + if (!(*pt = *str++)) + return(1); + } +}