*BSD News Article 8023


Return to BSD News archive

Xref: sserve comp.bugs.4bsd:1913 comp.unix.bsd:8076
Newsgroups: comp.bugs.4bsd,comp.unix.bsd
Path: sserve!manuel.anu.edu.au!munnari.oz.au!uunet!charon.amdahl.com!pacbell.com!sgiblab!spool.mu.edu!agate!stanford.edu!CSD-NewsHost.Stanford.EDU!CS.Stanford.EDU!jonathan
From: jonathan@CS.Stanford.EDU (Jonathan Stone)
Subject:  Bug in 386BSD, Net-2 telnets, Berkeley telnet.91.03.25: "send ayt" doesn' t work
Message-ID: <1992Nov17.041308.5252@CSD-NewsHost.Stanford.EDU>
Followup-To:  comp.bugs.4bsd
Sender: news@CSD-NewsHost.Stanford.EDU
Organization: Computer Science Department, Stanford University.
Date: Tue, 17 Nov 1992 04:13:08 GMT
Lines: 66

[[This may be very old news, but I don't recall seeing it before, and archie
  hasn't helped me find any source code with the bug fixed.
  If it is old news, apologies, and please let me know via mail. ]]

Index::
	telnet SEND command broken in client (e.g., SEND AYT)

Synopsis::
	Sending simple options, such as AYT,  doesn't work.

Repeat-by::
	build a telnet client from any of the above source code.
	(the relevant file differs only in copyright notices and
 	one debugging statement for all three of the above releases).
	Start a telnet with the command "telnet".
	Type "show options", then "connect <somehost>", where <somehost>
	is a host that understands the AYT option.
	Type a telnet escape and then "send ayt".
	Observe that the telnet options debugging shows junk, viz:

		telnet> send ayt
		SENT IAC 268439864
Diagnosis::
	In commands.c:sendcmd(),  options that don't have a special
	handler function are sent by NET2ADD(IAC, what).
	The local variable "what" is never assigned, resulting in junk
	being sent to the telnet server.

Fix::
	The patch below works for me with telnet.91.03.25 source
	compiled on a Decstation.
	the relevant file differs only in copyright notices and
 	one debugging statement for all three of the above releases:
	net-2, the March 1989 telnet release, and BSD

*** commands.c.DIST	Mon Mar 25 14:14:23 1991
--- commands.c	Mon Nov 16 19:36:52 1992
***************
*** 277,283 ****
      int  argc;
      char **argv;
  {
-     int what;		/* what we are sending this time */
      int count;		/* how many bytes we are going to need to send */
      int i;
      int question = 0;	/* was at least one argument a question */
--- 277,282 ----
***************
*** 350,357 ****
  				  (s->narg > 1) ? argv[i+2] : 0);
  	    i += s->narg;
  	} else {
! 	    NET2ADD(IAC, what);
! 	    printoption("SENT", IAC, what);
  	}
      }
      return (count == success);
--- 349,356 ----
  				  (s->narg > 1) ? argv[i+2] : 0);
  	    i += s->narg;
  	} else {
! 	    NET2ADD(IAC, s->what);
! 	    printoption("SENT", IAC, s->what);
  	}
      }
      return (count == success);