summaryrefslogtreecommitdiffstats
path: root/ipapython/ipautil.py
diff options
context:
space:
mode:
authorMartin Basti <mbasti@redhat.com>2017-02-07 19:24:46 +0100
committerJan Cholasta <jcholast@redhat.com>2017-02-10 14:03:04 +0100
commitdd119f8aadb13e95e4db43053bc36c70977b001e (patch)
tree9bae3f8bc837cf4bcec7bcb0cadc6e01f30ef9a7 /ipapython/ipautil.py
parent69072cb80f8c4b7f6eff0c7cdfe6545fe59ea7b5 (diff)
downloadfreeipa-dd119f8aadb13e95e4db43053bc36c70977b001e.tar.gz
freeipa-dd119f8aadb13e95e4db43053bc36c70977b001e.tar.xz
freeipa-dd119f8aadb13e95e4db43053bc36c70977b001e.zip
py3: ipa_generate_password: do not compare None and Int
The one cannot compare None and Int in Py3 """ unorderable types: NoneType() > int() """ Continue when class is disabled with None value https://fedorahosted.org/freeipa/ticket/4985 Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipapython/ipautil.py')
-rw-r--r--ipapython/ipautil.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/ipapython/ipautil.py b/ipapython/ipautil.py
index c810adcd3..60b4a37fe 100644
--- a/ipapython/ipautil.py
+++ b/ipapython/ipautil.py
@@ -860,6 +860,8 @@ def ipa_generate_password(entropy_bits=256, uppercase=1, lowercase=1, digits=1,
for charclass_name in ['digits', 'uppercase', 'lowercase', 'special']:
charclass = pwd_charsets[charclass_name]
todo_characters = req_classes[charclass_name]
+ if todo_characters is None:
+ continue
while todo_characters > 0:
password += rnd.choice(charclass['chars'])
todo_entropy -= charclass['entropy']