Issue #13385 has been updated by ko1 (Koichi Sasada).

Assignee set to akr (Akira Tanaka)

----------------------------------------
Feature #13385: [PATCH] Make Resolv::DNS::Name validation similar to host and dig commands
https://bugs.ruby-lang.org/issues/13385#change-65395

* Author: pavel.mikhailyuk / gmail.com (Pavel Mikhailyuk)
* Status: Open
* Priority: Normal
* Assignee: akr (Akira Tanaka)
* Target version: 
----------------------------------------
# Abstract
Add validations similar to **host** and **dig** commands to `Resolv::DNS::Name.create`

# Background
`Resolv::DNS::Name.create(str)` does not make any domain name validation.
So it returns false positive results for queries like

~~~ ruby
[1] pry(main)> Resolv::DNS.new.getresources('.gmail....com', Resolv::DNS::Resource::IN::MX)
=> [#<Resolv::DNS::Resource::IN::MX:0x007fc3107ecf68 @exchange=#<Resolv::DNS::Name: alt1.gmail-smtp-in.l.google.com.>, @preference=10, @ttl=3600>,
 #<Resolv::DNS::Resource::IN::MX:0x007fc313013730 @exchange=#<Resolv::DNS::Name: alt2.gmail-smtp-in.l.google.com.>, @preference=20, @ttl=3600>,
 #<Resolv::DNS::Resource::IN::MX:0x007fc313011f20 @exchange=#<Resolv::DNS::Name: gmail-smtp-in.l.google.com.>, @preference=5, @ttl=3600>,
 #<Resolv::DNS::Resource::IN::MX:0x007fc313010a30 @exchange=#<Resolv::DNS::Name: alt4.gmail-smtp-in.l.google.com.>, @preference=40, @ttl=3600>,
 #<Resolv::DNS::Resource::IN::MX:0x007fc313012858 @exchange=#<Resolv::DNS::Name: alt3.gmail-smtp-in.l.google.com.>, @preference=30, @ttl=3600>]
~~~

while

~~~ text
~ dig .gmail....com MX
dig: '.gmail....com' is not a legal name (empty label)
~~~


I added basic RFC validations in `Resolv::DNS::Label.split` to get `ArgumentError` with messages similar to **host** and **dig** commands.

# Pull request
[https://github.com/ruby/ruby/pull/1551](https://github.com/ruby/ruby/pull/1551)



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>