[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fix for telnet and 4.3



The fix here is for release 6.  For release 7 simply change
the method declarations.

;;; -*- Mode: LISP; Package: TELNET; Base: 8; Patch-File: Yes -*-

;;;New telnet protocol IAC handler
(DEFMETHOD (TELNET-STATE-BLOCK :HANDLE-IAC) (INPUT-STREAM OUTPUT-STREAM &AUX COMMAND)
  (COND ((NULL NEW-TELNET-P)
	 (SEND SELF ':TELNET-SEND-OPTION NVT-DO NVT-ECHO)
	 (SEND SELF ':TELNET-SEND-OPTION NVT-DO NVT-SUPPRESS-GO-AHEAD)
	 (SETQ NEW-TELNET-P T)))
  (SETQ COMMAND (SEND INPUT-STREAM ':TYI))
  (IF (= COMMAND NVT-IAC)
      NVT-IAC
      (IF (AND ( COMMAND NVT-WILL) ( COMMAND NVT-DONT))
	  (SEND SELF :TELNET-HANDLE-OPTION COMMAND (SEND INPUT-STREAM ':TYI))
	  ;; It must be a subnegotation.
	  (SEND SELF ':TELNET-HANDLE-SUBNEGOTIATION INPUT-STREAM OUTPUT-STREAM))))

(DEFMETHOD (TELNET-STATE-BLOCK :TELNET-HANDLE-OPTION) (COMMAND OPTION)
  (SELECT COMMAND
    (NVT-WILL
     (SELECT OPTION
       (NVT-ECHO
	(SEND SELF ':TELNET-ECHO T))
       (NVT-SUPPRESS-GO-AHEAD)			;ignore things we requested
       (NVT-TRANSMIT-BINARY
	(SETQ BINARY-OUTPUT-FLAG T)
	(SEND SELF ':TELNET-SEND-OPTION NVT-DO OPTION))
       (NVT-SUPDUP-OUTPUT
	(SEND SELF ':TELNET-START-SUPDUP-OUTPUT))
       (OTHERWISE
	(SEND SELF ':TELNET-SEND-OPTION NVT-DONT OPTION))))
    (NVT-DO 
     (COND #| This is bankrupt.  This must be a request by the server as we
              never send WILL ECHO.  We aren't prepared to echo back accross
              network, and should send WON'T ECHO in response. |
	   ((= OPTION NVT-ECHO) (SEND SELF ':TELNET-ECHO NIL))
	   ||#
	   ((OR (= OPTION NVT-SUPPRESS-GO-AHEAD) (= OPTION NVT-TIMING-MARK)
		(= OPTION NVT-TRANSMIT-BINARY))
	    (SEND SELF ':TELNET-SEND-OPTION NVT-WILL OPTION))
	   (T (SEND SELF ':TELNET-SEND-OPTION NVT-WONT OPTION))))
    (NVT-DONT
     (COND #| This is bankrupt.  See above.|
	   ((= OPTION NVT-ECHO) (SEND SELF ':TELNET-ECHO T))
	   ||#
	   ((= OPTION NVT-TRANSMIT-BINARY)
	    (SEND SELF ':TELNET-SEND-OPTION NVT-WONT OPTION))))
    (NVT-WONT
     (COND ((= OPTION NVT-ECHO) (SEND SELF ':TELNET-ECHO NIL))
	   ((= OPTION NVT-TRANSMIT-BINARY)
	    (SETQ BINARY-OUTPUT-FLAG NIL)
	    (SEND SELF ':TELNET-SEND-OPTION NVT-DONT OPTION))))))