path: root/ipaserver
diff options
authorAlexander Bokovoy <>2011-06-27 15:08:13 +0300
committerRob Crittenden <>2011-06-27 23:03:23 -0400
commit716a25a784b4257ef4928afc18b6cebdb7d15e54 (patch)
tree5ab2602982249aedb8743c9d16727b6c3d42281f /ipaserver
parentf1e1223bd9c358367baac96ac7d6843edb56c5f6 (diff)
Convert Bool to TRUE/FALSE when working with LDAP backend
According to RFC4517 the only valid values for a boolean in LDAP are TRUE or FALSE. This commit adds support to recognize TRUE and FALSE as valid Bool constants when converting from LDAP attribute values and enforces TRUE or FALSE string for account locking.
Diffstat (limited to 'ipaserver')
1 files changed, 5 insertions, 2 deletions
diff --git a/ipaserver/plugins/ b/ipaserver/plugins/
index c375252..5d6d21d 100644
--- a/ipaserver/plugins/
+++ b/ipaserver/plugins/
@@ -522,7 +522,7 @@ class ldap2(CrudBackend, Encoder):
scope=_ldap.SCOPE_SUBTREE, time_limit=None, size_limit=None,
normalize=True, search_refs=False):
- Return a list of entries and indication of whteher the results where
+ Return a list of entries and indication of whether the results were
truncated ([(dn, entry_attrs)], truncated) matching specified search
parameters followed by truncated flag. If the truncated flag is True,
search hit a server limit and its results are incomplete.
@@ -1056,7 +1056,10 @@ class ldap2(CrudBackend, Encoder):
if account_lock_attr == 'true':
raise errors.AlreadyInactive()
- account_lock_attr = str(not active)
+ # LDAP expects string instead of Bool but it also requires it to be TRUE or FALSE,
+ # not True or False as Python stringification does. Thus, we uppercase it.
+ account_lock_attr = str(not active).upper()
entry_attrs['nsaccountlock'] = account_lock_attr
self.update_entry(dn, entry_attrs)