[Bug 1273] Interactive mode detection should not be predicated on pty allocation

bugzilla-daemon at mindrot.org bugzilla-daemon at mindrot.org
Sat Jan 6 05:14:21 EST 2007


http://bugzilla.mindrot.org/show_bug.cgi?id=1273

           Summary: Interactive mode detection should not be predicated on
                    pty allocation
           Product: Portable OpenSSH
           Version: v4.5p1
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: sftp-server
        AssignedTo: bitbucket at mindrot.org
        ReportedBy: jcaruso at arenasolutions.com


When you ssh to a host specifying a command but no -t it shows only the
command output:

   $ ssh myhost date
   me at myhost's password:
   Thu Jan  4 19:25:11 PST 2007
   $

But if you specify -t (to allocate a pseudo-TTY) along with a command,
it erroneously prints a "Connection to <hostname> closed" message after
the command output:

   $ ssh -t myhost date
   me at myhost's password:
   Thu Jan  4 19:25:16 PST 2007
   Connection to myhost closed.
   $

In looking through the code, this is happening because the
determination of whether or not we're in "interactive mode" is closely
associated with whether or not a pty is being allocated.  However, the
-T/-t options make it possible both to 1) have an interactive session
without a pty and 2) have a non-interactive session with a pty.  Though
I can't think of a use for the first, the second is quite useful if the
remote command is something that prompts the user (e.g. passwd).

The printing of the "Connection to <host> closed." message should be be
predicated on whether or not the session is truly interactive (perhaps
using a test of buffer_len(&command)==0 as is used elsewhere in ssh.c),
and not on the allocation of a pty.  My only real concern here is the
"Connection to <host> closed." message, though; if that can be fixed to
happen only on truly interactive sessions, I'd be happy.




------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the openssh-bugs mailing list