Univention Bugzilla – Bug 41829
modifying boolean extended attribute writes '0' value to ldap
Last modified: 2019-08-29 12:24:46 CEST
A regression since Bug #41207 http://errata.software-univention.de/ucs/4.1/199.html causes that when modifying a extended attribute property with a 'boolean' syntax the value '0' is written to LDAP. prior to this the attribute was removed from the entry.
Added a test case which is currently skipped. ucs-test (6.0.35-7): r71127 | Bug #41829: add 68_udm-extendedattribute/38_extended_attribute_boolean_syntax
Ticket#2016072021000505
Created attachment 7820 [details] patch The patch moves the ungeneric handling of boolean extended attributes into the mapping functions.
This change in behavior broke usersert (Ticket #2016072521000461)
univention-directory-manager-modules (11.0.3-29): r71612 | Bug #41829: don't write 0 value to LDAP for boolean extended attributes univention-directory-manager-modules.yaml: r71615 | YAML Bug #41824 Bug #41829 Bug #41899 UCS 4.2: univention-directory-manager-modules (12.0.1-1): r71609 | Bug #41829: don't write 0 value to LDAP for boolean extended attributes
Code review: OK YAML: OK ucs-test: OK Tests: OK, I was able to reproduce it with the old version. (In reply to Florian Best from comment #1) > Added a test case which is currently skipped. > > ucs-test (6.0.35-7): > r71127 | Bug #41829: add > 68_udm-extendedattribute/38_extended_attribute_boolean_syntax I've re-enabled the test case: r71667 + r71668
As discussed, the test case 62_udm-groups.22_group_posix_only.test fails now: [2016-08-17 16:17:12.219469] Creating groups/group object with /usr/sbin/udm-test groups/group create --position cn=groups,dc=AutoTest221,dc=local --option posix --set name=qb36eqpivb [2016-08-17 16:17:14.158189] . Cleanup after exception: <class 'univention.testing.utils.LDAPObjectUnexpectedValue'> DN: cn=qb36eqpivb,cn=groups,dc=AutoTest221,dc=local [2016-08-17 16:17:14.158253] objectClass: ['univentionVirtualMachineGroupOC', 'top', 'univentionGroup', 'posixGroup', 'univentionObject'], unexpected: 'univentionVirtualMachineGroupOC' [2016-08-17 16:17:14.158320] Performing UCSTestUDM cleanup... [2016-08-17 16:17:14.363754] UCSTestUDM cleanup done (2016-08-17 16:17:14.363791) Traceback (most recent call last): (2016-08-17 16:17:14.363805) File "22_group_posix_only", line 17, in <module> (2016-08-17 16:17:14.363819) utils.verify_ldap_object(group, {'objectClass': ['top', 'posixGroup', 'univentionGroup', 'univentionObject']}) (2016-08-17 16:17:14.363833) File "/usr/lib/pymodules/python2.7/univention/testing/utils.py", line 160, in verify_ldap_object (2016-08-17 16:17:14.363847) raise LDAPObjectUnexpectedValue('DN: %s\n%s: %r, unexpected: \'%s\'' % (baseDn, attribute, list(found_values), '\', '.join(difference))) (2016-08-17 16:17:14.363860) univention.testing.utils.LDAPObjectUnexpectedValue: DN: cn=qb36eqpivb,cn=groups,dc=AutoTest221,dc=local (2016-08-17 16:17:14.363872) objectClass: ['univentionVirtualMachineGroupOC', 'top', 'univentionGroup', 'posixGroup', 'univentionObject'], unexpected: 'univentionVirtualMachineGroupOC'
univention-directory-manager-modules (11.0.3-30): r71706 | Bug #41829: don't add object class of '0' values for extended attributes with boolean syntax univention-directory-manager-modules (12.0.1-2): r71707 | Bug #41829: ignore '0' values for extended attributes with boolean syntax In self.info there is still the value '0' for these properties. The check was done against the property values instead if the ldap attribute values. Therefore I reimplemented part of the old workaround. A better patch would be the following (but currently I don't dare this change because there might be side effects on unmapped attributes, I will have a look some other day): diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py index 042ad0a..c9ca240 100644 --- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py +++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py @@ -689 +689 @@ def _create(self): - if self.has_key(prop.name) and self.info.get(prop.name): + if self.has_key(prop.name) and _MergedAttributes(self, al).get_attribute(self.mapping.mapName(prop.name)): @@ -800 +800 @@ def _ldap_object_classes(self, ml): - if self.has_key(prop.name) and self.info.get(prop.name) and (True if prop.syntax != 'boolean' else self.info.get(prop.name) != '0'): + if self.has_key(prop.name) and _MergedAttributes(self, ml).get_attribute(self.mapping.mapName(prop.name)):
OK, it looks good. The test case works now.
<http://errata.software-univention.de/ucs/4.1/235.html>