sources/ldap: improve ms-ad password complexity checking

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-07-28 12:47:52 +02:00
parent 1b638adf89
commit bc7f84fff4
1 changed files with 11 additions and 9 deletions

View File

@ -105,9 +105,11 @@ class LDAPPasswordChanger:
if len(user_attributes["sAMAccountName"]) >= 3:
if password.lower() in user_attributes["sAMAccountName"].lower():
return False
display_name_tokens = split(
RE_DISPLAYNAME_SEPARATORS, user_attributes["displayName"]
)
# No display name set, can't check any further
if len(user_attributes["displayName"]) < 1:
return True
for display_name in user_attributes["displayName"]:
display_name_tokens = split(RE_DISPLAYNAME_SEPARATORS, display_name)
for token in display_name_tokens:
# Ignore tokens under 3 chars
if len(token) < 3: