svn+ssh://pythondev@svn.python.org/python/trunk
........
r76000 | gregory.p.smith | 2009-10-31 14:26:08 -0700 (Sat, 31 Oct 2009) | 7 lines
Fixes issue7208 - getpass would still allow the password to be echoed on
Solaris due to not flushing the input buffer.
This change also incorporates some additional getpass implementation
suggestions for security based on an analysis of getpass.c linked to from the
issue.
........
* Default to using /dev/tty for the password prompt and input before
falling back to sys.stdin and sys.stderr.
* Use sys.stderr instead of sys.stdout.
* print the 'password may be echoed' warning to stream used to display
the prompt rather than always sys.stderr.
* warn() with GetPassWarning when input may be echoed.
Make sure we have a UNIX-compatible termios.
Apparently, McMillan Installer made a termios on windows
which caused unix_getpass() to be used instead of win_getpass().
Will backport.
At import time, getpass will be bound to the appropriate
platform-specific function. If the platform's echo-disabler is not
available, default_getpass, which prints the warning, will be used
Windows. If sys.stdin doesn't appear to be a real file (characterized
by having a working fileno()), don't use any console specific methods
-- go straight to the default.
the tty and the caller can deal with the interrupt.
In the windows version, recognize ^C and raise KeyboardInterrupt (not
sure if this is needed, but can't hurt).