summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2011-09-12 13:51:31 -0400
committerMartin Kosek <mkosek@redhat.com>2011-09-27 16:08:40 +0200
commita27a820221634fc0e0489a8c2dab3f0e914daa2c (patch)
tree6d458f87202f122bb5b320827c94a6aadeadb9aa /ipalib
parent2be04c6e7fc281bb68f78f78a77718a3d963e789 (diff)
downloadfreeipa-a27a820221634fc0e0489a8c2dab3f0e914daa2c.tar.gz
freeipa-a27a820221634fc0e0489a8c2dab3f0e914daa2c.tar.xz
freeipa-a27a820221634fc0e0489a8c2dab3f0e914daa2c.zip
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
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/plugins/host.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/ipalib/plugins/host.py b/ipalib/plugins/host.py
index 01a8240e3..52907eebe 100644
--- a/ipalib/plugins/host.py
+++ b/ipalib/plugins/host.py
@@ -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,