Bug 829

Summary: Don't allocate a tty if -n option is set
Product: Portable OpenSSH Reporter: Ignasi Roca <ignasi.roca>
Component: sshAssignee: OpenSSH Bugzilla mailing list <openssh-bugs>
Status: CLOSED FIXED    
Severity: minor    
Priority: P2    
Version: 3.8p1   
Hardware: All   
OS: All   
Attachments:
Description Flags
Don't allocate tty when -n none

Description Ignasi Roca 2004-04-01 18:33:33 AEST
Hi,

Use of -n option assigns input to /dev/null.
This case should be handled as stdin is not a tty, otherwise "ssh -n <host>" is 
able to open a session, but the session stays blocked because there is nothing 
to be read on the input.
Following patch could be applied:


--- openssh-3.8p1.orig/ssh.c	Wed Dec 17 06:33:11 2003
+++ openssh-3.8p1/ssh.c	Thu Apr  1 09:01:02 2004
@@ -549,7 +549,7 @@
 	if (no_tty_flag)
 		tty_flag = 0;
 	/* Do not allocate a tty if stdin is not a tty. */
-	if (!isatty(fileno(stdin)) && !force_tty_flag) {
+	if ((!isatty(fileno(stdin)) || stdin_null_flag) && !force_tty_flag) {
 		if (tty_flag)
 			logit("Pseudo-terminal will not be allocated because 
stdin is not a terminal.");
 		tty_flag = 0;

--

Cheers,
Ignasi Roca
Fujitsu-Siemens Computers
Comment 1 Damien Miller 2005-04-21 18:05:44 AEST
Created attachment 891 [details]
Don't allocate tty when -n

Please don't paste patches into bugs, they get mangled.
Comment 2 Damien Miller 2005-04-21 21:47:31 AEST
Patch applied, thanks.
Comment 3 Darren Tucker 2006-10-07 11:36:13 AEST
Change all RESOLVED bug to CLOSED with the exception of the ones fixed post-4.4.