dnsruby 1.71.0 → 1.72.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 269c27f2434453482847eab90060c2de583ca876e9056b8acff0c9df23a64a84
4
- data.tar.gz: 37c09c9a2c25f97cfd391ee8662de09b1698a44b189abe2cd75753579c87379a
3
+ metadata.gz: 59e143e5c778c710c41fc8773f011abe1bdb6502604202d41d2dc953af051792
4
+ data.tar.gz: 6fd89c7fe716e10af20c5b494102a47d8d33e51a5258b48dd959099266e7e7c8
5
5
  SHA512:
6
- metadata.gz: 6863374c8f220932c6aff08fce2a8afd1e38267f44f505121516580b69e4c5691a613d11b45e4227939586f6283743871834138bca06a8776a26f6b32c2141ad
7
- data.tar.gz: e58edc0688147d6c8e6576bf6144469d52b09120da7a7d7d0c00fc962579e1c49e23962264caa448d1bb54c70559e25e4663a176d95fe5282a43dba631233035
6
+ metadata.gz: 313f1b89fb446ce5c1f19d8910e1fe6ed21ef3f392b680e980bbedc9d98a7f5bb0844c52aa9422df6b525f0bcc4c249541c0e23b0cf3bcf8f139c8f98b4de913
7
+ data.tar.gz: 870efeeb297acf83b0a0c1b9cb5d832e138480e37bf8723986d74d43997998773195936bb4e5a035f579bb2c93806ce94a03bdc39d6c7e41fedb56fb303d1b80
@@ -6,8 +6,14 @@ jobs:
6
6
  build:
7
7
  runs-on: ubuntu-latest
8
8
  strategy:
9
+ fail-fast: false
9
10
  matrix:
10
11
  ruby: [ '3.1', '3.2', '3.3' ] # , 'ruby-head' ]
12
+ rubyopt: ['']
13
+ include:
14
+ - ruby: '3.3'
15
+ rubyopt: "--enable-frozen-string-literal --debug-frozen-string-literal"
16
+
11
17
  name: Ruby ${{ matrix.ruby }} tests
12
18
  steps:
13
19
  - uses: actions/checkout@v2
@@ -15,9 +21,6 @@ jobs:
15
21
  uses: ruby/setup-ruby@v1
16
22
  with:
17
23
  ruby-version: ${{ matrix.ruby }}
18
- - name: Bundle install
19
- run: |
20
- gem install bundler
21
- bundle install --jobs 4 --retry 3
22
- - name: Run tests
23
- run: bundle exec rake test
24
+ bundler-cache: true
25
+ - name: Run tests ${{ matrix.rubyopt }}
26
+ run: bundle exec rake test RUBYOPT="${{ matrix.rubyopt }}"
data/RELEASE_NOTES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release Notes
2
2
 
3
+ ## v.1.72.1
4
+
5
+ * Add issuemail CAA record support - thanks Ryan Doherty!
6
+
7
+ ## v.1.72.0
8
+
9
+ * Fix compatibility with the `--enable-string-literal` Ruby option - thanks Jean byroot Boussier!
10
+
3
11
  ## v.1.71.0
4
12
 
5
13
  * Fix assigning public_key in ECDSA - thanks Jiří Kubíček!
@@ -15,7 +15,7 @@ module Dnsruby
15
15
 
16
16
  # Converts from a binary string to a number, e.g. "\x01\x00" => 256
17
17
  def binary_string_to_number(string)
18
- string = string.clone.force_encoding(Encoding::ASCII_8BIT)
18
+ string = string.b
19
19
  string.bytes.inject(0) do |number, byte|
20
20
  number * 256 + byte.ord
21
21
  end
@@ -25,7 +25,7 @@ module Dnsruby
25
25
  # Converts a number to a binary encoded string, e.g. 256 => "\x01\x00"
26
26
  def number_to_binary_string(number, min_length = 0)
27
27
  assert_non_negative(number)
28
- binary_string = ''.force_encoding(Encoding::ASCII_8BIT)
28
+ binary_string = ''.b
29
29
 
30
30
  while number > 0
31
31
  byte_value = number & 0xFF
@@ -70,7 +70,8 @@ module Dnsruby
70
70
  # (RFC3597)
71
71
  # See typesbyval and typesbyname, these beasts have the same functionality
72
72
  def Classes.classesbyname(name) #:nodoc: all
73
- name.upcase!;
73
+ name = name.upcase
74
+
74
75
  if to_code(name)
75
76
  return to_code(name)
