pNet-DNS 0.0.4 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/Net/DNS/Packet.rb +2 -11
- data/lib/Net/DNS/RR/OPT.rb +1 -1
- data/lib/Net/DNS/RR/TSIG.rb +5 -4
- data/test/tc_escapedchars.rb +3 -3
- data/test/tc_tkey.rb +1 -1
- metadata +4 -4
data/lib/Net/DNS/Packet.rb
CHANGED
@@ -542,7 +542,7 @@ module Net
|
|
542
542
|
compname="";
|
543
543
|
names=Net::DNS::name2labels(name);
|
544
544
|
|
545
|
-
if ((names.length == 1 && names[0]
|
545
|
+
if ((names.length == 1 && names[0]==""))
|
546
546
|
names=[]
|
547
547
|
else
|
548
548
|
while (!names.empty?)
|
@@ -595,19 +595,10 @@ module Net
|
|
595
595
|
end
|
596
596
|
|
597
597
|
def Packet.dn_expand_PP(packet, offset)
|
598
|
-
# my ($packet, $offset) = @_; # $seen from $_[2] for debugging
|
599
598
|
name = "";
|
600
599
|
packetlen = packet.length;
|
601
600
|
int16sz = Net::DNS::INT16SZ;
|
602
601
|
|
603
|
-
# Debugging
|
604
|
-
# warn "USING PURE PERL dn_expand()\n";
|
605
|
-
#if ($seen->{$offset}) {
|
606
|
-
# die "dn_expand: loop: offset=$offset (seen = ",
|
607
|
-
# join(",", keys %$seen), ")\n";
|
608
|
-
#}
|
609
|
-
#$seen->{$offset} = 1;
|
610
|
-
|
611
602
|
while (true)
|
612
603
|
return nil, nil if packetlen < (offset + 1);
|
613
604
|
|
@@ -688,7 +679,7 @@ module Net
|
|
688
679
|
else
|
689
680
|
key_name, key = args;
|
690
681
|
if ((key_name!=nil) && (key!=nil))
|
691
|
-
tsig = Net::DNS::RR.
|
682
|
+
tsig = Net::DNS::RR.new_from_string("#{key_name} TSIG #{key}")
|
692
683
|
end
|
693
684
|
end
|
694
685
|
|
data/lib/Net/DNS/RR/OPT.rb
CHANGED
@@ -132,7 +132,7 @@ module Net
|
|
132
132
|
@optiondata = data[offset+4, @optionlength].unpack("n");
|
133
133
|
end
|
134
134
|
|
135
|
-
@_rcode_flags = [ttl].pack("N");
|
135
|
+
@_rcode_flags = [@ttl].pack("N");
|
136
136
|
|
137
137
|
@extendedrcode = @_rcode_flags[0, 1].unpack("C")[0];
|
138
138
|
@ednsversion = @_rcode_flags[1, 1].unpack("C")[0];
|
data/lib/Net/DNS/RR/TSIG.rb
CHANGED
@@ -218,7 +218,7 @@ module Net
|
|
218
218
|
|
219
219
|
def init_defaults
|
220
220
|
@algorithm = DEFAULT_ALGORITHM
|
221
|
-
@time_signed = Time.now
|
221
|
+
@time_signed = Time.now.to_i
|
222
222
|
@fudge = DEFAULT_FUDGE
|
223
223
|
@mac_size = 0
|
224
224
|
@mac = ""
|
@@ -232,7 +232,8 @@ module Net
|
|
232
232
|
key.gsub!(/ /,"")
|
233
233
|
key = Base64::decode64(key)
|
234
234
|
|
235
|
-
OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new("md5"), key, data)
|
235
|
+
# OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new("md5"), key, data)
|
236
|
+
OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new("md5"), key, data)
|
236
237
|
|
237
238
|
# hmac = Digest::HMAC_MD5.new(key)
|
238
239
|
# hmac.add(data)
|
@@ -241,7 +242,7 @@ module Net
|
|
241
242
|
}
|
242
243
|
|
243
244
|
# RFC 2845 Section 2.3
|
244
|
-
rrclass = "ANY"
|
245
|
+
@rrclass = "ANY"
|
245
246
|
end
|
246
247
|
|
247
248
|
def error
|
@@ -291,7 +292,7 @@ module Net
|
|
291
292
|
def sig_data(packet)
|
292
293
|
# return the data that needs to be signed/verified. This is useful for
|
293
294
|
# external TSIG verification routines
|
294
|
-
newpacket =
|
295
|
+
newpacket = packet.clone
|
295
296
|
sigdata = ""
|
296
297
|
|
297
298
|
newpacket.additional = []
|
data/test/tc_escapedchars.rb
CHANGED
@@ -170,7 +170,7 @@ class TestEscapedChars < Test::Unit::TestCase
|
|
170
170
|
|
171
171
|
[ # all non \w characters :-)
|
172
172
|
'\000\001\002\003\004\005\006\007\008\009\010\011\012\013\014\015\016\017\018\019\020\021\022\023\024\025\026\027\028\029\030\031\032.\033\034\035\036\037\038\039\040\041\042\043\044\045\046\047\048.\058\059\060\061\062\063\064\065.\091\092\093\094\095\096.\123\124\125\126\127\128\129',
|
173
|
-
'\000\001\002\003\004\005\006\007\008\009\010\011\012\013\014\015\016\017\018\019\020\021\022\023\024\025\026\027\028\029\030\031\032.!\"#\$%&\'\(\)*+,-\./0
|
173
|
+
'\000\001\002\003\004\005\006\007\008\009\010\011\012\013\014\015\016\017\018\019\020\021\022\023\024\025\026\027\028\029\030\031\032.!\"#\$%&\'\(\)*+,-\./0.:\;<=>?\@A.[\\\\]^_`.{|}~\127\128\129',
|
174
174
|
5,
|
175
175
|
[33,16,8,6,7],
|
176
176
|
"21000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f20102122232425262728292a2b2c2d2e2f30083a3b3c3d3e3f4041065b5c5d5e5f60077b7c7d7e7f808100",
|
@@ -218,8 +218,8 @@ class TestEscapedChars < Test::Unit::TestCase
|
|
218
218
|
|
219
219
|
# @todo Net::DNS does not yet have this functionality
|
220
220
|
#~ Net::DNS::HAVE_XS=0
|
221
|
-
|
222
|
-
|
221
|
+
name,offset=Net::DNS::Packet.dn_expand(wire,0)
|
222
|
+
assert_equal(name.to_s,testinput[1].to_s,"DN_EXPAND (pp) consistent")
|
223
223
|
#~ Net::DNS::HAVE_XS=had_xs
|
224
224
|
end
|
225
225
|
|
data/test/tc_tkey.rb
CHANGED
@@ -91,7 +91,7 @@ class TestTKey < Test::Unit::TestCase
|
|
91
91
|
# OpenSSL::HMAC.hexdigest(OpenSSL::Digest::Digest.new("md5"), key, data)
|
92
92
|
hmac = Digest::MD5.new(key)
|
93
93
|
hmac.update(data)
|
94
|
-
return hmac.
|
94
|
+
return hmac.digest
|
95
95
|
},
|
96
96
|
:other_len => 0,
|
97
97
|
:other_data => nil,
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.
|
2
|
+
rubygems_version: 0.9.2
|
3
3
|
specification_version: 1
|
4
4
|
name: pNet-DNS
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0
|
7
|
-
date:
|
6
|
+
version: 1.0.0
|
7
|
+
date: 2007-05-29 00:00:00 +01:00
|
8
8
|
summary: Ruby port of perl Net::DNS
|
9
9
|
require_paths:
|
10
10
|
- lib
|
11
11
|
email: alexd@nominet.org.uk
|
12
|
-
homepage:
|
12
|
+
homepage: http://rubyforge.org/projects/pnet-dns/
|
13
13
|
rubyforge_project:
|
14
14
|
description:
|
15
15
|
autorequire: Net/DNS
|