Bug 55125 - Fix school name and DC host name validation regression in UCS@school 5.0
Fix school name and DC host name validation regression in UCS@school 5.0
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 5.0
Other Linux
: P5 normal (vote)
: UCS@school 5.0 v3-errata
Assigned To: Daniel Tröder
Tobias Wenzel
https://git.knut.univention.de/univen...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2022-08-23 10:01 CEST by Daniel Tröder
Modified: 2022-08-25 17:27 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.286
Enterprise Customer affected?: Yes
School Customer affected?: Yes
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 Daniel Tröder univentionstaff 2022-08-23 10:01:35 CEST
In UCS@school 5.0 the school library (attributes.py::SchoolName and create_ou.py) do not allow creating school OUs with underscores in the name. But this was allowed in UCS@school 4.4 and there is no technical reason not to.

Computer host names must not contain underscores.

When the create_ou script or function is used without supplying a DC name, the DC name is calculated from the OU name. If the OU name contains an underscore, the DC name is invalid and the school OU creation is (and should be) aborted. But when a valid DC name is submitted, a OU name with an underscore should be allowed.
Comment 3 Tobias Wenzel univentionstaff 2022-08-24 16:30:53 CEST
QA: all ok, as discussed already merged

- [x] code ok https://git.knut.univention.de/univention/ucsschool/-/merge_requests/144
- [x] manual qa (see below)
- [x] changelog / advisory
- jenkins -> will check tomorrow

Everything tested on primary + backup

before:

create ou names with underscores with a valid dc name

- Weird, but OK: umc does allow the creation of `TEST_1` . also: umc displays that underscores are not allowed
- OK cmd-line does not work
```

/usr/share/ucs-school-import/scripts/create_ou TEST_1 testdc
Create OU: TEST_1
The following fields reported errors during validation:
name: ['Invalid school name']
```
- OK python code does not work
```
from univention.admin.uldap import getAdminConnection
from ucsschool.lib.models.school import School
lo, pos = getAdminConnection()
school =School(name="test_me")
school.educational_servers = ["testdc"]
school.create(lo)

    560             self.validate(lo)
    561             if self.errors:
--> 562                 raise ValidationError(self.errors.copy())
    563 
    564         pos = udm_uldap.position(ucr.get("ldap/base"))

ValidationError: {'name': ['Invalid school name']}
```


after:

- OK umc still does allow the creation of `TEST_6` . also: umc still displays that underscores are not allowed :)
- OK cmd-line does work
```
/usr/share/ucs-school-import/scripts/create_ou TEST_5 testdc
```
- OK python code does work
```
from univention.admin.uldap import getAdminConnection
from ucsschool.lib.models.school import School
lo, pos = getAdminConnection()
school =School(name="test_me5")
school.educational_servers = ["testdc"]
school.create(lo)

...
Out[2]: True
```
Comment 4 Tobias Wenzel univentionstaff 2022-08-25 11:37:29 CEST
jenkins is happy -> verify