Bug 44389 - creating computer causes IndexError: list index out of range
creating computer causes IndexError: list index out of range
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Computers
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.3-0-errata
Assigned To: Dirk Wiesenthal
Johannes Keiser
:
: 44239 (view as bug list)
Depends on:
Blocks: 46844
  Show dependency treegraph
 
Reported: 2017-04-18 12:20 CEST by Florian Best
Modified: 2018-08-01 16:46 CEST (History)
4 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.343
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number: 2018040521000885, 2018052821002151, 2018052321000331, 2018012921000131, 2017100321000075, 2017100421000519, 2017041221000202, 2017042921000127, 2017050421000592, 2017082221000731, 2017082421000754, 2017082521000609, 2017082521000636
Bug group (optional): External feedback
Max CVSS v3 score:
best: Patch_Available+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2017-04-18 12:20:45 CEST
Version: 4.2-0 errata0 (Lesum)

Remark: Einen PC unter Netzwerk-Einstellungen ein Netzwerk zugeordnet. Netzwerk wurde vorher angelegt.

Die Ausführung des Kommandos udm/put computers/computer ist fehlgeschlagen:
Traceback (most recent call last):
  File "%PY2.7%/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "%PY2.7%/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 406, in _thread
    module.modify(properties)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 86, in _decorated
    return method(*args, **kwargs)
  File "%PY2.7%/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 445, in modify
    obj.modify()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 318, in modify
    return self._modify(modify_childs, ignore_license=ignore_license)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 814, in _modify
    self._ldap_post_modify()
  File "%PY2.7%/univention/admin/handlers/computers/windows.py", line 512, in _ldap_post_modify
    univention.admin.handlers.simpleComputer._ldap_post_modify(self)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 2001, in _ldap_post_modify
    zoneIsV6 = explode_dn(x, 1)[0].endswith('.ip6.arpa')
IndexError: list index out of range
Comment 1 Florian Best univentionstaff 2017-05-05 15:38:13 CEST
Version: 4.2-0 errata4 (Lesum)

Remark: wollte IP-Adresse ändern
Comment 2 Florian Best univentionstaff 2017-08-18 15:29:54 CEST
It seems in UDM-UMC the syntax classes aren't checked while via UDM-CLI they are.

Reproducer:

curl 'http://Administrator:univention@xen3.school.local/univention/command/udm/put' -H 'Accept-Language: de-DE' -H 'Content-Type: application/json' -H 'Accept: application/json; q=1.0, text/html; q=0.3; */*; q=0.1' --data-binary '{"options":[{"object":{"ip":["192.168.0.4"],"dnsEntryZoneForward":[["zoneName=school.local,cn=dns,dc=school,dc=local","192.168.0.4"]],"dnsEntryZoneReverse":[["","192.168.0.4"]],"$dn$":"cn=member,cn=computers,dc=school,dc=local"},"options":null}],"flavor":"computers/computer"}'

# udm computers/memberserver modify --dn cn=member,dc=school,dc=local --set ip=10.200.27.222 --append dnsEntryZoneReverse='"" "192.168.0.4"'
Invalid syntax: dnsEntryZoneReverse: Not a valid LDAP DN
Comment 3 Florian Best univentionstaff 2017-08-18 18:00:13 CEST
The syntax class "dnsEntryReverse" and "DNS_ReverseZone" currently allow empty values to be set.

The behavior of the UDM-CLI and UDM-UMC differ:
   263 »   »   »   elif univention.admin.syntax.is_syntax(module.property_descriptions[key].syntax, univention.admin.syntax.complex):
→ There is a special case for complex syntaxes. All empty strings are stripped from the list.
   279 »   »   »   »   »   »   object[key] = [val]
→ This results in the valueError exception here because val is ['192.168.0.4'] instead of ['', '192.168.0.4']. Therefore the subsyntax checks if '192.168.0.4' is a valid LDAP DN.
So the UDM-CLI fails by accident.

