summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/host.py
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:26 +0200
commit8cf8870d3d11ace41cea1649d41f84341e0e94ac (patch)
treef17a4ee209fb723d3a4fbfb218f08b3affc34faf /ipalib/plugins/host.py
parent6aa5bfe5db3b44197b181cf138c8f257b622e8b4 (diff)
downloadfreeipa-8cf8870d3d11ace41cea1649d41f84341e0e94ac.tar.gz
freeipa-8cf8870d3d11ace41cea1649d41f84341e0e94ac.tar.xz
freeipa-8cf8870d3d11ace41cea1649d41f84341e0e94ac.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/plugins/host.py')
-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 01a8240e..52907eeb 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,