Univention Bugzilla – Bug 41468
UCS@school lib caching of udm objects causes operations to be executed with wrong ldap connection
Last modified: 2016-09-21 18:10:18 CEST
Assume the following snipped: from ucsschool.lib.models import User user = User.from_dn(some_dn, None, ldap_admin_write) user.remove(ldap_user_write) or user = User.from_dn(some_dn, None, ldap_user_write) user.remove(ldap_admin_write) Will remove the object with the ldap_admin_write connection as the cached udm object is used where udm_obj.lo is saved. We need and use such pattern e.g. to make sure the user is only removed if readable from that user but not necessarily writeable/deletable.
ucs-school-lib (9.0.10-1): r69842 | Bug #41468: don't cache udm_object when ldap binddn changes Here is the proof for the fix: >>> import univention.admin.uldap >>> lo1,po=univention.admin.uldap.getMachineConnection() >>> lo2,po=univention.admin.uldap.getAdminConnection() >>> >>> from ucsschool.lib.models import AnyComputer >>> c = AnyComputer.from_dn(lo1.binddn, None, lo1) >>> id(c.get_udm_object(lo1)) 57339216 >>> id(c.get_udm_object(lo1)) 57339216 >>> id(c.get_udm_object(lo2)) 58388816 >>> id(c.get_udm_object(lo2)) 58388816 >>> id(c.get_udm_object(lo1)) 57338576
(In reply to Florian Best from comment #1) > ucs-school-lib (9.0.10-1): > r69842 | Bug #41468: don't cache udm_object when ldap binddn changes > > Here is the proof for the fix: > >>> import univention.admin.uldap > >>> lo1,po=univention.admin.uldap.getMachineConnection() > >>> lo2,po=univention.admin.uldap.getAdminConnection() > >>> > >>> from ucsschool.lib.models import AnyComputer > >>> c = AnyComputer.from_dn(lo1.binddn, None, lo1) > >>> id(c.get_udm_object(lo1)) > 57339216 > >>> id(c.get_udm_object(lo1)) > 57339216 > >>> id(c.get_udm_object(lo2)) > 58388816 > >>> id(c.get_udm_object(lo2)) > 58388816 > >>> id(c.get_udm_object(lo1)) > 57338576 OK: previously cached UDM object is retrieved again from LDAP in case previous and current LDAP connections differ.
UCS@school 4.1 R2 has been released: http://docs.software-univention.de/release-notes-ucsschool-4.1R2v1-de.pdf If this error occurs again, please use "Clone This Bug".