Commit Graph

21 Commits

Author SHA1 Message Date
Senthil Kumaran 83627ed6d5 issue11236 getpass.getpass to respond ctrl-c or ctrl-z 2011-04-26 21:02:26 +08:00
Gregory P. Smith 29b5365f69 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.
2009-10-31 21:26:08 +00:00
Benjamin Peterson 4d714cbbf1 kill bare except 2009-09-17 02:46:54 +00:00
Gregory P. Smith 19b4411181 Major improvements:
* 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.
2008-04-22 08:08:41 +00:00
Gregory P. Smith 41e3018336 If sys.stdin is not a tty, fall back to default_getpass after printing
a warning instead of failing with a termios.error.
2008-04-21 21:31:08 +00:00
Georg Brandl 338ef7d2bd Bug #1445068: getpass.getpass() can now be given an explicit stream
argument to specify where to write the prompt.
2006-03-31 18:42:16 +00:00
Neal Norwitz 201626e00f Fix SF #640094, on win32 getpass runs into unix_getpass
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.
2002-11-20 23:15:54 +00:00
Guido van Rossum 60250e2859 win_getpass(): if sys.stdin is not sys.__stdin__, use
default_getpass().  This should prevent hanging when it is called in
IDLE.

Fixes SF bug #455648.
2001-08-30 15:07:44 +00:00
Guido van Rossum f9f48812d0 Remove two redundant statements (PyChecker). 2001-08-13 15:30:22 +00:00
Fred Drake 1191d0148f Get the needed constants from termios, not TERMIOS. 2001-02-27 21:23:31 +00:00
Skip Montanaro eccd02a40d more __all__ updates 2001-01-20 23:34:12 +00:00
Tim Peters 07e99cb774 Whitespace normalization. 2001-01-14 23:47:14 +00:00
Guido van Rossum 98d9fd3e68 Simple changes by Gerrit Holl - move author acknowledgements out of
docstrings into comments.
2000-02-28 15:12:25 +00:00
Jeremy Hylton 88d23309e9 print a warning if the password will be echoed.
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
1999-10-18 22:25:22 +00:00
Guido van Rossum c731723730 Mod by Jack Jansen: on Macintosh, use EasyDialogs.GetPassword if it
exists.
1999-02-11 14:41:46 +00:00
Guido van Rossum 0238a25b20 Do the check for lacking sys.stdin.fileno() *before* testing for
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.
1998-09-22 02:38:42 +00:00
Guido van Rossum ef0056ae1a When sys.stdin.fileno() doesn't work, fall back to default_getpass()
-- don't just die.
1998-09-21 20:00:35 +00:00
Guido van Rossum 1a7bab05e8 Don't use raw_input() to ask for the password; this puts the password
in the GNU readline history buffer which is not such a great idea.
1998-07-28 19:28:43 +00:00
Guido van Rossum c3da02e904 Don't catch interrupts in getpass() -- the finally clause will reset
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).
1998-06-12 14:28:38 +00:00
Guido van Rossum fb9b7fd5ee Be nicer to systems that have neither termios nor msvcrt. 1998-04-13 20:22:21 +00:00
Guido van Rossum b5903ac9fb Another new utility: getpass() prompts for a password, with echo off.
Also contains getuser(), which returns the username (not prompting though).
These work on Unix and Windows!
1998-04-09 20:37:16 +00:00