-
Notifications
You must be signed in to change notification settings - Fork 44
Description
I would have submitted a code fix, but I'm just not that confident in my knowledge of DNS.
def check_ptr(str)
IPAddr.new str
rescue
raise ArgumentError, "PTR section not valid"
end
It appears that it's attempting to verify the last field is an IP address, which is not what a PTR record is. I'm not able to use the following code, for example, should I be?
irb(main):081:0> x="114.206.37.66.in-addr.arpa. 3600 IN PTR www.inforonics.com."
=> "114.206.37.66.in-addr.arpa. 3600 IN PTR www.inforonics.com."
irb(main):082:0> rr = Net::DNS::RR.new(x)
Net::DNS::RR::ArgumentError: PTR section not valid
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr/ptr.rb:27:in check_ptr' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr/ptr.rb:52:insubclass_new_from_string'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:282:in new_from_string' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:131:ininitialize'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:360:in send' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:360:innew'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:280:in new_from_string' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:131:ininitialize'
from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:360:in send' from /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/net-dns-0.6.1/lib/net/dns/rr.rb:360:innew'
from (irb):82
My goal is to parse out the PTR record value. (In this case www.inforonics.com.)