dns-zone 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e122134a75d02f715b12de84ddefa330594b8ef
4
- data.tar.gz: 94f944642ce7f3edf19a532df43a17ce7e4d2a8c
3
+ metadata.gz: 43bf2ff0efe2b96de54bf7bbc3884a454a107c7f
4
+ data.tar.gz: 980b0210b442792230f6506d03ed5bd34455f361
5
5
  SHA512:
6
- metadata.gz: b49b1e6ec8e1effe4e08610f3a22ea51f80b154f247f2f5194ebb961225fad80547ccc62011872e1822a3472f82af01ea40508584e7192c6f4a1c76024e34002
7
- data.tar.gz: a53df7534fe28eca05e5c0340c40ca89c257ed0a10245bd1ab60a622cad0845d77e2ec4b89c719eb0f82402b6292fad7f8234a3cf80b5ebbb81edb5410a38b97
6
+ metadata.gz: 1b0a1fc1c39fdb7c461b2b8fa9377532ca2124d82addc7efb4116640a9ba19c4201e5d2a06ca16385a69d8da191594af4346e8f6fe7d7b6a99ec2bc48f8a932a
7
+ data.tar.gz: a5d732f576b589ff0fd9d612e81e478fe4a28fc1270cecd8252f613c4b80e4766469ed94ba25ee9631a8352e4554a6485ec6288ec4233fad3fdf80a7da824bc9
data/HISTORY.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 0.1.2 (2014-10-21)
4
+
5
+ * Fix TXT record parsing bug, when quote enclosed RDATA contained semicolons.
6
+
3
7
  ## 0.1.1 (2014-03-30)
4
8
 
5
9
  * Remove `required_ruby_version` from gemspec.
@@ -20,7 +20,8 @@ module DNS
20
20
  # @return [Object]
21
21
  def self.load(string, options = {})
22
22
  # strip comments, unless its escaped.
23
- string.gsub!(/(?<!\\);.*/o, "");
23
+ # skip semicolons within "quote segments" (TXT records)
24
+ string.gsub!(/((?<!\\);)(?=(?:[^"]|"[^"]*")*$).*/o, "")
24
25
 
25
26
  captures = string.match(REGEX_RR)
26
27
  return nil unless captures
@@ -63,7 +63,8 @@ class DNS::Zone::RR::Record
63
63
  # @return [String] remaining RDATA
64
64
  def load_general_and_get_rdata(string, options = {})
65
65
  # strip comments, unless its escaped.
66
- string.gsub!(/(?<!\\);.*/o, "");
66
+ # skip semicolons within "quote segments" (TXT records)
67
+ string.gsub!(/((?<!\\);)(?=(?:[^"]|"[^"]*")*$).*/o, "")
67
68
 
68
69
  captures = string.match(DNS::Zone::RR::REGEX_RR)
69
70
  return nil unless captures
@@ -1,6 +1,6 @@
1
1
  module DNS
2
2
  class Zone
3
3
  # Version number (major.minor.tiny)
4
- Version = '0.1.1'
4
+ Version = '0.1.2'
5
5
  end
6
6
  end
@@ -27,6 +27,14 @@ class RRTest < DNS::Zone::TestCase
27
27
  assert_equal 'TXT', rr.type
28
28
  assert_equal 'test text', rr.text
29
29
  end
30
+
31
+ def test_load_txt_semicolon_rr
32
+ rr = DNS::Zone::RR.load('_domainkey IN TXT "t=y; o=~;"')
33
+ assert_instance_of DNS::Zone::RR::TXT, rr, 'should be instance of TXT RR'
34
+ assert_equal '_domainkey', rr.label
35
+ assert_equal 'TXT', rr.type
36
+ assert_equal 't=y; o=~;', rr.text
37
+ end
30
38
 
31
39
  def test_load_a_rr_with_options_hash
32
40
  rr = DNS::Zone::RR.load(' IN A 10.2.3.1', { last_label: 'www' })
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns-zone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Antins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-30 00:00:00.000000000 Z
11
+ date: 2014-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -188,7 +188,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
188
188
  version: '0'
189
189
  requirements: []
190
190
  rubyforge_project:
191
- rubygems_version: 2.2.0
191
+ rubygems_version: 2.4.1
192
192
  signing_key:
193
193
  specification_version: 4
194
194
  summary: A Ruby library for building and parsing DNS zone files.