From dd119f8aadb13e95e4db43053bc36c70977b001e Mon Sep 17 00:00:00 2001 From: Martin Basti Date: Tue, 7 Feb 2017 19:24:46 +0100 Subject: [PATCH] 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 --- ipapython/ipautil.py | 2 ++ 1 file changed, 2 insertions(+) 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']