dns-zone 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/HISTORY.md +1 -1
- data/lib/dns/zone.rb +3 -1
- data/lib/dns/zone/version.rb +1 -1
- data/test/zone_test.rb +8 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7808869b41dd69a298305fa61daab900891251f
|
4
|
+
data.tar.gz: 163eeab6827fd8387f2405175a9f27d0b8fb5367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4049dc65b9e82fb08cbdc8b3e0bd4fccbc13f1ae906852da1cfb28e149b3f34bd4a717ebfc29470efa9d4daf3d2533d70fa514a9949d421810ea506bb63a4c9d
|
7
|
+
data.tar.gz: 9dc5ec1a5236725d891c8be12ded6e9925c37be1960bcf2ec9f39f361dea12479c433ab0e42e95e3db07987f1851e2d26edfc53cb0381932fb0e9789f952cc80
|
data/HISTORY.md
CHANGED
data/lib/dns/zone.rb
CHANGED
@@ -70,7 +70,9 @@ module DNS
|
|
70
70
|
|
71
71
|
string.lines.each do |line|
|
72
72
|
# strip comments unless escaped
|
73
|
-
|
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
|
|
data/lib/dns/zone/version.rb
CHANGED
data/test/zone_test.rb
CHANGED
@@ -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
|
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'
|