summaryrefslogtreecommitdiffstats
path: root/ipaserver/install
diff options
context:
space:
mode:
authorJohn Dennis <jdennis@redhat.com>2012-08-17 15:34:40 -0400
committerAlexander Bokovoy <abokovoy@redhat.com>2012-08-22 17:23:20 +0300
commit6cad0d05405d4dc3e943dec8c53a8ec67eee5c41 (patch)
treeaba469ed83ddcbe8631b2f148e3bd456bb00089e /ipaserver/install
parent88f358fdcfea2029a307caa3deb3ea842c6394b6 (diff)
downloadfreeipa.git-6cad0d05405d4dc3e943dec8c53a8ec67eee5c41.tar.gz
freeipa.git-6cad0d05405d4dc3e943dec8c53a8ec67eee5c41.tar.xz
freeipa.git-6cad0d05405d4dc3e943dec8c53a8ec67eee5c41.zip
Ticket #3008: DN objects hash differently depending on case
Because the attrs & values in DN's, RDN's and AVA's are comparison case- insensitive the hash value between two objects which compare as equal but differ in case must also yield the same hash value. This is critical when these objects are used as a dict key or in a set because dicts and sets use the object's __hash__ value in conjunction with the objects __eq__ method to lookup the object. The defect is the DN, RDN & AVA objects computed their hash from the case- preserving string representation thus two otherwise equal objects incorrectly yielded different hash values. The problem manifests itself when one of these objects is used as a key in a dict, for example a dn. dn1 = DN(('cn', 'Bob')) dn2 = DN(('cn', 'bob')) dn1 == dn2 --> True hash(dn1) == hash(dn2) --> False d = {} d[dn1] = x d[dn2] = y len(d) --> 2 The patch fixes the above by lower casing the string representation of the object prior to computing it's hash. The patch also corrects a spelling mistake and a bogus return value in ldapupdate.py which happened to be discovered while researching this bug.
Diffstat (limited to 'ipaserver/install')
-rw-r--r--ipaserver/install/ldapupdate.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipaserver/install/ldapupdate.py b/ipaserver/install/ldapupdate.py
index a51edff9..d673ad57 100644
--- a/ipaserver/install/ldapupdate.py
+++ b/ipaserver/install/ldapupdate.py
@@ -265,7 +265,7 @@ class LDAPUpdate:
if not all_updates.get(dn):
all_updates[dn] = update
- return all_updates
+ return
existing_update = all_updates[dn]
if 'default' in update: