Univention Bugzilla – Bug 54362
UDM developer docs wrong regarding addlist modlist contents
Last modified: 2022-01-21 10:50:14 CET
I'm developing an UDM hook that shall fire on user creation. While testing, sometimes the creation failed with error: Failed to create LDAP object: ldapError: Object class violation: no structural object class provided Trying to debug if my hook made something wrong, I reduced the Addlist hook to simply print out the current addlist. It shows two elements with the attribute name 'objectClass': 20.01.22 14:07:34.465 ADMIN ( INFO ) : autoExpire: addlist: [ ... ('objectClass', b'', b'automount') ... ('objectClass', [b'sambaSamAccount', b'inetOrgPerson', b'univentionPWHistory', b'person', b'top', b'krb5Principal', b'shadowAccount', b'organizationalPerson', b'univentionMail', b'posixAccount', b'krb5KDCEntry']), ... ] Whenever the 'automount' stanza arrives last -> user creation fails. This occurs randomly.
So the bug occurs with your hook enabled? Please attach it here then. a addlsit/modlist containing "objectClass" multiple times is valid - they should get merged at the end.
So my assumption was wrong: that there must be only one occurrence of an attribute in this list (docs in https://docs.software-univention.de/developer-reference-5.0.html#udm:hook do not state it explcitly). -- I'll fix that. Two related questions: is the addlist hook required to handle: * mixed lists of two-tuples and three-tuples (docs say: addlist consists only of two-tuples) * mixed data types of values, here: sometimes string, sometimes array of strings (docs say "list_of_values") Either UDM should adhere to documented behaviour, or docs are wrong. Please advise.
(In reply to Frank Greif from comment #2) > So my assumption was wrong: that there must be only one occurrence of an > attribute in this list (docs in > https://docs.software-univention.de/developer-reference-5.0.html#udm:hook do > not state it explcitly). -- I'll fix that. yep > Two related questions: is the addlist hook required to handle: > > * mixed lists of two-tuples and three-tuples (docs say: addlist consists > only of two-tuples) Unfortionately yes, because the addlist always also contains the modlist which is a 3-tuple. The docs are wrong here. > * mixed data types of values, here: sometimes string, sometimes array of > strings (docs say "list_of_values") Yes, the addlist contains mixed types and it is essential to correctly interpret the values. The docs are wrong here. > Either UDM should adhere to documented behaviour, or docs are wrong. Please > advise. We should precise the docs.