resolv 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/win32/resolv/resolv.c +5 -5
- data/lib/resolv.rb +11 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6d41ba56feaadbca7be99976683ea0272a2e9e87234b24d1c96a841b48c8fab8
|
|
4
|
+
data.tar.gz: 07e1a1cacdf7385307d1be4f276db467703b642a1227a3f264b62be73846d23e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a0a5b43154d5f3653de9705843b8c37205913df18dba719023b729711b32527c08544a340e73a2adf3835f5c0a0f1f6876f68ac2005c4305647a033177ac1fc
|
|
7
|
+
data.tar.gz: 3ee24cfd9b10cef67fd53e62a1cbfb9e63dd4709ec6248c9b65ffd020ec70b8eb71aa8acd39704cb068be4a6ce301709bff0cca2ff3b783f3b786965bb7422e4
|
data/ext/win32/resolv/resolv.c
CHANGED
|
@@ -247,11 +247,11 @@ InitVM_resolv(void)
|
|
|
247
247
|
|
|
248
248
|
reg_key_class = regkey;
|
|
249
249
|
rb_undef_alloc_func(regkey);
|
|
250
|
-
rb_define_private_method(singl, "get_dns_server_list", get_dns_server_list, 0);
|
|
251
|
-
rb_define_private_method(singl, "tcpip_params", tcpip_params_open, 0);
|
|
252
|
-
rb_define_method(regkey, "open", reg_open, 1);
|
|
253
|
-
rb_define_method(regkey, "each_key", reg_each_key, 0);
|
|
254
|
-
rb_define_method(regkey, "value", reg_value, 1);
|
|
250
|
+
rb_define_private_method(singl, "get_dns_server_list", RUBY_METHOD_FUNC(get_dns_server_list), 0);
|
|
251
|
+
rb_define_private_method(singl, "tcpip_params", RUBY_METHOD_FUNC(tcpip_params_open), 0);
|
|
252
|
+
rb_define_method(regkey, "open", RUBY_METHOD_FUNC(reg_open), 1);
|
|
253
|
+
rb_define_method(regkey, "each_key", RUBY_METHOD_FUNC(reg_each_key), 0);
|
|
254
|
+
rb_define_method(regkey, "value", RUBY_METHOD_FUNC(reg_value), 1);
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
void
|
data/lib/resolv.rb
CHANGED
|
@@ -35,7 +35,7 @@ require 'rbconfig'
|
|
|
35
35
|
class Resolv
|
|
36
36
|
|
|
37
37
|
# The version string
|
|
38
|
-
VERSION = "0.8.
|
|
38
|
+
VERSION = "0.8.1"
|
|
39
39
|
|
|
40
40
|
##
|
|
41
41
|
# Looks up the first IP address for +name+.
|
|
@@ -179,7 +179,7 @@ class Resolv
|
|
|
179
179
|
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
|
|
180
180
|
|
|
181
181
|
class Hosts
|
|
182
|
-
if /mswin|cygwin|mingw
|
|
182
|
+
if /mswin|cygwin|mingw/ =~ RUBY_PLATFORM || ::RbConfig::CONFIG['host_os'] =~ /mswin/
|
|
183
183
|
begin
|
|
184
184
|
require 'win32/resolv' unless defined?(Win32::Resolv)
|
|
185
185
|
hosts = Win32::Resolv.get_hosts_path || IO::NULL
|
|
@@ -1132,14 +1132,15 @@ class Resolv
|
|
|
1132
1132
|
end
|
|
1133
1133
|
|
|
1134
1134
|
def Config.default_config_hash(filename="/etc/resolv.conf")
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
elsif defined?(Win32::Resolv)
|
|
1135
|
+
# Native Windows resolves the path against the current drive, while Cygwin's own resolver honors it.
|
|
1136
|
+
if defined?(Win32::Resolv) and !(/cygwin/ =~ RUBY_PLATFORM and File.exist?(filename))
|
|
1138
1137
|
search, nameserver = Win32::Resolv.get_resolv_info
|
|
1139
1138
|
config_hash = {}
|
|
1140
1139
|
config_hash[:nameserver] = nameserver if nameserver
|
|
1141
1140
|
config_hash[:search] = [search].flatten if search
|
|
1142
1141
|
config_hash
|
|
1142
|
+
elsif File.exist? filename
|
|
1143
|
+
Config.parse_resolv_conf(filename)
|
|
1143
1144
|
else
|
|
1144
1145
|
{}
|
|
1145
1146
|
end
|
|
@@ -1844,6 +1845,9 @@ class Resolv
|
|
|
1844
1845
|
# size counts the encoded form, so it starts at 1 for the root
|
|
1845
1846
|
# label's terminating zero octet. [RFC 1035 3.1]
|
|
1846
1847
|
size = 1
|
|
1848
|
+
# A pointer chain decodes to few or no labels, so the 255-octet cap
|
|
1849
|
+
# never bounds its work; cap the pointers followed per name too.
|
|
1850
|
+
pointers = 0
|
|
1847
1851
|
while true
|
|
1848
1852
|
raise DecodeError.new("limit exceeded") if @limit <= @index
|
|
1849
1853
|
case @data.getbyte(@index)
|
|
@@ -1854,6 +1858,8 @@ class Resolv
|
|
|
1854
1858
|
end
|
|
1855
1859
|
return d
|
|
1856
1860
|
when 192..255
|
|
1861
|
+
pointers += 1
|
|
1862
|
+
raise DecodeError.new("too many compression pointers") if pointers > 128
|
|
1857
1863
|
idx = self.get_unpack('n')[0] & 0x3fff
|
|
1858
1864
|
if prev_index <= idx
|
|
1859
1865
|
raise DecodeError.new("non-backward name pointer")
|