Univention Bugzilla – Bug 43420
univention.uldap.access.getAttr() is not case sensitive aware
Last modified: 2020-06-22 17:10:14 CEST
>>> import univention.uldap >>> lo = univention.uldap.getMachineConnection() >>> lo.getAttr(lo.lo.whoami_s()[3:], 'entrydn', required=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.7/univention/uldap.py", line 280, in getAttr raise ldap.NO_SUCH_OBJECT({'desc': 'no object'}) ldap.NO_SUCH_OBJECT: {'desc': 'no object'} >>> lo.getAttr(lo.lo.whoami_s()[3:], 'entryDN', required=True) ['cn=xen7,cn=dc,cn=computers,dc=school,dc=local'] So to use the function one must know what the LDAP server returns. (openLDAP returns the normalized form. Aliases are also affected: >>> lo.getAttr(lo.lo.whoami_s()[3:], 'CN', required=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.7/univention/uldap.py", line 280, in getAttr raise ldap.NO_SUCH_OBJECT({'desc': 'no object'}) ldap.NO_SUCH_OBJECT: {'desc': 'no object'} >>> lo.getAttr(lo.lo.whoami_s()[3:], 'commonName', required=True) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.7/univention/uldap.py", line 280, in getAttr raise ldap.NO_SUCH_OBJECT({'desc': 'no object'}) ldap.NO_SUCH_OBJECT: {'desc': 'no object'} >>> lo.get(lo.lo.whoami_s()[3:], ['commonName'], required=True) {'cn': ['xen7']}
Another thing: univention.uldap.access.getAttr() raises ldap.NO_SUCH_OBJECT if the object exists but only the attribute is missing.