Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 May 1995 08:06:23 -0400 (EDT)
From:      John Capo <jc@irbs.com>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/396: telnetd problems fix.
Message-ID:  <199505141206.IAA08763@irbs.irbs.com>
In-Reply-To: <9505140223.AA04228@cs.weber.edu> from "Terry Lambert" at May 13, 95 08:23:51 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Terry Lambert writes:
> 
> > I disagree, and we have been down this road at least 4 times in the
> > last 2 years with FreeBSD.  The bug is not in the FreeBSD code, it should
> > not be bandaided to work with code that gets option negotiation wrong.
> > 
> > I don't like to fix bugs in other software by making FreeBSD slower at
> > *anything*.  Go get NCSA and FTP software to fix there very ancient
> > and broken code, they have had 2 years to do this, and still have not.
> 
> Change the offer/accept order in BSD so it does not appear to be a 4.2
> system to this software (without impacting the actual algorithm for
> doing the negotiation) and the problem will disappear.
> 
> The option ordering is commutative as far as BSD is concerned, but
> associative as far as the malfunctioning clients are concerned.
> 
> It costs nothing and fixes many things to commute the BSD order to
> change the clients opinion of the association.
> 
> Other than that, you're right: we've been down the road before and
> it doesn't need a big rehash.  All the opinions "A is broken; fix A",
> "B is broken, fix B", and "A is broken, fix B" have been restated.
> 
> 

Here is my patch that fixes the missing prompt problem when your
erase character is ^H.  Option negotiation is all done before
starting the slave slide of the pty.  May want to give this a try.

The sys_term.c patch applies with a bit of offset.  I haven't generated
a new one lately. 

John Capo


*** libexec/telnetd/telnetd.c.orig	Fri Aug 12 19:00:02 1994
--- libexec/telnetd/telnetd.c	Wed Apr 12 11:46:21 1995
***************
*** 740,749 ****
  char host_name[MAXHOSTNAMELEN];
  char remote_host_name[MAXHOSTNAMELEN];
  
! #ifndef	convex
! extern void telnet P((int, int));
! #else
  extern void telnet P((int, int, char *));
  #endif
  
  /*
--- 740,749 ----
  char host_name[MAXHOSTNAMELEN];
  char remote_host_name[MAXHOSTNAMELEN];
  
! #if defined(convex) || defined(__FreeBSD__)
  extern void telnet P((int, int, char *));
+ #else
+ extern void telnet P((int, int));
  #endif
  
  /*
***************
*** 837,843 ****
  	/*
  	 * Start up the login process on the slave side of the terminal
  	 */
! #ifndef	convex
  	startslave(host, level, user_name);
  
  #if	defined(_SC_CRAY_SECURE_SYS)
--- 837,843 ----
  	/*
  	 * Start up the login process on the slave side of the terminal
  	 */
! #if !defined(convex) && !defined(__FreeBSD__)
  	startslave(host, level, user_name);
  
  #if	defined(_SC_CRAY_SECURE_SYS)
***************
*** 849,855 ****
--- 849,859 ----
  	}
  #endif	/* _SC_CRAY_SECURE_SYS */
  
+ #if __FreeBSD__
+ 	telnet(net, pty, host);  /* begin server processing */
+ #else
  	telnet(net, pty);  /* begin server processing */
+ #endif
  #else
  	telnet(net, pty, host);
  #endif
***************
*** 876,888 ****
   * hand data to telnet receiver finite state machine.
   */
  	void
! #ifndef	convex
! telnet(f, p)
! #else
  telnet(f, p, host)
  #endif
  	int f, p;
! #ifdef convex
  	char *host;
  #endif
  {
--- 880,892 ----
   * hand data to telnet receiver finite state machine.
   */
  	void
! #if defined(convex) || defined(__FreeBSD__)
  telnet(f, p, host)
+ #else
+ telnet(f, p)
  #endif
  	int f, p;
! #if defined(convex) || defined(__FreeBSD__)
  	char *host;
  #endif
  {
***************
*** 1120,1126 ****
  		{sprintf(nfrontp, "td: Entering processing loop\r\n");
  		 nfrontp += strlen(nfrontp);});
  
! #ifdef	convex
  	startslave(host);
  #endif
  
--- 1124,1130 ----
  		{sprintf(nfrontp, "td: Entering processing loop\r\n");
  		 nfrontp += strlen(nfrontp);});
  
! #if defined(convex) || defined(__FreeBSD__)
  	startslave(host);
  #endif
  

*** libexec/telnetd/sys_term.c.orig	Thu Feb  9 10:17:32 1995
--- libexec/telnetd/sys_term.c	Thu Apr 13 13:10:34 1995
***************
*** 1025,1030 ****
--- 1025,1031 ----
  getptyslave()
  {
  	register int t = -1;
+ 	char erase;
  
  #if	!defined(CRAY) || !defined(NEWINIT)
  # ifdef	LINEMODE
***************
*** 1046,1052 ****
  # ifdef	LINEMODE
  	waslm = tty_linemode();
  # endif
! 
  
  	/*
  	 * Make sure that we don't have a controlling tty, and
--- 1047,1053 ----
  # ifdef	LINEMODE
  	waslm = tty_linemode();
  # endif
!         erase = termbuf.c_cc[VERASE];
  
  	/*
  	 * Make sure that we don't have a controlling tty, and
***************
*** 1090,1095 ****
--- 1091,1097 ----
  	 * set up the tty modes as we like them to be.
  	 */
  	init_termbuf();
+ 
  # ifdef	TIOCGWINSZ
  	if (def_row || def_col) {
  		bzero((char *)&ws, sizeof(ws));
***************
*** 1133,1138 ****
--- 1135,1143 ----
  	tty_rspeed((def_rspeed > 0) ? def_rspeed : 9600);
  	tty_tspeed((def_tspeed > 0) ? def_tspeed : 9600);
  # ifdef	LINEMODE
+ 	if (erase)
+ 	    termbuf.c_cc[VERASE] = erase;
+ 
  	if (waslm)
  		tty_setlinemode(1);
  # endif	/* LINEMODE */
***************
*** 1400,1405 ****
--- 1405,1411 ----
  		utmp_sig_notify(pid);
  # endif	/* PARENT_DOES_UTMP */
  	} else {
+ 		usleep(125000);
  		getptyslave(autologin);
  		start_login(host, autologin, autoname);
  		/*NOTREACHED*/



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199505141206.IAA08763>