*BSD News Article 16598


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!usc!howland.reston.ans.net!torn!nott!bnrgate!bnr.co.uk!pipex!uknet!mcsun!sun4nl!tuegate.tue.nl!svin09.info.win.tue.nl!wzv.win.tue.nl!gvr.win.tue.nl!guido
From: guido@gvr.win.tue.nl (Guido van Rooij)
Newsgroups: comp.os.386bsd.development
Subject: Re: Bug in telnet(1) and fix
Date: 28 May 1993 17:33:29 GMT
Organization: Eindhoven University of Technology, The Netherlands
Lines: 94
Distribution: world
Message-ID: <1u5id9$h0c@wzv.win.tue.nl>
References: <RENS.93May27172722@stimpys.imsi.com>
NNTP-Posting-Host: gvr.win.tue.nl


Hmm strange. This patch has been reported quite some time ago (nov '92)
here is the original posting: (with a similar fix, though somwhat
more complete)

-Guido


>Path: wzv!svin09!tuegate.tue.nl!sun4nl!mcsun!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)
>Newsgroups: comp.bugs.4bsd,comp.unix.bsd
>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>
>Date: 17 Nov 92 04:13:08 GMT
>Sender: news@CSD-NewsHost.Stanford.EDU
>Followup-To: comp.bugs.4bsd
>Organization: Computer Science Department, Stanford University.
>Lines: 66
>Xref: wzv comp.bugs.4bsd:1030 comp.unix.bsd:7917

[[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);



-- 
Guido van Rooij                 |  Internet: guido@gvr.win.tue.nl
Bisschopsmolen 16               |  Phone:    ++31.40.461433
5612 DS Eindhoven               |  ((12+144+20)+3*sqrt(4))/7 
The Netherlands                 |    +(5*11)=9^2+0