Fix directory manager password validation in ipa-nis-manage.

ticket 1283, 1284
This commit is contained in:
Jan Cholasta
2011-06-08 14:39:50 +02:00
committed by Martin Kosek
parent 645e55651e
commit d2b483cbb3
2 changed files with 13 additions and 3 deletions

View File

@@ -288,15 +288,18 @@ def get_password(prompt):
else:
return sys.stdin.readline().rstrip()
def read_password(user, confirm=True, validate=True):
def read_password(user, confirm=True, validate=True, retry=True):
correct = False
pwd = ""
while not correct:
if not retry:
correct = True
pwd = get_password(user + " password: ")
if not pwd:
continue
if validate and len(pwd) < 8:
print "Password must be at least 8 characters long"
pwd = ""
continue
if not confirm:
correct = True
@@ -305,6 +308,7 @@ def read_password(user, confirm=True, validate=True):
if pwd != pwd_confirm:
print "Password mismatch!"
print ""
pwd = ""
else:
correct = True
print ""