mirror of
https://github.com/ruby/ruby.git
synced 2025-09-17 17:43:59 +02:00
merge revision(s) 44312,44318,44321: [Backport #9273]
* lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not consider encodings in hosts file. [ruby-core:59239] [Bug #9273] * lib/resolv.rb (Resolv::Config.parse_resolv_conf): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@44324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8058fde22f
commit
2f4529e7a6
5 changed files with 34 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Sat Dec 21 22:55:03 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* lib/resolv.rb (Resolv::Hosts#lazy_initialize): should not
|
||||||
|
consider encodings in hosts file. [ruby-core:59239] [Bug #9273]
|
||||||
|
|
||||||
|
* lib/resolv.rb (Resolv::Config.parse_resolv_conf): ditto.
|
||||||
|
|
||||||
Sat Dec 21 22:51:51 2013 NAKAMURA Usaku <usa@ruby-lang.org>
|
Sat Dec 21 22:51:51 2013 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* win32/Makefile.sub (fake.rb): fixed wrong RUBY_PLATFORM, to correctly
|
* win32/Makefile.sub (fake.rb): fixed wrong RUBY_PLATFORM, to correctly
|
||||||
|
|
|
@ -186,7 +186,7 @@ class Resolv
|
||||||
unless @initialized
|
unless @initialized
|
||||||
@name2addr = {}
|
@name2addr = {}
|
||||||
@addr2name = {}
|
@addr2name = {}
|
||||||
open(@filename) {|f|
|
open(@filename, 'rb') {|f|
|
||||||
f.each {|line|
|
f.each {|line|
|
||||||
line.sub!(/#.*/, '')
|
line.sub!(/#.*/, '')
|
||||||
addr, hostname, *aliases = line.split(/\s+/)
|
addr, hostname, *aliases = line.split(/\s+/)
|
||||||
|
@ -889,7 +889,7 @@ class Resolv
|
||||||
nameserver = []
|
nameserver = []
|
||||||
search = nil
|
search = nil
|
||||||
ndots = 1
|
ndots = 1
|
||||||
open(filename) {|f|
|
open(filename, 'rb') {|f|
|
||||||
f.each {|line|
|
f.each {|line|
|
||||||
line.sub!(/[#;].*/, '')
|
line.sub!(/[#;].*/, '')
|
||||||
keyword, *args = line.split(/\s+/)
|
keyword, *args = line.split(/\s+/)
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'resolv'
|
require 'resolv'
|
||||||
require 'socket'
|
require 'socket'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
class TestResolvAddr < Test::Unit::TestCase
|
class TestResolvAddr < Test::Unit::TestCase
|
||||||
def test_invalid_ipv4_address
|
def test_invalid_ipv4_address
|
||||||
|
@ -13,4 +14,16 @@ class TestResolvAddr < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_invalid_byte_comment
|
||||||
|
bug9273 = '[ruby-core:59239] [Bug #9273]'
|
||||||
|
Tempfile.open('resolv_test_addr_') do |tmpfile|
|
||||||
|
tmpfile.print("\xff\x00\x40")
|
||||||
|
tmpfile.close
|
||||||
|
hosts = Resolv::Hosts.new(tmpfile.path)
|
||||||
|
assert_nothing_raised(ArgumentError, bug9273) do
|
||||||
|
hosts.each_address("") {break}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
require 'resolv'
|
require 'resolv'
|
||||||
require 'socket'
|
require 'socket'
|
||||||
|
require 'tempfile'
|
||||||
|
|
||||||
class TestResolvDNS < Test::Unit::TestCase
|
class TestResolvDNS < Test::Unit::TestCase
|
||||||
def setup
|
def setup
|
||||||
|
@ -150,4 +151,14 @@ class TestResolvDNS < Test::Unit::TestCase
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_invalid_byte_comment
|
||||||
|
bug9273 = '[ruby-core:59239] [Bug #9273]'
|
||||||
|
Tempfile.open('resolv_test_dns_') do |tmpfile|
|
||||||
|
tmpfile.print("\xff\x00\x40")
|
||||||
|
tmpfile.close
|
||||||
|
assert_nothing_raised(ArgumentError, bug9273) do
|
||||||
|
Resolv::DNS::Config.parse_resolv_conf(tmpfile.path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#define RUBY_VERSION "2.0.0"
|
#define RUBY_VERSION "2.0.0"
|
||||||
#define RUBY_RELEASE_DATE "2013-12-21"
|
#define RUBY_RELEASE_DATE "2013-12-21"
|
||||||
#define RUBY_PATCHLEVEL 367
|
#define RUBY_PATCHLEVEL 368
|
||||||
|
|
||||||
#define RUBY_RELEASE_YEAR 2013
|
#define RUBY_RELEASE_YEAR 2013
|
||||||
#define RUBY_RELEASE_MONTH 12
|
#define RUBY_RELEASE_MONTH 12
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue