summaryrefslogtreecommitdiff
path: root/sys/lib/python/getpass.py
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:41:36 +0000
committercinap_lenrek <cinap_lenrek@localhost>2011-05-03 11:41:36 +0000
commita118f445d5ab2af18c51287755aaf0e601289521 (patch)
treee67c54da858780e25b7b7616ffeb2f8f86f85763 /sys/lib/python/getpass.py
parent6e0dada472e48291d4a17201f64116d8ec9e4aa0 (diff)
getpass
Diffstat (limited to 'sys/lib/python/getpass.py')
-rw-r--r--sys/lib/python/getpass.py29
1 files changed, 14 insertions, 15 deletions
diff --git a/sys/lib/python/getpass.py b/sys/lib/python/getpass.py
index 6b786122e..7cc0560c7 100644
--- a/sys/lib/python/getpass.py
+++ b/sys/lib/python/getpass.py
@@ -65,11 +65,19 @@ def win_getpass(prompt='Password: ', stream=None):
msvcrt.putch('\n')
return pw
-
def default_getpass(prompt='Password: ', stream=None):
- print >>sys.stderr, "Warning: Problem with getpass. Passwords may be echoed."
- return _raw_input(prompt, stream)
-
+ try:
+ ctl = open("/dev/consctl", "w")
+ ctl.write("rawon")
+ ctl.flush()
+ buf = _raw_input(prompt, stream)
+ ctl.write("rawoff")
+ ctl.flush()
+ ctl.close()
+ return buf;
+ except:
+ buf = _raw_input(prompt, stream)
+ return buf
def _raw_input(prompt="", stream=None):
# A raw_input() replacement that doesn't save the string in the
@@ -79,6 +87,7 @@ def _raw_input(prompt="", stream=None):
prompt = str(prompt)
if prompt:
stream.write(prompt)
+ stream.flush()
line = sys.stdin.readline()
if not line:
raise EOFError
@@ -113,16 +122,6 @@ try:
# McMillan Installer, make sure we have a UNIX-compatible termios
termios.tcgetattr, termios.tcsetattr
except (ImportError, AttributeError):
- try:
- import msvcrt
- except ImportError:
- try:
- from EasyDialogs import AskPassword
- except ImportError:
- getpass = default_getpass
- else:
- getpass = AskPassword
- else:
- getpass = win_getpass
+ getpass = default_getpass
else:
getpass = unix_getpass