dnsruby 1.45 → 1.46

Sign up to get free protection for your applications and to get access to all the features.
data/demo/digdlv.rb CHANGED
@@ -40,7 +40,10 @@
40
40
  #Michael Fuhr <mike@fuhr.org>
41
41
  #Alex D <alexd@nominet.org.uk>
42
42
 
43
+ begin
43
44
  require 'rubygems'
45
+ rescue LoadError
46
+ end
44
47
  require 'dnsruby'
45
48
  include Dnsruby
46
49
 
data/demo/digitar.rb CHANGED
@@ -39,7 +39,10 @@
39
39
  #Michael Fuhr <mike@fuhr.org>
40
40
  #Alex D <alexd@nominet.org.uk>
41
41
 
42
+ begin
42
43
  require 'rubygems'
44
+ rescue LoadError
45
+ end
43
46
  require 'dnsruby'
44
47
  include Dnsruby
45
48
 
@@ -1063,8 +1063,10 @@ module Dnsruby
1063
1063
  put_length16 {rr.encode_rdata(self, canonical)}
1064
1064
  end
1065
1065
 
1066
- def put_name(d, canonical=false)
1067
- if (canonical)
1066
+ def put_name(d, canonical=false, downcase = canonical)
1067
+ # DNSSEC requires some records (e.g. NSEC, RRSIG) to be canonicalised, but
1068
+ # not downcased. YUK!
1069
+ if (downcase)
1068
1070
  d = d.downcase
1069
1071
  end
1070
1072
  put_labels(d.to_a, canonical)
@@ -153,16 +153,16 @@ module Dnsruby
153
153
  get_new_key_tag
154
154
  end
155
155
 
156
- def from_hash(hash) #:nodoc: all
157
- @make_new_key_tag = false
158
- hash.keys.each do |param|
159
- send(param.to_s+"=", hash[param])
156
+ def from_hash(hash) #:nodoc: all
157
+ @make_new_key_tag = false
158
+ hash.keys.each do |param|
159
+ send(param.to_s+"=", hash[param])
160
+ end
161
+ @make_new_key_tag = true
162
+ get_new_key_tag
160
163
  end
161
- @make_new_key_tag = true
162
- get_new_key_tag
163
- end
164
164
 
165
- def from_string(input)
165
+ def from_string(input)
166
166
  if (input.length > 0)
167
167
  @make_new_key_tag = false
168
168
  data = input.split(" ")
@@ -291,12 +291,16 @@ module Dnsruby
291
291
  end
292
292
 
293
293
  def key=(key_text)
294
- key_text.gsub!(/\n/, "")
295
- key_text.gsub!(/ /, "")
296
- # @key=Base64.decode64(key_text)
297
- @key=key_text.unpack("m*")[0]
298
- public_key
299
- get_new_key_tag
294
+ begin
295
+ key_text.gsub!(/\n/, "")
296
+ key_text.gsub!(/ /, "")
297
+ # @key=Base64.decode64(key_text)
298
+ @key=key_text.unpack("m*")[0]
299
+ public_key
300
+ get_new_key_tag
301
+ rescue Exception
302
+ raise ArgumentError.new("Key #{key_text} invalid")
303
+ end
300
304
  end
301
305
 
302
306
  def public_key
@@ -282,7 +282,7 @@ module Dnsruby
282
282
 
283
283
  def encode_rdata(msg, canonical=false) #:nodoc: all
284
284
  # Canonical
285
- msg.put_name(@next_domain, true)
285
+ msg.put_name(@next_domain, canonical, false) # dnssec-bis-updates says NSEC should not be downcased
286
286
  types = encode_types
287
287
  msg.put_bytes(types)
288
288
  end
@@ -243,7 +243,7 @@ module Dnsruby
243
243
  msg.put_pack('ncc', @type_covered.to_i, @algorithm.to_i, @labels)
244
244
  msg.put_pack("NNN", @original_ttl, @expiration, @inception)
245
245
  msg.put_pack("n", @key_tag)
246
- msg.put_name(@signers_name, canonical)
246
+ msg.put_name(@signers_name, canonical, false)
247
247
  msg.put_bytes(@signature)
248
248
  end
249
249
 
@@ -273,7 +273,7 @@ module Dnsruby
273
273
  # This compares the name, type, and class of the Records; the ttl and
274
274
  # rdata are not compared.
275
275
  def sameRRset(rec)
276
- if (@klass != rec.klass || @name != rec.name)
276
+ if (@klass != rec.klass || @name.downcase != rec.name.downcase)
277
277
  return false
278
278
  end
279
279
  [rec, self].each { |rr|
@@ -687,6 +687,8 @@ module Dnsruby
687
687
  sigrecs.each do |sigrec|
688
688
  check_rr_data(rrset, sigrec)
689
689
  end
690
+ raise ArgumentError.new("Expecting DNSKEY, DLV, DS, RRSet, Array or nil for keys : got #{keys.class} instead") if
691
+ (keys && (![Array, RR::IN::DNSKEY, RR::IN::DLV, RR::IN::DS].include?keys.class) && (keys.class != RRSet))
690
692
 
691
693
  keyrec = nil
692
694
  sigrec = nil
@@ -217,23 +217,24 @@ module Dnsruby
217
217
  split = line.split(' ') # split on whitespace
218
218
  name = split[0].strip
219
219
  if (name.index"\\")
220
- old_name = name
221
220
 
222
221
  ls =[]
223
- Name.create(name).labels.each {|el| ls.push(Name.decode(RR::TXT.display(el.to_s, false)))}
224
- name = ls.join('.')
222
+ Name.create(name).labels.each {|el| ls.push(Name.decode(el.to_s))}
223
+ new_name = ls.join('.')
225
224
 
226
225
 
227
- if (/\.\z/ =~ old_name)
228
- name += "."
226
+ if (!(/\.\z/ =~ name))
227
+ new_name += "." + @origin
228
+ else
229
+ new_name += "."
229
230
  end
230
- line = name + " "
231
+ line = new_name + " "
231
232
  (split.length - 1).times {|i| line += "#{split[i+1]} "}
232
233
  line += "\n"
234
+ name = new_name
233
235
  split = line.split
234
- end
235
- # o add $ORIGIN to it if it is not absolute
236
- if !(/\.\z/ =~ name)
236
+ # o add $ORIGIN to it if it is not absolute
237
+ elsif !(/\.\z/ =~ name)
237
238
  new_name = name + "." + @origin
238
239
  line.sub!(name, new_name)
239
240
  name = new_name
data/lib/dnsruby.rb CHANGED
@@ -104,7 +104,7 @@ require 'Dnsruby/TheLog'
104
104
  module Dnsruby
105
105
 
106
106
  # @TODO@ Remember to update version in dnsruby.gemspec!
107
- VERSION = 1.45
107
+ VERSION = 1.46
108
108
  def Dnsruby.version
109
109
  return VERSION
110
110
  end
data/test/tc_axfr.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  class TestAxfr < Test::Unit::TestCase
data/test/tc_dns.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_dnsruby.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_header.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_hip.rb CHANGED
@@ -14,7 +14,10 @@
14
14
  #See the License for the specific language governing permissions and
15
15
  #limitations under the License.
16
16
  #++
17
+ begin
17
18
  require 'rubygems'
19
+ rescue LoadError
20
+ end
18
21
  require 'test/unit'
19
22
  require 'dnsruby'
20
23
  include Dnsruby
data/test/tc_ipseckey.rb CHANGED
@@ -14,7 +14,10 @@
14
14
  #See the License for the specific language governing permissions and
15
15
  #limitations under the License.
16
16
  #++
17
+ begin
17
18
  require 'rubygems'
19
+ rescue LoadError
20
+ end
18
21
  require 'test/unit'
19
22
  require 'dnsruby'
20
23
  include Dnsruby
data/test/tc_misc.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  class TestMisc < Test::Unit::TestCase
data/test/tc_name.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
@@ -59,9 +62,9 @@ class TestName < Test::Unit::TestCase
59
62
  names.push(Name.create("Z.a.example"))
60
63
  names.push(Name.create("zABC.a.EXAMPLE"))
61
64
  names.push(Name.create("z.example"))
62
- # names.push(Name.create("\001.z.example")) # @TODO@ Binary labels in strings
65
+ names.push(Name.create("\001.z.example"))
63
66
  names.push(Name.create("*.z.example"))
64
- # names.push(Name.create("\200.z.example")) # @TODO@ Binary labels in strings
67
+ names.push(Name.create("\200.z.example"))
65
68
  names.each_index {|i|
66
69
  if (i < (names.length() - 1))
67
70
  assert(names[i].canonically_before(names[i+1]))
@@ -71,4 +74,10 @@ class TestName < Test::Unit::TestCase
71
74
  assert(Name.create("x.w.example").canonically_before(Name.create("z.w.example")))
72
75
  assert(Name.create("x.w.example").canonically_before(Name.create("a.z.w.example")))
73
76
  end
77
+
78
+ def test_escapes
79
+ n1 = Name.create("\\nall.all.")
80
+ n2 = Name.create("nall.all.")
81
+ assert(n1 == n2, n1)
82
+ end
74
83
  end
data/test/tc_naptr.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_nsec3.rb CHANGED
@@ -129,9 +129,9 @@ class Nsec3Test < Test::Unit::TestCase
129
129
 
130
130
  def test_types
131
131
  rr = RR.create("tfkha3ph6qs16qu3oqtmnfc5tbckpjl7.archi.amt. 1209600 IN NSEC3 1 1 5 - 1tmmto81uc71moj44cli3m6avs5l44l3 NSEC3 CNAME RRSIG ; flags: optout")
132
- assert(rr.types.include?Types::NSEC3)
133
- assert(rr.types.include?Types::CNAME)
134
- assert(rr.types.include?Types::RRSIG)
132
+ assert(rr.types.include?(Types::NSEC3))
133
+ assert(rr.types.include?(Types::CNAME))
134
+ assert(rr.types.include?(Types::RRSIG))
135
135
  rr = RR.create("929p027vb26s89h6fv5j7hmsis4tcr1p.tjeb.nl. 3600 IN NSEC3 1 0 5 beef 9rs4nbe7128ap5i6v196ge2iag5b7rcq A AAAA RRSIG
136
136
  ")
137
137
  end
data/test/tc_packet.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_question.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_recur.rb CHANGED
@@ -24,7 +24,7 @@ class TestRecur < Test::Unit::TestCase
24
24
  # Dnsruby::TheLog.level = Logger::DEBUG
25
25
  ret = r.query("uk-dnssec.nic.uk", Dnsruby::Types.DNSKEY)
26
26
  # print ret
27
- assert(ret.answer.length > 0)
27
+ assert(ret && ret.answer.length > 0)
28
28
  # ret = r.query_dorecursion("aaa.bigzone.uk-dnssec.nic.uk", Dnsruby::Types.DNSKEY)
29
29
  # ret = r.query_dorecursion("uk-dnssec.nic.uk", Dnsruby::Types.DNSKEY)
30
30
  end
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  class TestResolverConfig < Test::Unit::TestCase
data/test/tc_res_env.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_res_file.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  class TestAResolverFile < Test::Unit::TestCase
data/test/tc_res_opt.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_rr-opt.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  require 'socket'
data/test/tc_rr-txt.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  class TestRrUnknown < Test::Unit::TestCase
data/test/tc_rr.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_soak.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  begin
data/test/tc_soak_base.rb CHANGED
@@ -14,7 +14,10 @@
14
14
  #limitations under the License.
15
15
  #++
16
16
 
17
+ begin
17
18
  require 'rubygems'
19
+ rescue LoadError
20
+ end
18
21
  require 'test/unit'
19
22
  require 'dnsruby'
20
23
 
data/test/tc_sshfp.rb CHANGED
@@ -14,7 +14,10 @@
14
14
  #See the License for the specific language governing permissions and
15
15
  #limitations under the License.
16
16
  #++
17
+ begin
17
18
  require 'rubygems'
19
+ rescue LoadError
20
+ end
18
21
  require 'test/unit'
19
22
  require 'dnsruby'
20
23
  include Dnsruby
data/test/tc_tcp.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  class TestTcp < Test::Unit::TestCase
data/test/tc_tkey.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  require "digest/md5"
data/test/tc_tsig.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  require "digest/md5"
data/test/tc_update.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'test/unit'
18
21
  require 'dnsruby'
19
22
  include Dnsruby
data/test/tc_verifier.rb CHANGED
@@ -28,9 +28,10 @@ class VerifierTest < Test::Unit::TestCase
28
28
  rescue Exception
29
29
  end
30
30
  if (have_sha2)
31
- # print "OpenSSL supports SHA2\n"
31
+ # print "OpenSSL supports SHA2\n"
32
32
  do_test_sha256
33
33
  do_test_sha512
34
+ do_test_nsec
34
35
  else
35
36
  print "OpenSSL doesn't support SHA2 - disabling SHA256/SHA512 tests. DNSSEC validation will not work with these type of signatures.\n"
36
37
  end
@@ -244,10 +245,33 @@ class VerifierTest < Test::Unit::TestCase
244
245
  assert(verified > 0)
245
246
  end
246
247
 
248
+ def do_test_nsec
249
+ begin
250
+ begin
251
+ require 'rubygems'
252
+ rescue LoadError
253
+ end
254
+ require 'timecop'
255
+ rescue LoadError
256
+ return
257
+ end
258
+ Timecop.travel(2010, 03, 24, 0, 0, 0) {
259
+ key = Dnsruby::RR.create("in-addr-servers.arpa. 3600 IN DNSKEY 256 3 8 AwEAAcoEdjN6PM57REYLqLCBNfjCbQQU8pSNOz/kRwP75YQzidnaQpCO4+rjOYSAPH5lAjtT+AxuUB33DkOhQHPDSO87JLt1pm65eNNsz10COEExfuokM98qiURN76kv3N1n/gRG2693tpkmVdvSTRCbReyq6BlzKuYABGLD3V3MUB4j ;{id = 12033 (zsk), size = 1024b}")
260
+ verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
261
+ key_rrset = Dnsruby::RRSet.new(key)
262
+ verifier.add_trusted_key(key_rrset);
263
+ sig = Dnsruby::RR.create("b.in-addr-servers.arpa. 3600 IN RRSIG NSEC 8 3 3600 20100325113758 20100318052509 12033 in-addr-servers.arpa. uy5aUIhq3eKc24gcoyBoLYaR6kKtG957zpR0G2pf1XPCO2ESzwdIkXK0/XeUkRMmPRnKfGOhwNYIBK26kX3PYxaIPsDZVc5ZAC3uc/+EpCosMn3FJQQDiNx/gznEQZk0JRxTUMMMucCNW2HVU18NVtTQhT0MaAsLyG8OduWuMCI= ;{id = 12033}")
264
+ nsec = Dnsruby::RR.create("B.in-addr-servers.arpa. 3600 IN NSEC C.in-addr-servers.arpa. A AAAA RRSIG NSEC")
265
+ rrset = Dnsruby::RRSet.new(nsec)
266
+ rrset.add(sig)
267
+ verifier.verify_rrset(rrset, key_rrset)
268
+ }
269
+ end
270
+
247
271
  def test_naptr
248
272
  key = Dnsruby::RR.create("all.rr.org. 2678400 IN DNSKEY 256 3 7 AwEAAcW1ZJxnMxZAAfsQ0JJQPHOlVNeGzs/AWVSGXiIYsg9UUSsvRTiK/Wy2wD7XC6osZpgy4Blhm846wktPbCwHpkxxbjxpaMABjbhH14gRol1Gpzf+gOr8vpdii8c2y6VMN9kIXZyaZUWcshLii19ysSGlqY1a1g2XZjogFtvzDHjH ;{id = 43068 (zsk), size = 1024b}")
249
- verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
250
- key_rrset = Dnsruby::RRSet.new(key)
273
+ verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
274
+ key_rrset = Dnsruby::RRSet.new(key)
251
275
  verifier.add_trusted_key(key_rrset);
252
276
  sig = Dnsruby::RR.create("all.rr.org. 86400 IN RRSIG NAPTR 7 3 86400 20100727230632 20090919145743 43068 all.rr.org. RpyBsaLiaZ/OqX5twE0SoMhlVZVAHuAlS4FZqmnAg+udF3EwrY6N/POt3nPCtgwf7tczaxrMK6zWkOldfv37iyIgXIxDQvhoCb7IoffI5TsBL5CWl5n7pg8BNAMpLxd8HIu1DShWvlplpFbBWIaC6tZCR6ft/iP+uhU7dYcqTHg= ;{id = 43068}")
253
277
  naptr = Dnsruby::RR.create('all.rr.org. 86400 IN NAPTR 100 10 "" "" "!^urn:cid:.+@([^\\\\.]+\\\\.)(.*)$!\\\\2!i" .')
@@ -262,8 +286,8 @@ class VerifierTest < Test::Unit::TestCase
262
286
  assert(rr.to_s.index('"Net-DNS\\\\; complicated $tuff" "sort of \\" text\\\\; and binary \\000 data"'), rr.to_s)
263
287
 
264
288
  key = Dnsruby::RR.create("all.rr.org. 2678400 IN DNSKEY 256 3 7 AwEAAcW1ZJxnMxZAAfsQ0JJQPHOlVNeGzs/AWVSGXiIYsg9UUSsvRTiK/Wy2wD7XC6osZpgy4Blhm846wktPbCwHpkxxbjxpaMABjbhH14gRol1Gpzf+gOr8vpdii8c2y6VMN9kIXZyaZUWcshLii19ysSGlqY1a1g2XZjogFtvzDHjH ;{id = 43068 (zsk), size = 1024b}")
265
- verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
266
- key_rrset = Dnsruby::RRSet.new(key)
289
+ verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
290
+ key_rrset = Dnsruby::RRSet.new(key)
267
291
  verifier.add_trusted_key(key_rrset);
268
292
  sig = Dnsruby::RR.create("txt2.all.rr.org. 86400 IN RRSIG TXT 7 4 86400 20100813002344 20091006093439 43068 all.rr.org. LJv/ccd2JHyT6TK74Dtu/zH4jdeR4ScyrB8cGwaqeCjwxG4H5FY88Sk/U0JUQyxnUificnyZQwcyXAItn7QjBMHQO4ftVxl/gDCyt6MEXy9JKK/rfvXcAceo5prmlVrb8WxT5YnvPha3CxjK7f+YIs5cqppRVaZTQTxsAsJyJ20= ;{id = 43068}")
269
293
  txt = Dnsruby::RR.create('txt2.all.rr.org. 86400 IN TXT "Net-DNS\\\\; complicated $tuff" "sort of \\" text\\\\; and binary \\000 data"')
@@ -272,37 +296,37 @@ class VerifierTest < Test::Unit::TestCase
272
296
  verifier.verify_rrset(rrset, key_rrset)
273
297
  end
274
298
 
275
- # def test_txt_from_zone
276
- # reader = Dnsruby::ZoneReader.new("all.rr.org.")
277
- # zone = reader.process_file("zone.txt")
278
- # rrset = Dnsruby::RRSet.new
279
- # key_rrset = Dnsruby::RRSet.new
280
- # zone.each {|rr|
281
- # if ( (rr.type == Dnsruby::Types.TXT) || ((rr.type == Dnsruby::Types.RRSIG) && (rr.type_covered == Dnsruby::Types.TXT)))
282
- # rrset.add(rr)
283
- # end
284
- # if (rr.type == Dnsruby::Types.DNSKEY)
285
- # key_rrset.add(rr)
286
- # end
287
- # }
288
- # verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
289
- # verifier.verify_rrset(rrset, key_rrset)
290
- # end
299
+ # def test_txt_from_zone
300
+ # reader = Dnsruby::ZoneReader.new("all.rr.org.")
301
+ # zone = reader.process_file("zone.txt")
302
+ # rrset = Dnsruby::RRSet.new
303
+ # key_rrset = Dnsruby::RRSet.new
304
+ # zone.each {|rr|
305
+ # if ( (rr.type == Dnsruby::Types.TXT) || ((rr.type == Dnsruby::Types.RRSIG) && (rr.type_covered == Dnsruby::Types.TXT)))
306
+ # rrset.add(rr)
307
+ # end
308
+ # if (rr.type == Dnsruby::Types.DNSKEY)
309
+ # key_rrset.add(rr)
310
+ # end
311
+ # }
312
+ # verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
313
+ # verifier.verify_rrset(rrset, key_rrset)
314
+ # end
291
315
 
292
- # def test_naptr_from_zone
293
- # reader = Dnsruby::ZoneReader.new("all.rr.org.")
294
- # zone = reader.process_file("zone.txt")
295
- # rrset = Dnsruby::RRSet.new
296
- # key_rrset = Dnsruby::RRSet.new
297
- # zone.each {|rr|
298
- # if ((rr.type == Dnsruby::Types.NAPTR) || ((rr.type == Dnsruby::Types.RRSIG) && (rr.type_covered == Dnsruby::Types.NAPTR)))
299
- # rrset.add(rr)
300
- # end
301
- # if (rr.type == Dnsruby::Types.DNSKEY)
302
- # key_rrset.add(rr)
303
- # end
304
- # }
305
- # verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
306
- # verifier.verify_rrset(rrset, key_rrset)
307
- # end
316
+ # def test_naptr_from_zone
317
+ # reader = Dnsruby::ZoneReader.new("all.rr.org.")
318
+ # zone = reader.process_file("zone.txt")
319
+ # rrset = Dnsruby::RRSet.new
320
+ # key_rrset = Dnsruby::RRSet.new
321
+ # zone.each {|rr|
322
+ # if ((rr.type == Dnsruby::Types.NAPTR) || ((rr.type == Dnsruby::Types.RRSIG) && (rr.type_covered == Dnsruby::Types.NAPTR)))
323
+ # rrset.add(rr)
324
+ # end
325
+ # if (rr.type == Dnsruby::Types.DNSKEY)
326
+ # key_rrset.add(rr)
327
+ # end
328
+ # }
329
+ # verifier = Dnsruby::SingleVerifier.new(Dnsruby::SingleVerifier::VerifierType::ANCHOR)
330
+ # verifier.verify_rrset(rrset, key_rrset)
331
+ # end
308
332
  end
data/test/ts_offline.rb CHANGED
@@ -13,7 +13,10 @@
13
13
  #See the License for the specific language governing permissions and
14
14
  #limitations under the License.
15
15
  #++
16
+ begin
16
17
  require 'rubygems'
18
+ rescue LoadError
19
+ end
17
20
  require 'dnsruby'
18
21
  Dnsruby.log.level = Logger::FATAL
19
22
  require "test/unit"
data/test/ts_online.rb CHANGED
@@ -41,10 +41,7 @@ if (online)
41
41
  print "Running online tests. These tests send UDP packets - some may be lost.\n"
42
42
  print "If you get the odd timeout error with these tests, try running them again.\n"
43
43
  print "It may just be that some UDP packets got lost the first time...\n"
44
- require "test/tc_rr-opt.rb"
45
- require "test/tc_res_config.rb"
46
44
  require "test/tc_resolver.rb"
47
- require "test/tc_dns.rb"
48
45
  require "test/tc_dnsruby.rb"
49
46
  # require "test/tc_inet6.rb"
50
47
  # require "test/tc_recurse.rb"
@@ -52,7 +49,6 @@ if (online)
52
49
  # require "test/tc_queue.rb"
53
50
  require "test/tc_recur.rb"
54
51
  # require "test/tc_soak.rb"
55
- require "test/tc_cache.rb"
56
52
 
57
53
  # Check if we can contact the server - if we can't, then abort the test
58
54
  # (but tell user that test has not been run due to connectivity problems)
@@ -73,6 +69,10 @@ if (online)
73
69
 
74
70
  require "test/tc_single_resolver.rb"
75
71
  require "test/tc_axfr.rb"
72
+ require "test/tc_cache.rb"
73
+ require "test/tc_dns.rb"
74
+ require "test/tc_rr-opt.rb"
75
+ require "test/tc_res_config.rb"
76
76
 
77
77
  have_openssl = false
78
78
  begin
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsruby
3
3
  version: !ruby/object:Gem::Version
4
- version: "1.45"
4
+ version: "1.46"
5
5
  platform: ruby
6
6
  authors:
7
7
  - AlexD
@@ -9,7 +9,7 @@ autorequire: dnsruby
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-03-17 00:00:00 +00:00
12
+ date: 2010-04-07 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15