And UMC checks the syntax more correctly but the value is accepted as valid:
>>> univention.admin.syntax.dnsEntryReverse.parse([['', '192.168.0.4']][0])
['', '192.168.0.4']
Comment 4 Florian Best univentionstaff 2017-08-18 18:19:30 CEST
Imho _map_properties() (UMC) and object_input() (CLI) should nearly do the same.
Comment 5 Florian Best univentionstaff 2017-08-23 11:55:12 CEST
*** Bug 44239 has been marked as a duplicate of this bug. ***
Comment 6 Florian Best univentionstaff 2017-08-23 11:57:03 CEST
Die Ausführung des Kommandos udm/put computers/computer ist fehlgeschlagen:
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 406, in _thread
    module.modify(properties)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 86, in _decorated
    return method(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 445, in modify
    obj.modify()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 318, in modify
    return self._modify(modify_childs, ignore_license=ignore_license)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 793, in _modify
    self._ldap_pre_modify()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/computers/linux.py", line 508, in _ldap_pre_modify
    univention.admin.handlers.simpleComputer._ldap_pre_modify(self)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 2249, in _ldap_pre_modify
    self.check_common_name_length()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 1691, in check_common_name_length
    zoneName = univention.admin.uldap.explodeDn(zone[0], 1)[0]
IndexError: list index out of range
Comment 7 Florian Best univentionstaff 2017-08-23 12:01:22 CEST
(In reply to Florian Best from comment #6)
To reproduce the traceback, create a network object with only a network address and a subnet mask defined.

udm networks/network create --set network=10.200.27.0 --set netmask=24 --set name=test

Then create a computer object via UMC and assign the network object to the computer object. UMC sets a IP address but no reverse zone.

curl 'http://Administrator:univention@10.200.27.130/univention/command/udm/add' -H 'Content-Type: application/json' -H 'Accept: application/json; q=1.0, text/html; q=0.3; */*; q=0.1' --data-binary '{"options":[{"object":{"ip":["10.200.27.4"],"network":"cn=test,dc=school,dc=local","unixhome":"/dev/null","shell":"/bin/bash","primaryGroup":"cn=Computers,cn=groups,dc=school,dc=local","dnsEntryZoneForward":[["","10.200.27.4"]],"name":"test3","dnsEntryZoneReverse":[["","10.200.27.4"]],"$options$":{"kerberos":true,"nagios":false,"posix":true,"samba":true},"$policies$":{}},"options":{"container":"cn=computers,dc=school,dc=local","objectType":"computers/linux","objectTemplate":"None"}}],"flavor":"computers/computer"}'
Comment 8 Florian Best univentionstaff 2017-08-29 14:15:50 CEST
Reported 3 times again, Version: 4.2-1 errata144 (Lesum)
Comment 10 Florian Best univentionstaff 2017-10-12 20:24:42 CEST
Version: 4.2-2 errata189 (Lesum) - UCS@school 4.2 v3
Comment 11 Florian Best univentionstaff 2017-10-12 20:32:47 CEST
Version: 4.2-2 errata189 (Lesum)
Comment 12 Florian Best univentionstaff 2017-11-20 12:32:38 CET
A draft for a patch has been implemented in fbest/44389-creating-computer-causes-index-error. The patch fixes the syntax validation of some required fields. Additionally it fixes the UDM CLI complex syntax validation so that it behaves like UMC does.
Comment 13 Johannes Keiser univentionstaff 2018-02-16 12:32:41 CET
Reported again: Version: 4.2-3 errata262 (Lesum) - UCS@school 4.2 v6

Remark: on ipv6 address was configured, the mac removed, the reverse zone emptied, IPv4s set to ***
Comment 14 Dirk Wiesenthal univentionstaff 2018-04-06 11:35:14 CEST
dnsEntry and dnsEntryReverse may not have empty DNS_ReverseZone or DNS_ForwardZone anymore.
Comment 15 Florian Best univentionstaff 2018-04-09 12:00:00 CEST
(In reply to Florian Best from comment #12)
> A draft for a patch has been implemented in
> fbest/44389-creating-computer-causes-index-error. The patch fixes the syntax
> validation of some required fields. Additionally it fixes the UDM CLI
> complex syntax validation so that it behaves like UMC does.

It seems your patch does the same as mine except that the CLI-fix is not applied. We should clone this bug then.
Comment 16 Johannes Keiser univentionstaff 2018-04-17 18:40:08 CEST
OK The reverse/forward zone on an DNS entry of a computer can not be empty
-> verified

Cloning Bug for CLI fix
Comment 17 Arvid Requate univentionstaff 2018-04-18 13:51:55 CEST
<http://errata.software-univention.de/ucs/4.3/13.html>
Comment 18 Johannes Keiser univentionstaff 2018-05-25 18:16:59 CEST
Reported again: Version: 4.2-3 errata418 (Lesum)

Internal server error during "udm/add (computers/computer)".
Request: udm/add (computers/computer)

Traceback (most recent call last):
  File "%PY2.7%/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "%PY2.7%/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 369, in _thread
    dn = module.create(properties, container=options.get('container'), superordinate=options.get('superordinate'))
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 82, in _decorated
    return method(*args, **kwargs)
  File "%PY2.7%/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 393, in create
    obj.create()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 381, in create
    dn = self._create(response=response, serverctrls=serverctrls)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 986, in _create
    self._ldap_pre_create()
  File "%PY2.7%/univention/admin/handlers/computers/linux.py", line 393, in _ldap_pre_create
    super(object, self)._ldap_pre_create()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 2539, in _ldap_pre_create
    self.check_common_name_length()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 1984, in check_common_name_length
    zoneName = univention.admin.uldap.explodeDn(zone[0], 1)[0]
IndexError: list index out of range
Comment 19 Johannes Keiser univentionstaff 2018-07-16 15:46:29 CEST
Reported again: 
Version: 4.2-3 errata418 (Lesum)

Internal server error during "udm/put (computers/computer)".
Request: udm/put (computers/computer)

Traceback (most recent call last):
  File "%PY2.7%/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "%PY2.7%/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 407, in _thread
    module.modify(properties)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 82, in _decorated
    return method(*args, **kwargs)
  File "%PY2.7%/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 453, in modify
    obj.modify()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 419, in modify
    dn = self._modify(modify_childs, ignore_license=ignore_license, response=response)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 1067, in _modify
    self._ldap_pre_modify()
  File "%PY2.7%/univention/admin/handlers/computers/windows.py", line 526, in _ldap_pre_modify
    univention.admin.handlers.simpleComputer._ldap_pre_modify(self)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 2542, in _ldap_pre_modify
    self.check_common_name_length()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 1984, in check_common_name_length
    zoneName = univention.admin.uldap.explodeDn(zone[0], 1)[0]
IndexError: list index out of range

Role: domaincontroller_master
Comment 20 Johannes Keiser univentionstaff 2018-08-01 16:46:15 CEST
External feedback:
UCS Version: 4.3-0 errata11 (Neustadt)

Interner Server-Fehler in "udm/put (computers/computer)".
Request: udm/put (computers/computer)

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.7/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/__init__.py", line 407, in _thread
    module.modify(properties)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 83, in _decorated
    return method(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/ldap.py", line 143, in _decorated
    result = func(*args, **kwargs)
  File "/usr/lib/pymodules/python2.7/univention/management/console/modules/udm/udm_ldap.py", line 454, in modify
    obj.modify()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 526, in modify
    dn = self._modify(modify_childs, ignore_license=ignore_license, response=response)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 1076, in _modify
    self._ldap_post_modify()
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/computers/windows.py", line 512, in _ldap_post_modify
    univention.admin.handlers.simpleComputer._ldap_post_modify(self)
  File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 2316, in _ldap_post_modify
    zoneIsV6 = explode_dn(x, 1)[0].endswith('.ip6.arpa')
IndexError: list index out of range