SSH Client Hangs after logging in to SSHD

Roger Cornelius rac at tenzing.org
Wed Feb 13 05:25:09 EST 2002


"Frank S. Bernhardt" (frank at bcsi.ca) wrote:

>I'm not a ssh expert and I don't know if the log is good or bad, but I too am
>running OpenSHH under OpenServer. I find that after I connect, the return key
>has no effect unless I first type:
>
>        stty sane <Ctrl>j
>
>If you've hit <ENTER> before that you must first press <Ctrl>j a couple of times
>to clean out the buffer. After I type the above command, everything seems to
>work ok. Interestingly when I connect from a Linux box using ssh I don't seem to
>need to do this.

My experience on SCO OpenServer has been that pre2.9 versions of OpenSSH
had the above problem.  Connecting to a 2.9 or later sshd with a pre 2.9
ssh also had this problem.  Do you fall in this category?  I tested only
between OpenServer boxes, so can't comment on Linux or others.

Below is a patch to 3.0.2p1 session.c (sshd) which fixes the problem for
me.  Again, I've only tested between two OSR5 boxes.  I'd be interested
to know if it has any adverse affects on a linux (or other) box
connecting to an OSR5 one.

You'll need to either add -DSCO_OSR5 to --with-cflags when you run
configure, or just remove the SCO_OSR5 ifdefs from the patch after
applying it.

Roger


*** Orig/openssh-3.0.2p1/session.c	Sat Dec  1 18:37:08 2001
--- openssh-3.0.2p1/session.c	Wed Jan  2 14:49:06 2002
***************
*** 1622,1627 ****
--- 1622,1634 ----
  {
  	u_int len;
  	int n_bytes;
+ #ifdef SCO_OSR5
+ 	/*
+ 	 * needed only for compatibility w/pre 2.9 openssh versions which
+ 	 * connect to our sshd
+ 	 */
+ 	struct termios tio;
+ #endif /* SCO_OSR5 */
  
  	if (no_pty_flag) {
  		debug("Allocating a pty not permitted for this authentication.");
***************
*** 1679,1684 ****
--- 1686,1710 ----
  
  	packet_done();
  	session_proctitle(s);
+ 
+ #ifdef SCO_OSR5
+ 	/*
+ 	 * needed only for compatibility w/pre 2.9 openssh versions which
+ 	 * connect to our sshd
+ 	 */
+ 	if (tcgetattr(s->ptyfd, &tio) < 0)
+ 		log("Getting tty modes for pty failed: %.100s", strerror(errno));
+ 	else {
+ 		tio.c_lflag |= (ECHO | ISIG | ICANON);
+ 		tio.c_oflag |= (OPOST | ONLCR);
+ 		tio.c_iflag |= ICRNL;
+ 
+ 		/* Set the new modes for the terminal. */
+ 		if (tcsetattr(s->ptyfd, TCSANOW, &tio) < 0)
+ 			log("Setting tty modes for pty failed: %.100s", strerror(errno));
+ 	}
+ #endif /* SCO_OSR5 */
+ 
  	return 1;
  }
  

-- 
Roger Cornelius        rac at tenzing.org



More information about the openssh-unix-dev mailing list