Commit ff60c042 authored by Colin Shea's avatar Colin Shea

catch cname errors

if there is a period in the value, it's assumed to be a FQDN not just a
label. Validate both the name a value for the record.
parent 737d086d
......@@ -98,8 +98,11 @@ class Zone
def cname(name, *args)
ttl = extract_ttl! args
value = args.pop || "@"
raise ArgumentError, "The name of the CNAME record can't end with the domain (#{@domain})" if name =~ /#{@domain.chomp('.')}\.?$/
raise ArgumentError, "CNAME value '#{value}' must end with a period" if value != "@" and (value =~ /\./ and value !~ /\.$/)
push :cname, name, ttl, host: (args.pop || "@")
push :cname, name, ttl, host: value
end
def srv(*args)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment