Bug 829 - Don't allocate a tty if -n option is set
Summary: Don't allocate a tty if -n option is set
Status: CLOSED FIXED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 3.8p1
Hardware: All All
: P2 minor
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-01 18:33 AEST by Ignasi Roca
Modified: 2006-10-07 11:36 AEST (History)
0 users

See Also:


Attachments
Don't allocate tty when -n (608 bytes, patch)
2005-04-21 18:05 AEST, Damien Miller
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.