Bug 45207 - modifying share raises IndexError: string index out of range
modifying share raises IndexError: string index out of range
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Shares
UCS 4.2
Other Linux
: P5 normal (vote)
: UCS 4.2-1-errata
Assigned To: Florian Best
Johannes Keiser
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-08-15 11:33 CEST by Florian Best
Modified: 2019-11-13 06:34 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.069
Enterprise Customer affected?: Yes
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2017080821000196, 2017081321000202, 2017081721000688
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 2017-08-15 11:33:21 CEST
Execution of command 'udm/put shares/share' has failed:

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 409, 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 347, in modify
    dn = self._modify(modify_childs, ignore_license=ignore_license, response=response)
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 849, in _modify
    self._call_checkLdap_on_all_property_syntaxes()
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 1143, in _call_checkLdap_on_all_property_syntaxes
    if not self.exists() or self.hasChanged(pname):
  File "%PY2.7%/univention/admin/handlers/__init__.py", line 159, in hasChanged
    return not univention.admin.mapping.mapCmp(self.mapping, key, self.oldinfo.get(key, ''), self.info.get(key, ''))
  File "%PY2.7%/univention/admin/mapping.py", line 330, in mapCmp
    return map[1](old) == map[1](new)
  File "%PY2.7%/univention/admin/handlers/shares/share.py", line 743, in insertQuotes
    if new_entry[0] == "@":
IndexError: string index out of range
Comment 1 Florian Best univentionstaff 2017-08-15 11:33:33 CEST
Version: 4.2-1 errata122 (Lesum) - UCS@school 4.2 v2

Remark: Ich möchte die Schreibberechtigungen bei einem Share auf die Gruppe der lehrer-$OU beschränken. Ich kann aber hier keinen Benutzer oder Gruppe eintragen. Es kommt immer die
Fehlermeldung - auch, wenn ich hier root eintrage.
Comment 2 Florian Best univentionstaff 2017-08-15 11:33:59 CEST
Remark: Trying to get a group share up and running and I've had ZERO luck with any documentation or forum posts. :(
Comment 3 Florian Best univentionstaff 2017-08-15 11:36:07 CEST
The code path exists since Bug #37081.
Comment 4 Florian Best univentionstaff 2017-08-15 12:24:35 CEST
The exception happens when changing 'sambaWriteList' / 'univentionShareSambaWriteList' and the new or old values is empty.

univention-directory-manager-modules (12.0.18-9):
r82124 | Bug #45207: fix mapping of sambaWriteList in shares when the value is empty

univention-directory-manager-modules.yaml:
r82125 | YAML Bug #45207
Comment 5 Johannes Keiser univentionstaff 2017-08-17 18:14:47 CEST
OK no traceback. tested with:

udm shares/share create --set name=bar --set host="master40.mydomain.intranet" --set path="/bar"

udm shares/share modify --dn cn=bar,dc=mydomain,dc=intranet --set sambaWriteList=foo
udm shares/share modify --dn cn=bar,dc=mydomain,dc=intranet --set sambaWriteList=newFoo
udm shares/share modify --dn cn=bar,dc=mydomain,dc=intranet --remove sambaWriteList

YAML: OK
-> verified
Comment 6 Florian Best univentionstaff 2017-08-17 19:32:23 CEST
Reported again, 4.2-1 errata133 (Lesum).

Bitte nehmen Sie sich einen Augenblick Zeit, um die folgenden Informationen bereitzustellen:

1) Schritte, um den Fehler zu reproduzieren

In einer Samba Freigabe ist unter Erweiterte Einstellungen -> Samba Rechte -> Schreibberechtigungen auf diese Benutzer/Gruppen beschränken gesetzt:

@"Domain Users"

Dies soll entfernt werden.

2) erwartetes Ergebnis

Übernahme des leeren Parameters

3) beobachtetes Ergebnis

Parameter wird nicht übernommen.
Comment 8 Arvid Requate univentionstaff 2017-08-23 14:35:31 CEST
<http://errata.software-univention.de/ucs/4.2/140.html>
Comment 9 markaldo 2019-11-13 06:34:25 CET
In Python, a string is a single-dimensional array of characters. The string index out of range means that the index you are trying to access does not exist. In a string, that means you're trying to get a character from the string at a given point. If that given point does not exist , then you will be trying to get a character that is not inside of the string. Indexes in Python programming start at 0. This means that the maximum index for any string will always be length-1. There are several ways to account for this. Knowing the length of your string (using len() function)could certainly help you to avoid going over the index. More: http://net-informations.com/python/err/range.htm