summaryrefslogtreecommitdiffstats
path: root/.tx
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:12 +0300
commit1328f984d060b944fb8734a51edc0946cd42bbb3 (patch)
treeaba469ed83ddcbe8631b2f148e3bd456bb00089e /.tx
parentf397db79dd87089cee16a53226b6918c468ef99d (diff)
downloadfreeipa-1328f984d060b944fb8734a51edc0946cd42bbb3.tar.gz
freeipa-1328f984d060b944fb8734a51edc0946cd42bbb3.tar.xz
freeipa-1328f984d060b944fb8734a51edc0946cd42bbb3.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 '.tx')
0 files changed, 0 insertions, 0 deletions