[#81492] [Ruby trunk Feature#13618] [PATCH] auto fiber schedule for rb_wait_for_single_fd and rb_waitpid — normalperson@...

Issue #13618 has been reported by normalperson (Eric Wong).

12 messages 2017/06/01

[ruby-core:81705] [Ruby trunk Feature#13385] [PATCH] Make Resolv::DNS::Name validation similar to host and dig commands

From: ko1@...
Date: 2017-06-16 08:04:16 UTC
List: ruby-core #81705
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>

In This Thread

Prev Next