Univention Bugzilla – Bug 48441
udm users/user create traceback when using --set name=foo instead of username=foo
Last modified: 2019-03-27 13:29:27 CET
The error handling of udm cli should be improved: When creating a users/user object and specifying the fantasy property "name" instead of the mandatory property "username" I get this traceback: root@master10:~# udm users/user create --position cn=users,dc=ar41i1,dc=qa \ --set name=user1 \ --set lastname=last1 \ --set password=univention Traceback (most recent call last): File "/usr/share/univention-directory-manager-tools/univention-cli-server", line 218, in doit output = univention.admincli.admin.doit(arglist) File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 395, in doit out = _doit(arglist) File "/usr/lib/pymodules/python2.7/univention/admincli/admin.py", line 741, in _doit dn = object.create() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 536, in create self._ldap_pre_ready() File "/usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py", line 1885, in _ldap_pre_ready self.alloc.append(('uid', univention.admin.allocators.request(self.lo, self.position, 'uid', value=self['username']))) File "/usr/lib/pymodules/python2.7/univention/admin/allocators.py", line 196, in request return acquireUnique(lo, position, type, value, _type2attr[type], scope=_type2scope[type]) File "/usr/lib/pymodules/python2.7/univention/admin/allocators.py", line 174, in acquireUnique univention.admin.locking.lock(lo, position, type, value, scope=scope) File "/usr/lib/pymodules/python2.7/univention/admin/locking.py", line 71, in lock if not lo.get(dn, ['lockTime']): File "/usr/lib/pymodules/python2.7/univention/admin/uldap.py", line 656, in get return self.lo.get(dn, attr, required) File "/usr/lib/pymodules/python2.7/univention/uldap.py", line 273, in get result = self.lo.search_s(dn, ldap.SCOPE_BASE, '(objectClass=*)', attr) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 597, in search_s return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 993, in search_ext_s return self._apply_method_s(SimpleLDAPObject.search_ext_s,*args,**kwargs) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 931, in _apply_method_s return func(self,*args,**kwargs) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 591, in search_ext_s return self.result(msgid,all=1,timeout=timeout)[1] File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 503, in result resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 507, in result2 resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 514, in result3 resp_ctrl_classes=resp_ctrl_classes File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 521, in result4 ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop) File "/usr/lib/python2.7/dist-packages/ldap/ldapobject.py", line 106, in _ldap_call result = func(*args,**kwargs) INVALID_DN_SYNTAX: {'info': 'invalid DN', 'desc': 'Invalid DN syntax'} ## Proof that the udm generally works on my system: root@master10:~# udm users/user create --position cn=users,dc=ar41i1,dc=qa \ --set username=user1 \ --set lastname=last1 \ --set password=univention Object created: uid=user1,cn=users,dc=ar41i1,dc=qa
*** Bug 48244 has been marked as a duplicate of this bug. ***
> /usr/lib/pymodules/python2.7/univention/admin/handlers/users/user.py(1888)_ldap_pre_ready() -> self.alloc.append(('uid', univention.admin.allocators.request(self.lo, self.position, 'uid', value=self['username']))) > /usr/lib/pymodules/python2.7/univention/admin/uldap.py(656)get() -> return self.lo.get(dn, attr, required) (Pdb) dn 'cn=,cn=uid,cn=temporary,cn=univention,dc=school,dc=dev' → This happens when trying to create temporary lock objects. And unfortionately before the code which checks if all required properties are set. Prevented with a simple if self['username']. univention-directory-manager-modules (14.0.12-2) f00c390a9503 | Bug #48441: prevent traceback when not setting --set username= on users/user create
Verified: * Code review * No traceback when creating users/user without username * Advisory
<http://errata.software-univention.de/ucs/4.4/19.html>