76
77
  end
@@ -202,7 +203,7 @@ module Dnsruby
202
203
  # mnemonic. If the TYPE mapping is not specified the generic mnemonic
203
204
  # TYPE### is returned.
204
205
  def Types.typesbyname(name) #:nodoc: all
205
- name.upcase!
206
+ name = name.upcase
206
207
 
207
208
  if to_code(name)
208
209
  return to_code(name)
data/lib/dnsruby/ipv6.rb CHANGED
@@ -57,14 +57,14 @@ module Dnsruby
57
57
  when IPv6
58
58
  return arg
59
59
  when String
60
- address = ''
60
+ address = +''
61
61
  if Regex_8Hex =~ arg
62
62
  arg.scan(/[0-9A-Fa-f]+/) {|hex| address << [hex.hex].pack('n')}
63
63
  elsif Regex_CompressedHex =~ arg
64
64
  prefix = $1
65
65
  suffix = $2
66
- a1 = ''
67
- a2 = ''
66
+ a1 = +''
67
+ a2 = +''
68
68
  prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
69
69
  suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
70
70
  omitlen = 16 - a1.length - a2.length
@@ -80,8 +80,8 @@ module Dnsruby
80
80
  elsif Regex_CompressedHex4Dec =~ arg
81
81
  prefix, suffix, a, b, c, d = $1, $2, $3.to_i, $4.to_i, $5.to_i, $6.to_i
82
82
  if (0..255) === a && (0..255) === b && (0..255) === c && (0..255) === d
83
- a1 = ''
84
- a2 = ''
83
+ a1 = +''
84
+ a2 = +''
85
85
  prefix.scan(/[0-9A-Fa-f]+/) {|hex| a1 << [hex.hex].pack('n')}
86
86
  suffix.scan(/[0-9A-Fa-f]+/) {|hex| a2 << [hex.hex].pack('n')}
87
87
  omitlen = 12 - a1.length - a2.length
@@ -1,7 +1,7 @@
1
1
  module Dnsruby
2
2
  class MessageEncoder #:nodoc: all
3
3
  def initialize
4
- @data = ''
4
+ @data = +''
5
5
  @names = {}
6
6
  yield self if block_given?
7
7
  end
@@ -408,7 +408,7 @@ module Dnsruby
408
408
  end
409
409
 
410
410
  def to_s
411
- s = '' # the output string to return
411
+ s = +'' # the output string to return
412
412
 
413
413
  if @answerfrom && (! @answerfrom.empty?)
414
414
  s << ";; Answer received from #{@answerfrom} (#{@answersize} bytes)\n;;\n"
@@ -457,7 +457,7 @@ module Dnsruby
457
457
 
458
458
 
459
459
  def old_to_s
460
- retval = ''
460
+ retval = +''
461
461
 
462
462
  if (@answerfrom != nil && @answerfrom != '')
463
463
  retval = retval + ";; Answer received from #{@answerfrom} (#{@answersize} bytes)\n;;\n"
@@ -500,7 +500,7 @@ module Dnsruby
500
500
  return nil
501
501
  end
502
502
 
503
- known_zone.sub!(/\.*$/, ".")
503
+ known_zone = known_zone.sub(/\.*$/, ".")
504
504
 
505
505
  ns = [] # Array of AddressCaches (was array of array of addresses)
