dns-zone 0.1.2 → 0.1.3

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: 43bf2ff0efe2b96de54bf7bbc3884a454a107c7f
4
- data.tar.gz: 980b0210b442792230f6506d03ed5bd34455f361
3
+ metadata.gz: e7808869b41dd69a298305fa61daab900891251f
4
+ data.tar.gz: 163eeab6827fd8387f2405175a9f27d0b8fb5367
5
5
  SHA512:
6
- metadata.gz: 1b0a1fc1c39fdb7c461b2b8fa9377532ca2124d82addc7efb4116640a9ba19c4201e5d2a06ca16385a69d8da191594af4346e8f6fe7d7b6a99ec2bc48f8a932a
7
- data.tar.gz: a5d732f576b589ff0fd9d612e81e478fe4a28fc1270cecd8252f613c4b80e4766469ed94ba25ee9631a8352e4554a6485ec6288ec4233fad3fdf80a7da824bc9
6
+ metadata.gz: 4049dc65b9e82fb08cbdc8b3e0bd4fccbc13f1ae906852da1cfb28e149b3f34bd4a717ebfc29470efa9d4daf3d2533d70fa514a9949d421810ea506bb63a4c9d
7
+ data.tar.gz: 9dc5ec1a5236725d891c8be12ded6e9925c37be1960bcf2ec9f39f361dea12479c433ab0e42e95e3db07987f1851e2d26edfc53cb0381932fb0e9789f952cc80
data/HISTORY.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## HEAD
2
2
 
3
- ## 0.1.2 (2014-10-21)
3
+ ## 0.1.3 (2014-10-21)
4
4
 
5
5
  * Fix TXT record parsing bug, when quote enclosed RDATA contained semicolons.
6
6
 
@@ -70,7 +70,9 @@ module DNS
70
70
 
71
71
  string.lines.each do |line|
72
72
  # strip comments unless escaped
73
- line = line.gsub(/(?<!\\);.*/o, '').chomp
73
+ # strip comments, unless its escaped.
74
+ # skip semicolons within "quote segments" (TXT records)
75
+ line = line.gsub(/((?<!\\);)(?=(?:[^"]|"[^"]*")*$).*/o, "").chomp
74
76
 
75
77
  next if line.gsub(/\s+/, '').empty?
76
78
 
@@ -1,6 +1,6 @@
1
1
  module DNS
2
2
  class Zone
3
3
  # Version number (major.minor.tiny)
4
- Version = '0.1.2'
4
+ Version = '0.1.3'
5
5
  end
6
6
  end
@@ -33,6 +33,7 @@ foo IN TXT "part1""part2"
33
33
  bar IN TXT ("part1 "
34
34
  "part2 "
35
35
  "part3")
36
+ _domainkey IN TXT "t=y; o=~;"
36
37
 
37
38
  longttl 5d IN A 10.1.2.3
38
39
 
@@ -75,7 +76,7 @@ EOL
75
76
  # test attributes are correct.
76
77
  assert_equal '3d', zone.ttl, 'check ttl matches example input'
77
78
  assert_equal 'lividpenguin.com.', zone.origin, 'check origin matches example input'
78
- assert_equal 18, zone.records.length, 'we should have multiple records (including SOA)'
79
+ assert_equal 19, zone.records.length, 'we should have multiple records (including SOA)'
79
80
 
80
81
  #p ''
81
82
  #zone.records.each do |rec|
@@ -122,6 +123,12 @@ EOL
122
123
  assert_equal 'maiow IN TXT "purr"', entries[0], 'entry should match expected'
123
124
  end
124
125
 
126
+ def test_extract_entry_including_semicolon_within_quotes
127
+ entries = DNS::Zone.extract_entries(%Q{_domainkey IN TXT "t=y; o=~;"})
128
+ assert_equal 1, entries.length, 'we should have 1 entry'
129
+ assert_equal '_domainkey IN TXT "t=y; o=~;"', entries[0], 'entry should match expected'
130
+ end
131
+
125
132
  def test_extract_entry_should_ignore_comments
126
133
  entries = DNS::Zone.extract_entries(%Q{maiow IN TXT "purr"; this is a comment})
127
134
  assert_equal 1, entries.length, 'we should have 1 entry'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns-zone
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke Antins