summaryrefslogtreecommitdiff
path: root/lib/puppet
diff options
context:
space:
mode:
authorRod Montgomery <rmontgomery@dealnews.com>2015-01-15 15:10:33 -0600
committerRod Montgomery <rmontgomery@dealnews.com>2015-03-05 21:51:12 -0600
commitee13438d2a71cea8a07202eee1eeaa29553b2131 (patch)
treeccd3d38d60e34a32f8106a9539ffe02ee76cfdcd /lib/puppet
parentbf8e5b0573f78f2c2c780494a735bfac25d4488d (diff)
downloadpuppet-stdlib-ee13438d2a71cea8a07202eee1eeaa29553b2131.tar.gz
puppet-stdlib-ee13438d2a71cea8a07202eee1eeaa29553b2131.tar.bz2
If present, top-level domain must be alphabetic
See RFC 1123, Section 2.1 http://tools.ietf.org/html/rfc1123#section-2
Diffstat (limited to 'lib/puppet')
-rw-r--r--lib/puppet/parser/functions/is_domain_name.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/puppet/parser/functions/is_domain_name.rb b/lib/puppet/parser/functions/is_domain_name.rb
index 2860ded..90ede32 100644
--- a/lib/puppet/parser/functions/is_domain_name.rb
+++ b/lib/puppet/parser/functions/is_domain_name.rb
@@ -33,6 +33,10 @@ Returns true if the string passed to this function is a syntactically correct do
return false if domain.empty?
return false if domain.length > domain_max_length
+ # The top level domain must be alphabetic if there are multiple labels.
+ # See rfc1123, 2.1
+ return false if domain.include? '.' and not /\.[A-Za-z]+$/.match(domain)
+
# Check each label in the domain
labels = domain.split('.')
vlabels = labels.each do |label|