diff options
author | Jan Cholasta <jcholast@redhat.com> | 2011-09-26 08:27:01 +0200 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2011-10-04 20:12:58 -0400 |
commit | 209bcb0b98daf7edbea2c7428f6fe5f109e74e49 (patch) | |
tree | 97027dc57e041c01f815e687e08c2f84c4466e2f /ipaserver/install/installutils.py | |
parent | 3fb40170cb70a87515ec9d3466099fa3417a4086 (diff) | |
download | freeipa.git-209bcb0b98daf7edbea2c7428f6fe5f109e74e49.tar.gz freeipa.git-209bcb0b98daf7edbea2c7428f6fe5f109e74e49.tar.xz freeipa.git-209bcb0b98daf7edbea2c7428f6fe5f109e74e49.zip |
Work around pkisilent bugs.
Check directory manager password and certificate subject base for
invalid characters.
(https://bugzilla.redhat.com/show_bug.cgi?id=658641)
Shell-escape pkisilent command-line arguments.
(https://bugzilla.redhat.com/show_bug.cgi?id=741180)
ticket 1636
Diffstat (limited to 'ipaserver/install/installutils.py')
-rw-r--r-- | ipaserver/install/installutils.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index 345bf06b..6ae117cb 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -313,7 +313,11 @@ def get_password(prompt): else: return sys.stdin.readline().rstrip() -def read_password(user, confirm=True, validate=True, retry=True): +def _read_password_default_validator(password): + if len(password) < 8: + raise ValueError("Password must be at least 8 characters long") + +def read_password(user, confirm=True, validate=True, retry=True, validator=_read_password_default_validator): correct = False pwd = "" while not correct: @@ -322,10 +326,13 @@ def read_password(user, confirm=True, validate=True, retry=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 validate: + try: + validator(pwd) + except ValueError, e: + print str(e) + pwd = "" + continue if not confirm: correct = True continue |