Commit 29d445eb authored by Jason Plum's avatar Jason Plum Committed by Heinrich Lee Yu

VerifyPagesDomain: suffix with . indicate absolute fqdn

parent ffe18959
...@@ -85,7 +85,8 @@ class VerifyPagesDomainService < BaseService ...@@ -85,7 +85,8 @@ class VerifyPagesDomainService < BaseService
end end
def check(domain_name, resolver) def check(domain_name, resolver)
records = parse(txt_records(domain_name, resolver)) # Append '.' to domain_name, indicating absolute FQDN
records = parse(txt_records(domain_name + '.', resolver))
records.any? do |record| records.any? do |record|
record == domain.keyed_verification_code || record == domain.verification_code record == domain.keyed_verification_code || record == domain.verification_code
......
...@@ -372,7 +372,8 @@ RSpec.describe VerifyPagesDomainService do ...@@ -372,7 +372,8 @@ RSpec.describe VerifyPagesDomainService do
allow(resolver).to receive(:getresources) { [] } allow(resolver).to receive(:getresources) { [] }
stubbed_lookups.each do |domain, records| stubbed_lookups.each do |domain, records|
records = Array(records).map { |txt| Resolv::DNS::Resource::IN::TXT.new(txt) } records = Array(records).map { |txt| Resolv::DNS::Resource::IN::TXT.new(txt) }
allow(resolver).to receive(:getresources).with(domain, Resolv::DNS::Resource::IN::TXT) { records } # Append '.' to domain_name, indicating absolute FQDN
allow(resolver).to receive(:getresources).with(domain + '.', Resolv::DNS::Resource::IN::TXT) { records }
end end
resolver resolver
......
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