506
506
  @@mutex.synchronize{
@@ -43,7 +43,7 @@ module Dnsruby
43
43
  end
44
44
 
45
45
  def from_string(input) #:nodoc: all
46
- matches = (/(\d+) (issuewild|issue|iodef|contactemail|contactphone) "(.+)"$/).match(input)
46
+ matches = (/(\d+) (issuewild|issuemail|issue|iodef|contactemail|contactphone) "(.+)"$/).match(input)
47
47
  @flag = matches[1]
48
48
  @property_tag = matches[2]
49
49
  @property_value = matches[3]
@@ -104,7 +104,7 @@ module Dnsruby
104
104
  end
105
105
 
106
106
  def self.build_rdata(longitude, latitude, altitude)
107
- binary_string = ''.force_encoding('ASCII-8BIT')
107
+ binary_string = ''.b
108
108
 
109
109
  binary_string << longitude.length.chr
110
110
  binary_string << longitude
@@ -152,7 +152,7 @@ module Dnsruby
152
152
  end
153
153
 
154
154
  def self.encode_types(nsec)
155
- output = ''
155
+ output = +''
156
156
  # types represents all 65536 possible RR types.
157
157
  # Split up types into sets of 256 different types.
158
158
  type_codes = []
@@ -171,7 +171,7 @@ module Dnsruby
171
171
 
172
172
  unless types_to_go.empty?
173
173
  # Then create the bitmap for them
174
- bitmap = ''
174
+ bitmap = +''
175
175
  # keep on adding them until there's none left
176
176
  pos = 0
177
177
  bitmap_pos = 0
@@ -95,7 +95,7 @@ class NXT < RR
95
95
  next_domain = Name.create(next_domain) if next_domain.is_a?(String)
96
96
  types = TypeBitmap.from_type_codes(types) if types.is_a?(Array)
97
97
 
98
- binary_string = ''.force_encoding('ASCII-8BIT')
98
+ binary_string = ''.b
99
99
  binary_string << next_domain.canonical
100
100
  binary_string << BitMapping.reverse_binary_string_bits(types.to_binary_string)
101
101
  binary_string
@@ -63,7 +63,7 @@ module Dnsruby
63
63
  unquoted = false
64
64
  seen_strings = false
65
65
  pos = 0
66
- input.sub!(/^\s*\(\s*/, "")
66
+ input = input.sub(/^\s*\(\s*/, "")
67
67
  input.sub!(/\s*\)\s*$/, "")
68
68
  input.each_char {|c|
69
69
  if (((c == "'") || (c == '"')) && (!in_escaped) && (!unquoted))
@@ -414,12 +414,12 @@ module Dnsruby
414
414
  # Keep buffer for all TCP sockets, and return
415
415
  # to select after reading available data. Once all data has been received,
416
416
  # then process message.
417
- buf=""
417
+ buf = +""
418
418
  expected_length = 0
419
419
  @@mutex.synchronize {
420
420
  buf, expected_length = @@tcp_buffers[socket]
421
421
  if (!buf)
422
- buf = ""
422
+ buf = +""
423
423
  expected_length = 2
424
424
  @@tcp_buffers[socket]=[buf, expected_length]
425
425
  end
@@ -443,7 +443,7 @@ module Dnsruby
443
443
 
444
444
  return false
445
445
  end
446
- buf << input
446
+ buf << input if input
447
447
  rescue
448
448
  # Oh well - better luck next time!
449
449
  return false
@@ -455,7 +455,7 @@ module Dnsruby
455
455
  # We just read the data_length field. Now we need to start reading that many bytes.
456
456
  @@mutex.synchronize {
457
457
  answersize = buf.unpack('n')[0]
458
- @@tcp_buffers[socket] = ["", answersize]
458
+ @@tcp_buffers[socket] = [+"", answersize]
459
459
  }
460
460
  return tcp_read(socket)
461
461
  else
@@ -773,7 +773,7 @@ module Dnsruby
773
773
  }.to_s # @TODO@ worry about wildcards here?
774
774
  rec.ttl = old_ttl
775
775
  if (RUBY_VERSION >= "1.9")
776
- data.force_encoding("ASCII-8BIT")
776
+ data.force_encoding(Encoding::BINARY)
777
777
  end
778
778
  sig_data += data
779
779
  end
@@ -1,3 +1,3 @@
1
1
  module Dnsruby
2
- VERSION = '1.71.0'
2
+ VERSION = '1.72.1'
3
3
  end
data/test/spec_helper.rb CHANGED
@@ -5,8 +5,12 @@ if Warning.respond_to?(:[]=)
5
5
  end
6
6
 
7
7
  if ENV['RUN_EXTRA_TASK'] == 'TRUE'
8
- require 'coveralls'
9
- Coveralls.wear!
8
+ unless "test".frozen?
9
+ # Coverall setup term-ansi-color which isn't yet frozen string literal compatible
10
+ # Ref: https://github.com/flori/term-ansicolor/pull/38
11
+ require 'coveralls'
12
+ Coveralls.wear!
13
+ end
10
14
 
11
15
  require 'simplecov'
12
16
 
data/test/tc_caa.rb CHANGED
@@ -25,6 +25,7 @@ class TestCAA < Minitest::Test
25
25
  {'foo.com. IN CAA 0 issue "ca.example.net"' => [0, 'issue', 'ca.example.net'],
26
26
  'foo.com. IN CAA 1 issue "ca.example.net"' => [1, 'issue', 'ca.example.net'],
27
27
  'foo.com. IN CAA 0 issuewild "ca.example.net"' => [0, 'issuewild', 'ca.example.net'],
28
+ 'foo.com. IN CAA 0 issuemail "ca.example.net"' => [0, 'issuemail', 'ca.example.net'],
28
29
  'foo.com. IN CAA 0 iodef "mailto:security@example.com"' => [0, 'iodef', 'mailto:security@example.com'],
29
30
  'foo.com. IN CAA 0 issue "ca.example.net; account=230123"' => [0, 'issue', 'ca.example.net; account=230123']
30
31
  }.each do |text, data|
data/test/tc_gpos.rb CHANGED
@@ -93,7 +93,7 @@ class TestGPOS < Minitest::Test
93
93
  response_binary = "E0\x84\x80\x00\x01\x00\x01\x00\x01\x00\x01\x01a\adnsruby\x03com\x00\x00\e\x00\x01\xC0\f\x00\e\x00\x01\x00\x00*0\x00\x0F\x0410.0\x0420.0\x0430.0\xC0\x0E\x00\x02\x00\x01\x00\x00*0\x00\x06\x03ns1\xC0\x0E\xC0F\x00\x01\x00\x01\x00\x00*0\x00\x04\x7F\x00\x00\x01"
94
94
  message_object = Message.decode(response_binary)
95
95
  reconstructed_binary = message_object.encode
96
- assert_equal response_binary.force_encoding('ASCII-8BIT'), reconstructed_binary
96
+ assert_equal response_binary.b, reconstructed_binary
97
97
  end
98
98
  end
99
99
 
data/test/tc_message.rb CHANGED
@@ -86,7 +86,7 @@ class TestMessage < Minitest::Test
86
86
  end
87
87
 
88
88
  def test_equals
89
- response_as_string = "\x10\a\x81\x90\x00\x01\x00\x04\x00\x00\x00\x06\x03cnn\x03com\x00\x00\x02\x00\x01\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x14\x03ns3\ntimewarner\x03net\x00\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x11\x03ns2\x03p42\x06dynect\xC04\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x06\x03ns1\xC0)\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x06\x03ns1\xC0I\xC0%\x00\x01\x00\x01\x00\x001\xA2\x00\x04\xC7\aD\xEE\xC0E\x00\x01\x00\x01\x00\x00\xB1\x0E\x00\x04\xCC\r\xFA*\xC0b\x00\x01\x00\x01\x00\x009`\x00\x04\xCCJl\xEE\xC0t\x00\x01\x00\x01\x00\x00\xBDg\x00\x04\xD0NF*\xC0t\x00\x1C\x00\x01\x00\x00\x00\xBB\x00\x10 \x01\x05\x00\x00\x90\x00\x01\x00\x00\x00\x00\x00\x00\x00B\x00\x00)\x0F\xA0\x00\x00\x80\x00\x00\x00".force_encoding("ASCII-8BIT")
89
+ response_as_string = "\x10\a\x81\x90\x00\x01\x00\x04\x00\x00\x00\x06\x03cnn\x03com\x00\x00\x02\x00\x01\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x14\x03ns3\ntimewarner\x03net\x00\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x11\x03ns2\x03p42\x06dynect\xC04\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x06\x03ns1\xC0)\xC0\f\x00\x02\x00\x01\x00\x01QC\x00\x06\x03ns1\xC0I\xC0%\x00\x01\x00\x01\x00\x001\xA2\x00\x04\xC7\aD\xEE\xC0E\x00\x01\x00\x01\x00\x00\xB1\x0E\x00\x04\xCC\r\xFA*\xC0b\x00\x01\x00\x01\x00\x009`\x00\x04\xCCJl\xEE\xC0t\x00\x01\x00\x01\x00\x00\xBDg\x00\x04\xD0NF*\xC0t\x00\x1C\x00\x01\x00\x00\x00\xBB\x00\x10 \x01\x05\x00\x00\x90\x00\x01\x00\x00\x00\x00\x00\x00\x00B\x00\x00)\x0F\xA0\x00\x00\x80\x00\x00\x00".b
90
90
  message = Message.decode(response_as_string)
91
91
  assert(message == message, message.to_s)
92
92
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dnsruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.71.0
4
+ version: 1.72.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Dalitz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-11 00:00:00.000000000 Z
11
+ date: 2024-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -336,7 +336,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
336
336
  - !ruby/object:Gem::Version
337
337
  version: '0'
338
338
  requirements: []
339
- rubygems_version: 3.5.3
339
+ rubygems_version: 3.2.30
340
340
  signing_key:
341
341
  specification_version: 4
342
342
  summary: Ruby DNS(SEC) implementation