auth_dns_check 0.2.0 → 0.3.0

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: 2ce2d9f93dd5a2d8201b420bd5b7bf570dc019a8aa55206263787871d1c60052
4
- data.tar.gz: 0cc5585ba4a40af75e6eed17cb8188195616d7d4b500f7da4b566f3a8f008f3c
3
+ metadata.gz: 22c37a6683b09a94fca8de172138b353213f34db8ef4cff9ca5dc0c0235e13bc
4
+ data.tar.gz: b90bc601c6fc5683829e0dd11353410b1a7ad97fef481dee7bc75e67f1aee43e
5
5
  SHA512:
6
- metadata.gz: bfa7db53ed72044c4d8c3a09315875b9496836ca35eac53ebcda6e43d631b0b1322d3f82b1d9a61b59b6c0db528d7103e07885c842504d18b3e48d245b181cdc
7
- data.tar.gz: da427b2d7d45597983596664749a0a42fafcd92a73fac24d668c366578c3c444bc9eb480d4180e30e8c654b5d970d013480be6e31b4cc234efb2702e76ea4f0b
6
+ metadata.gz: 82db5eb1fe0e5e9b0a4a85ade3327823ea0ab1e6c976081652f7795e08a88c13fdd72cde8094426fa7c805716fda193c49ac0d441ae7e701c0a972218ad4983e
7
+ data.tar.gz: 9c6d450d60076a196fa3867e027ba96c3ec5383cc74bf2c6e14bcf145e47ca057a7e7abf05484be3625c1f7bc7d25a2ed0198187de7cca0e31991369cd105375
data/.gitignore CHANGED
@@ -9,3 +9,6 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+
13
+ # gems should not include Gemfile.lock
14
+ Gemfile.lock
@@ -9,9 +9,12 @@ $TTL 86400
9
9
  ;
10
10
  NS dns1
11
11
  NS dns2
12
+ ;
12
13
  dns1 IN A 10.0.0.251
13
14
  dns2 IN A 10.0.0.252
14
15
  ;
16
+ @ IN A 127.0.0.1
17
+ ;
15
18
  same IN A 127.0.0.1
16
19
  different IN A 127.0.0.1
17
20
  ;
@@ -20,3 +23,5 @@ multi-same IN A 127.0.0.3
20
23
  ;
21
24
  multi-different IN A 127.0.0.1
22
25
  multi-different IN A 127.0.0.3
26
+ ;
27
+ same.dotted IN A 127.0.0.1
@@ -9,9 +9,12 @@ $TTL 86400
9
9
  ;
10
10
  NS dns1
11
11
  NS dns2
12
+ ;
12
13
  dns1 IN A 10.0.0.251
13
14
  dns2 IN A 10.0.0.252
14
15
  ;
16
+ @ IN A 127.0.0.1
17
+ ;
15
18
  same IN A 127.0.0.1
16
19
  different IN A 127.0.0.2
17
20
  ;
@@ -20,3 +23,5 @@ multi-same IN A 127.0.0.1
20
23
  ;
21
24
  multi-different IN A 127.0.0.3
22
25
  multi-different IN A 127.0.0.2
26
+ ;
27
+ same.dotted IN A 127.0.0.1
@@ -28,13 +28,25 @@ module AuthDnsCheck
28
28
  end
29
29
 
30
30
  def get_authoritatives(fqdn)
31
- authoritatives_for(fqdn).tap do |auths|
32
- auths.any? or raise(Error, "no name servers found for #{fqdn}")
31
+ find_zone(fqdn) { |zone| overridden_authoritatives_for(zone) } or
32
+ overridden_authoritatives_for(:default) or
33
+ find_zone(fqdn) { |zone| default_authoritatives_for(zone) } or
34
+ raise Error.new("no name servers found for #{fqdn}")
35
+ end
36
+
37
+ def find_zone(fqdn)
38
+ zone = fqdn
39
+ while zone
40
+ auths = yield(zone)
41
+ if auths and auths.any?
42
+ break auths
43
+ else
44
+ _, zone = zone.split(".", 2)
45
+ end
33
46
  end
34
47
  end
35
48
 
36
- def authoritatives_for(fqdn)
37
- zone = fqdn.gsub(/\A[^.]+\./, '')
49
+ def authoritatives_for(zone)
38
50
  overridden_authoritatives_for(zone) || overridden_authoritatives_for(:default) || default_authoritatives_for(zone)
39
51
  end
40
52
 
@@ -1,3 +1,3 @@
1
1
  module AuthDnsCheck
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: auth_dns_check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheldon Hearn
@@ -64,7 +64,6 @@ files:
64
64
  - ".travis.yml"
65
65
  - Dockerfile
66
66
  - Gemfile
67
- - Gemfile.lock
68
67
  - LICENSE.txt
69
68
  - README.md
70
69
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,35 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- auth_dns_check (0.1.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- diff-lcs (1.3)
10
- rake (13.0.1)
11
- rspec (3.9.0)
12
- rspec-core (~> 3.9.0)
13
- rspec-expectations (~> 3.9.0)
14
- rspec-mocks (~> 3.9.0)
15
- rspec-core (3.9.2)
16
- rspec-support (~> 3.9.3)
17
- rspec-expectations (3.9.2)
18
- diff-lcs (>= 1.2.0, < 2.0)
19
- rspec-support (~> 3.9.0)
20
- rspec-mocks (3.9.1)
21
- diff-lcs (>= 1.2.0, < 2.0)
22
- rspec-support (~> 3.9.0)
23
- rspec-support (3.9.3)
24
-
25
- PLATFORMS
26
- ruby
27
-
28
- DEPENDENCIES
29
- auth_dns_check!
30
- bundler (< 3)
31
- rake (~> 13.0)
32
- rspec (~> 3.0)
33
-
34
- BUNDLED WITH
35
- 2.0.1