mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Fix installutils.get_password without a TTY
If stdin is a TTY, ipaserver.install.installutils uses getpass and all is well. Without a TTY, though, there were two problems: * The prompt was not printed * On end of file, an empty string was returned, which caused read_password to enter an infinite loop. Fix both problems. https://fedorahosted.org/freeipa/ticket/3824
This commit is contained in:
parent
f954f2d1b9
commit
fb08402b71
@ -256,7 +256,13 @@ def get_password(prompt):
|
|||||||
if os.isatty(sys.stdin.fileno()):
|
if os.isatty(sys.stdin.fileno()):
|
||||||
return getpass.getpass(prompt)
|
return getpass.getpass(prompt)
|
||||||
else:
|
else:
|
||||||
return sys.stdin.readline().rstrip()
|
sys.stdout.write(prompt)
|
||||||
|
sys.stdout.flush()
|
||||||
|
line = sys.stdin.readline()
|
||||||
|
if not line:
|
||||||
|
raise EOFError()
|
||||||
|
return line.rstrip()
|
||||||
|
|
||||||
|
|
||||||
def _read_password_default_validator(password):
|
def _read_password_default_validator(password):
|
||||||
if len(password) < 8:
|
if len(password) < 8:
|
||||||
|
Loading…
Reference in New Issue
Block a user