Bug 35032 - UMC wizard suggests invalid hostnames
UMC wizard suggests invalid hostnames
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 3.2 R2
Other Linux
: P5 normal (vote)
: UCS@school 3.2 R2 Errata
Assigned To: Sönke Schwardt-Krummrich
Florian Best
:
Depends on:
Blocks: 35033
  Show dependency treegraph
 
Reported: 2014-06-02 12:58 CEST by Tim Petersen
Modified: 2014-08-27 17:01 CEST (History)
2 users (show)

See Also:
What kind of report is it?: ---
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 Tim Petersen univentionstaff 2014-06-02 12:58:57 CEST
As far as I understood hostnames with special characters like "-" are invalid. That's why the UMC Import Wizard does not allow to create new school-ou's with such characters in the hostname (or ou).


With create_ou at the commandline new hostnames are creates with "-" per default if you don't specify the hostname:

...
    for dc in school_dcs.split ():
        if dcName:
            dccn = dcName
        else:
            if configRegistry.is_true('ucsschool/singlemaster', False):
                dccn = configRegistry.get('hostname')
            else:
                dccn = 'dc%s-01' % schoolNr.lower ()

...
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2014-06-02 16:45:58 CEST
According to http://support.microsoft.com/kb/909264/de, only "hyphen-minus" is ok and works for NETBIOS and DNS:

"""DNS-Computernamen dürfen nur alphabetische Zeichen (A-Z), numerische Zeichen (0-9), das Minuszeichen (-) und den Punkt (.) enthalten. Punkte sind nur zulässig, wenn sie dazu dienen, die Bestandteile von Domänennamen zu trennen."""

This implies that the OU wizard is wrong when asking for a slave hostname with possible underscore. 

---[ucs-school-umc-wizards/umc/js/schoolwizards/SchoolWizard.js]---
}, {
	type: TextBox,
	name: 'dc_name',
	label: _('Name of educational school server'),
	regExp: '^\\w+(\\w|-)*$',
	description: _('Name of the educational domaincontroller slave for the new school. The server name may consist of the letters a-z, the digits 0-9 and underscores. The name of the educational server may not be equal to the administrative server!'),
	maxLength: 12,
---[cut]---
The widget regex seems to allow hyphens but no underscores → tooltip is wrong.

The create_ou script uses the following function to check user specified hostnames:

  def is_valid_hostname(name):
      return bool(re.match('^[a-zA-Z](([a-zA-Z0-9-_]*)([a-zA-Z0-9]$))?$', name))

→ underscores are allowed; I think this is ok, because underscores are allowed as NetBIOS names. Via Bug 35033 the manual should be updated to it suggest hyphens only.
Comment 2 Sönke Schwardt-Krummrich univentionstaff 2014-06-03 17:43:11 CEST
ucs-school-umc-installer/umc/js/schoolinstaller.js:
1) The tooltip and the regex have been fixed (underscore → hyphen)
-	regExp: '^[a-zA-Z0-9](([a-zA-Z0-9_]*)([a-zA-Z0-9]$))?$',
+	regExp: '^[a-zA-Z0-9](([a-zA-Z0-9-]*)([a-zA-Z0-9]$))?$',

ucs-school-umc-wizards/umc/js/schoolwizards/SchoolWizard.js:
1) The tooltip has been fixed (underscore → hyphen)
2) The regex has been replaced with the one from ucs-school-umc-installer. This way both regex are the same and dashes are no longer allowed at the end of hostnames:
-	regExp: '^\\w+(\\w|-)*$',
+	regExp: '^[a-zA-Z0-9](([a-zA-Z0-9-]*)([a-zA-Z0-9]$))?$',


The packages ucs-school-umc-installer and ucs-school-umc-wizard have been rebuilt. The included translation files have been updated, too.

Changelogentry to changelog-ucsschool-3.2R2v2.xml has been added.
Comment 3 Florian Best univentionstaff 2014-08-22 13:37:48 CEST
Fix: OK, fixed  "and hyphens" → "and hyphens (-)" in schoolinstaller
Changelog: fixed typo
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2014-08-27 17:01:37 CEST
UCS@school 3.2 R2 v2 has been released:
http://docs.univention.de/release-notes-ucsschool-3.2R2v2-de.html

If this error occurs again, please use "Clone This Bug".