Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!tektronix!penguin!richl From: richl@penguin.UUCP Newsgroups: comp.unix.questions Subject: Re: login gripes Message-ID: <10679@tektronix.TEK.COM> Date: Fri, 3-Apr-87 02:37:18 EST Article-I.D.: tektroni.10679 Posted: Fri Apr 3 02:37:18 1987 Date-Received: Sun, 5-Apr-87 02:29:56 EST References: <8703231450.AA18626@ephemeral.ai.toronto.edu> <15831@sun.uucp> <553@westpt.usma.edu> Sender: richl@tektronix.TEK.COM Reply-To: richl@penguin.USS.TEK.COM (Rick Lindsley) Organization: Tektronix, Inc., Beaverton, OR. Lines: 23 In article <553@westpt.usma.edu> bill@westpt.usma.edu (Bill Gunshannon) writes: | Actually what is happening is the password is taken in using a call to | the routine getpass() which reads directly from /dev/tty and not from | the stdin. So anything you typed before getting the Password: prompt | went to the stdin and is not available to that call. I can only assume | this was done to prevent anyone from spoofing login as to who is really | there. The echo goes away because reading from /dev/tty has nothing to do | with the current settings of stty. Some sort of urban myth being spouted here ... when /dev/tty and stdin ARE the same, as during login, reading from either one gets you the same input. Echo is not there because it is explicitly turned off, not because you are reading from /dev/tty. Lastly, input is flushed, as Guy said, because you are changing settings on the terminal. In case there is any question ... this information from direct reading of the source for getpass() and a simple test program which sleeps 5 seconds, opens /dev/tty, and reads one line. You may type all you want, but the first read from /dev/tty will return the very first line you typed -- even though you typed it before it was opened. Rick Lindsley