diff -ur admin.o//handlers/dns/forward_zone.py admin/handlers/dns/forward_zone.py --- admin.o//handlers/dns/forward_zone.py 2011-10-13 10:08:22.000000000 +0200 +++ admin/handlers/dns/forward_zone.py 2011-10-13 09:29:52.000000000 +0200 @@ -58,7 +58,7 @@ 'zone': univention.admin.property( short_description=_('Zone name'), long_description='', - syntax=univention.admin.syntax.string, + syntax=univention.admin.syntax.dnsZone, multivalue=0, options=[], required=1, diff -ur admin.o//syntax.py admin/syntax.py --- admin.o//syntax.py 2011-10-13 10:08:43.000000000 +0200 +++ admin/syntax.py 2011-10-13 10:05:28.000000000 +0200 @@ -1027,6 +1027,22 @@ return text raise univention.admin.uexceptions.valueError,_("The name of a reverse zone consists of the reversed subnet address followed by .in-addr.arpa. Example: \"0.168.192.in-addr.arpa\"") +class dnsZone(simple): + _re = re.compile(r'^[a-zA-Z0-9](:?(:?[a-zA-Z0-9-]{0,63})*\.?)*[a-zA-Z0-9]$') + + @classmethod + def parse(self, text): + if text is None: + raise univention.admin.uexceptions.valueError(_("Missing value!")) + if len(text) >= 255: + raise univention.admin.uexceptions.valueError(_("Value may not be longer than 255 chars!")) + if self._re.match(text) is not None: + return text + elif max(map(len, text.split('.'))) >= 63: + raise univention.admin.uexceptions.valueError(_("Value may not longer than 63 chars between dots!")) + + raise univention.admin.uexceptions.valueError(_("Value may not contain other than numbers, letters and dots and may not end with a dot!")) + class dnsName(simple): _re = re.compile('^[a-zA-Z0-9][a-zA-Z0-9._-]*[a-zA-Z0-9.]$')