Date: Mon, 31 Jul 2000 14:38:19 -0400 (EDT) From: Luoqi Chen <luoqi@watermarkgroup.com> To: brdean@unx.sas.com Cc: bde@zeta.org.au, freebsd-arch@FreeBSD.ORG Subject: Re: isatty() reports false results Message-ID: <200007311838.e6VIcJA26725@lor.watermarkgroup.com>
next in thread | raw e-mail | index | archive | help
> The way this section of code gained my attention was when I was > setting up a VPN using ppp over ssh. For example, my setup gets > instantiated using something like this: > > % /usr/local/bin/pty-redir \ > /usr/bin/ssh -t -e none -o 'Batchmode yes' \ > -i $key -l $user $host > ~/vpndev > % /usr/sbin/pppd `cat ~/vpndev` $localip:$remoteip > > In the above, pty-redir allocates a pty, opens the master side of it, > prints out the name of the slave side, dup2()'s the master side as > stdin and stdout, forks off ssh, then exits. This leaves ssh using > the master side as stdin/stdout. On the remote host, the login shell > for $user is just /usr/sbin/pppd. > > The local invocation of pppd uses the slave side of the pty which > talks to the remote side and establishes the connection. > > [This, btw, shows some of the true elegance of Unix - the ability to > chain together several seemingly unrelated processes in order > instantiate a construct that the original authors of the individual > pieces did not necesarily intend or conceive.] > It is a good thing that our system doesn't deceive ssh into thinking that it has a tty and performs ioctls like setting line discipline to normal, which would interfere with pppd's operation. > Where the pty ioctl() code gets involved is with the '-t' option to > ssh. This options causes ssh to request that the remote sshd allocate > a pty for the remote pppd which it seems to need. Ssh wants to > validate that stdin is really a tty before making the request to the > remote side. To do this it calls 'isatty()', which ends up being > called on the master side of a pty pair in this case. > > Perhaps ssh is trying to be smarter than it should be? So based on > your statement above, about pilot error, should the validation check > be removed from 'ssh'? I have no problem with that, assuming we can > maintain this diff or get the contributors to make the same change. > I think ssh should force the acquisition of a pty when the '-t' option is specified (as described in the manual page) and check for isatty() when both '-t' and '-T' are absent. -lq To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200007311838.e6VIcJA26725>