Commit 489508b8 authored by james's avatar james
Browse files

More option fiddling. Also complete list of possibly relevant RFC refer-

ences added to header comments. Includes gratuitously crufty ones like
SUPDUP, RCTE, as well as fancy new authentication and encryption stuff.
parent 7855da00
......@@ -8,12 +8,12 @@
;;;; This software is in the Public Domain. If you break it you get to keep
;;;; both pieces.
;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; NOTA BENE: This code doesn't work yet. It hasn't even been compiled. ;;;;
;;;; Don't expect it to do what you expect, or even what it expects. ;;;;
;;;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; ;;;;
;;;; NOTA BENE: This code doesn't work yet. It hasn't even been compiled. ;;;;
;;;; Don't expect it to do what you expect, or even what it expects. ;;;;
;;;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
;;;; This is a Lisp Telnet daemon. To make it run, instantiate a TELNET-
;;;; LISTENER class with your favorite address and port (which default to
......@@ -35,10 +35,74 @@
;;;; TODO:
;;;; - Finish Telnet stream implementation
;;;; - Q Method option negotiation (see RFC 1143)
;;;; - Telnet NVT support (Telnet characters, etc)
;;;; - Telnet NVT support
;;;; - NAWS and TERMINAL-TYPE
;;;; -
;;;; - All those nifty options
;;;; - Useful documentation (hah!)
;;;; - CL-TERMINFO linkage (eg, so server Terminfo can override Telnet chars)
;;;; - CL-TERMINFO linkage (eg, so server Terminfo can override Telnet NVT)
;;;; - Telnet client?
;;;; - Environment option
;;;; - SUPDUP support
;;;;
;;;; REFERENCES:
;;;; RFC 652 "Telnet Output Carriage-Return Disposition Option"
;;;; RFC 653 "Telnet Output Horizontal Tabstops Option"
;;;; RFC 654 "Telnet Output Horizontal Tab Disposition Option"
;;;; RFC 655 "Telnet Output Formfeed Disposition Option"
;;;; RFC 656 "Telnet Output Vertical Tabstops Option"
;;;; RFC 657 "Telnet Output Vertical Tab Disposition Option"
;;;; RFC 658 "Telnet Output Linefeed Disposition"
;;;; RFC 698 "Telnet Extended ASCII Option"
;;;; RFC 726 "Remote Controlled Transmission and Echoing Telnet Option"
;;;; RFC 727 "Telnet Logout Option"
;;;; RFC 732 "Telnet Data Entry Terminal Option"
;;;; RFC 735 "Revised Telnet Byte Macro Option"
;;;; RFC 736 "Telnet SUPDUP Option"
;;;; RFC 748 "Telnet Randomly-Lose Option"
;;;; RFC 749 "Telnet SUPDUP-Output Option"
;;;; RFC 779 "Telnet Send-Location Option"
;;;; RFC 854 "Telnet Protocol Specification"
;;;; RFC 855 "Telnet Option Specifications"
;;;; RFC 856 "Telnet Binary Translation"
;;;; RFC 857 "Telnet Echo Option"
;;;; RFC 858 "Telnet Suppress Go Ahead Option"
;;;; RFC 859 "Telnet Status Option"
;;;; RFC 860 "Telnet Timing Mark Option"
;;;; RFC 861 "Telnet Extended Options - List Option"
;;;; RFC 885 "Telnet End of Record Option"
;;;; RFC 930 "Output Marking Telnet Option"
;;;; RFC 946 "Telnet Terminal Location Number Option"
;;;; RFC 947 "TACACS User Identification Telnet Option"
;;;; RFC 1043 "Telnet Data Entry Terminal Option: DODIIS Implementation"
;;;; RFC 1053 "Telnet X.3 PAD Option"
;;;; RFC 1073 "Telnet Window Size Option" (NAWS)
;;;; RFC 1079 "Telnet Terminal Speed Option"
;;;; RFC 1091 "Telnet Terminal-Type Option"
;;;; RFC 1096 "Telnet X Display Location Option"
;;;; RFC 1097 "Telnet Subliminal Message Option"
;;;; RFC 1143 "The Q Method of Implementing Telnet Option Negotiation"
;;;; RFC 1184 "Telnet Linemode Option"
;;;; RFC 1372 "Telnet Remote Flow Control Option"
;;;; RFC 1408 "Telnet Environment Option"
;;;; RFC 1412 "Telnet Authentication: SPX"
;;;; RFC 1571 "Telnet Environment Option Interoperability Issues"
;;;; RFC 1572 "Telnet Environment Option"
;;;; RFC 2066 "Telnet Charset Option"
;;;; RFC 2217 "Telnet Com Port Control Option"
;;;; RFC 2840 "Telnet Kermit Option"
;;;; RFC 2941 "Telnet Authentication Option"
;;;; RFC 2942 "Telnet Authentication: Kerberos Version 5"
;;;; RFC 2943 "Telnet Authentication Using DSA"
;;;; RFC 2944 "Telnet Authentication: SRP"
;;;; RFC 2946 "Telnet Data Encryption Option"
;;;; RFC 2947 "Telnet Encryption: DES3 64 bit Cipher Feedback"
;;;; RFC 2948 "Telnet Encryption: DES3 64 bit Output Feedback"
;;;; RFC 2949 "Telnet Encryption: CAST-128 64 bit Output Feedback"
;;;; RFC 2950 "Telnet Encryption: CAST-128 64 bit Cipher Feedback"
;;;; RFC 2951 "Telnet Authentication Using KEA and SKIPJACK"
;;;; RFC 2952 "Telnet Encryption: DES 64 bit Cipher Feedback"
;;;; RFC 2953 "Telnet Encryption: DES 64 bit Output Feedback"
#-sbcl (progn
(format t "LTELNETD does not run except with SBCL. Try porting it.")
......@@ -285,35 +349,29 @@ in LISTENER."
;;
;;;;;; Command Processing.
;;;;;; Telnet Commands and Options
;;
(defmethod negotiate-telnet-options ((stream telnet-stream))
())
(defmethod process-telnet-option ((stream telnet-stream))
)
(defmethod process-telnet-command ((stream telnet-stream))
"Processes a Telnet protocol command. Expects STREAM to have command contents
in queue without preceding +NVT-IAC+ character. Returns STREAM."
(setf (stream-command-mode stream) t)
)
;;
;;;;;; NVT Support.
;;
;;; Telnet commands and options are sent in band but the client and server
;;; must filter them out of the stream. All command and option sequences are
;;; preceded by the IAC ("Interpret As Command") character.
;;;
;;; Telnet options are negotiated between client and server. They are argued
;;; by means of the DO, DONT, WILL, and WONT commands. FIXME ...
;;;
;;; Some options are simple, just saying "IAC DO FOO" is sufficient to turn on
;;; FOO. Some are much more complicated. These complex options have specific
;;; subnegotiation patterns, all of which are started with "IAC SB FOO" and
;;; ended with "IAC SE FOO".
;;; IAC
;;;
;;; IAC ("Interpret As Command") is the Official Telnet Escape Character.
(defconstant +iac+ (code-char 255) "IAC")
;;; IAC Commands.
;;;
;;; These are commands that may be issued or received (with preceding IAC) at
;;; any point in the Telnet stream.
(defconstant +cmd-bell+ (code-char 7) "Bell")
(defconstant +cmd-se+ (code-char 240) "Subnegotiation End")
(defconstant +cmd-nop+ (code-char 241) "No Operation")
(defconstant +cmd-dm+ (code-char 242) "Data Mark")
......@@ -325,23 +383,19 @@ in queue without preceding +NVT-IAC+ character. Returns STREAM."
(defconstant +cmd-el+ (code-char 248) "Erase Line")
(defconstant +cmd-ga+ (code-char 249) "Go Ahead")
(defconstant +cmd-sb+ (code-char 250) "Subnegotiation Begin")
(defconstant +cmd-will+ (code-char 251) "WILL")
(defconstant +cmd-wont+ (code-char 252) "WON'T")
(defconstant +cmd-do+ (code-char 253) "DO")
(defconstant +cmd-dont+ (code-char 254) "DON'T")
(defconstant +cmd-submsg+ (code-char 257) "Subliminal Message")
(defconstant +nvt-exopl+ (code-char 255) "Extended Options List")
(defconstant +cmd-will+ (code-char 251) "Will")
(defconstant +cmd-wont+ (code-char 252) "Won't")
(defconstant +cmd-do+ (code-char 253) "Do")
(defconstant +cmd-dont+ (code-char 254) "Don't")
;;; Option Codes.
;;;
;;; These are options which may only be received as part of an option
;;; negotiation (ie, preceded by "IAC {DO,DONT,WILL,WONT}").
;;; negotiation (ie, preceded by "IAC {DO,DONT,WILL,WONT,SB,SE}").
(defconstant +nvt-echo+ (code-char 1) "Echo")
(defconstant +nvt-supress-go-ahead+ (code-char 3) "Suppress Go Ahead")
(defconstant +nvt-status+ (code-char 5) "Status")
(defconstant +nvt-timing-mark+ (code-char 6) "Timing Mark")
(defconstant +nvt-bell+ (code-char 7) "Bell")
(defconstant +nvt-terminal-type+ (code-char 24) "Terminal Type")
(defconstant +nvt-end-of-record+ (code-char 25) "End of Record")
(defconstant +nvt-ttyloc+ (code-char 26) "Terminal Location Number")
......@@ -352,5 +406,25 @@ in queue without preceding +NVT-IAC+ character. Returns STREAM."
(defconstant +nvt-xdisploc+ (code-char 35) "X Display Location")
(defconstant +nvt-environ+ (code-char 36) "Environment")
(defconstant +nvt-eor+ (code-char 239) "End of Record")
(defconstant +nvt-exopl+ (code-char 255) "Extended Options List")
(defconstant +nvt-randomly-lose+ (code-char 256) "Randomly Lose")
(defconstant +nvt-submsg+ (code-char 257) "Subliminal Message")
(defconstant +nvt-is+ (code-char 0) "IS")
;;
;;;;;; Command and Option Processing.
;;
(defmethod negotiate-telnet-options ((stream telnet-stream))
())
(defmethod process-telnet-option ((stream telnet-stream))
)
(defmethod process-telnet-command ((stream telnet-stream))
"Processes a Telnet protocol command. Expects STREAM to have command contents
in queue without preceding +NVT-IAC+ character. Returns STREAM."
(setf (stream-command-mode stream) t)
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment