Add regular expression pattern to host names.

Limit hostnames to letters, digits and - with a maximum length of 255

https://fedorahosted.org/freeipa/ticket/1780
This commit is contained in:
Rob Crittenden
2011-09-12 13:51:31 -04:00
committed by Martin Kosek
parent 2be04c6e7f
commit a27a820221
3 changed files with 13 additions and 10 deletions

View File

@@ -247,6 +247,9 @@ class host(LDAPObject):
takes_params = (
Str('fqdn', validate_host,
pattern='^[a-zA-Z0-9][a-zA-Z0-9-\.]{0,254}$',
pattern_errmsg='may only include letters, numbers, and -',
maxlength=255,
cli_name='hostname',
label=_('Host name'),
primary_key=True,