Permalink
Browse files

Handle locally-defined hostnames, without full DNS info

  • Loading branch information...
purcell committed Nov 6, 2012
1 parent aac460c commit 271aee66d4621ffa43983cb6c5712e6aca845bc3
Showing with 2 additions and 1 deletion.
  1. +2 −1 bin/postfix-policy-whois
View
@@ -34,7 +34,8 @@ require 'resolv'
def nameserver_for(domain)
Timeout::timeout(5) do
begin
- Resolv::DNS.new.getresource(domain, Resolv::DNS::Resource::IN::ANY).name.to_s
+ record = Resolv::DNS.new.getresource(domain, Resolv::DNS::Resource::IN::ANY)
+ record.name.to_s if record.respond_to?(:name)
rescue Resolv::ResolvError
nil
end

0 comments on commit 271aee6

Please sign in to comment.