Bug 53653 - groups/group exception during locking of empty mailAddress
groups/group exception during locking of empty mailAddress
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Groups
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0-0-errata
Assigned To: Florian Best
Felix Botner
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-08-12 15:37 CEST by Florian Best
Modified: 2021-09-15 17:41 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2021-08-12 15:37:46 CEST
During the python3 migration of groups/group a if condition had wrong brackets resulting in a traceback during modification if the mailAddress is empty:

Patch:
-               if self['mailAddress'] and not self.exists() or self.hasChanged('mailAddress'):
+               if self['mailAddress'] and (not self.exists() or self.hasChanged('mailAddress')):


Traceback (most recent call last):                                                                                                                                                                                                             
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 442, in get                                                                                                                                                                  
    result = self.lo.search_s(dn, ldap.SCOPE_BASE, '(objectClass=*)', attr)                                                                                                                                                                    
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 852, in search_s                                                                                                                                                              
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)                                                                                                                                           
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 1259, in search_ext_s                                                                                                                                                         
    return self._apply_method_s(SimpleLDAPObject.search_ext_s,*args,**kwargs)                                                                                                                                                                  
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 1197, in _apply_method_s                                                                                                                                                      
    return func(self,*args,**kwargs)                                                                                                                                                                                                           
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 846, in search_ext_s                                                                                                                                                          
    return self.result(msgid,all=1,timeout=timeout)[1]                                                                                                                                                                                         
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 738, in result                                                                                                                                             
    resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout)                                                                                
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 742, in result2                                                                                                          
    resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout)                                                                                                                                                             
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 749, in result3                                                                                                                                                               
    resp_ctrl_classes=resp_ctrl_classes                                                                                                                                                                                                        
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 756, in result4                                                                                                                                                              
    ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)                                                                                                                                     
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 329, in _ldap_call                                                                                                                                                           
    reraise(exc_type, exc_value, exc_traceback)                                                                                                                                                                                                
  File "/usr/lib/python3/dist-packages/ldap/compat.py", line 44, in reraise                                                                                                                                                                   
    raise exc_value                                                                                                                                         
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 313, in _ldap_call                                                                                                                                                           
    result = func(*args,**kwargs)                                                                                                                                                                                                             
ldap.INVALID_DN_SYNTAX: {'desc': 'Invalid DN syntax', 'info': 'invalid DN'}                                                                                                                                                                    
                                                                                                                                                                                                                                              
During handling of the above exception, another exception occurred:  

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 344, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 247, in execute
    function.__func__(self, request, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 181, in _response
    return function(self, request)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/school_umc_ldap_connection.py", line 154, in wrapper_func
    return func(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/management/console/modules/schoolgroups/__init__.py", line 342, in put
    success = group_from_ldap.modify(ldap_machine_write)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 688, in modify
    success = self.modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/group.py", line 268, in modify_without_hooks
    success = super(SchoolClass, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 715, in modify_without_hooks
    self.do_modify(udm_obj, lo)
  File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 750, in do_modify
    udm_obj.modify(ignore_license=1)
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 633, in modify
    self._ldap_pre_ready()
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/groups/group.py", line 444, in _ldap_pre_ready
    self.request_lock('mailPrimaryAddress', self['mailAddress'])
  File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 1691, in request_lock
    value = univention.admin.allocators.request(self.lo, self.position, name, value)
  File "/usr/lib/python3/dist-packages/univention/admin/allocators.py", line 209, in request
    return acquireUnique(lo, position, type, value, _type2attr[type], scope=_type2scope[type])
  File "/usr/lib/python3/dist-packages/univention/admin/allocators.py", line 198, in acquireUnique
    univention.admin.locking.lock(lo, position, type, value.encode('utf-8'), scope=scope)
  File "/usr/lib/python3/dist-packages/univention/admin/locking.py", line 95, in lock
    if not lo.get(dn, ['lockTime']):
  File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 624, in get
    return self.lo.get(dn, attr, required)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 208, in _decorated
    return func(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 442, in get
    result = self.lo.search_s(dn, ldap.SCOPE_BASE, '(objectClass=*)', attr)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 852, in search_s
    return self.search_ext_s(base,scope,filterstr,attrlist,attrsonly,None,None,timeout=self.timeout)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 1259, in search_ext_s
    return self._apply_method_s(SimpleLDAPObject.search_ext_s,*args,**kwargs)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 1197, in _apply_method_s
    return func(self,*args,**kwargs)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 846, in search_ext_s
    return self.result(msgid,all=1,timeout=timeout)[1]
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 738, in result
    resp_type, resp_data, resp_msgid = self.result2(msgid,all,timeout)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 742, in result2
    resp_type, resp_data, resp_msgid, resp_ctrls = self.result3(msgid,all,timeout)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 749, in result3
    resp_ctrl_classes=resp_ctrl_classes
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 756, in result4
    ldap_result = self._ldap_call(self._l.result4,msgid,all,timeout,add_ctrls,add_intermediates,add_extop)
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 329, in _ldap_call
    reraise(exc_type, exc_value, exc_traceback)
  File "/usr/lib/python3/dist-packages/ldap/compat.py", line 44, in reraise
    raise exc_value
  File "/usr/lib/python3/dist-packages/ldap/ldapobject.py", line 313, in _ldap_call
    result = func(*args,**kwargs)
ldap.INVALID_DN_SYNTAX: {'desc': 'Invalid DN syntax', 'info': 'invalid DN'}
Comment 1 Florian Best univentionstaff 2021-08-12 15:38:22 CEST
The invalid DN is `cn=,cn=mailPrimaryAddress,cn=temporary,cn=univention,dc=base`.
Comment 2 Florian Best univentionstaff 2021-08-12 15:42:04 CEST
univention-directory-manager-modules.yaml
ab8933d48004 | Bug #53653: fix modifying groups in certain conditions

univention-directory-manager-modules (15.0.11-15)
ab8933d48004 | Bug #53653: fix modifying groups in certain conditions
Comment 5 Felix Botner univentionstaff 2021-08-18 16:52:57 CEST
OK - univention-directory-manager-modules
OK - yaml
Comment 6 Erik Damrose univentionstaff 2021-09-15 17:41:51 CEST
<https://errata.software-univention.de/#/?erratum=5.0x99>