From 8cf8870d3d11ace41cea1649d41f84341e0e94ac Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 12 Sep 2011 13:51:31 -0400 Subject: 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 --- ipalib/plugins/host.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'ipalib/plugins/host.py') 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, -- cgit