dns_one 0.4.24 → 0.4.25

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
  SHA1:
3
- metadata.gz: 77fd667f7117637e11933cd243928f1a0642220a
4
- data.tar.gz: fcc9de0cf0843db0f7d76560bedabea8e5e13576
3
+ metadata.gz: 61b79c877f92aa27ce0f2a934564dbb6dfd5081e
4
+ data.tar.gz: d1a5fa9cf4fe59d40d94a0d37a94467781a5644a
5
5
  SHA512:
6
- metadata.gz: f29ab0a236819c202ec1eec373fc24c3e7e4ddc49f06aa9f87a2600f056200b5721ed7fb1b9904cebe811beac0ad3c1664f0b9854b3a34adfc49087937798597
7
- data.tar.gz: 22a61d2f79b2b1d89a1152e21ebe3f2af10b7367f22a2887670d6d0d323f9526ecdf45e08aacc92e887290c49184bd87157fbf85e53521fbbb04162a728aba22
6
+ metadata.gz: 0ba44dc2194fab4f8dda31969947e5589e4ea09f564df940f0548a3d6b41dc47d0cb55638f9e7ff20f5e2086e57eb0d2fa10943a1fc3d8b043e38fdf4b1112c9
7
+ data.tar.gz: a87d1bae6b44a3be9c79914aa4de83c0a09f86287a01a4b2db99cdf721ae30f4d5a356269f72207f541f5a570433f7662859fcaea34a8c11507b74d9935fbbd8
@@ -10,28 +10,24 @@ module DnsOne; module Backend; class DB
10
10
  def find dom_name, tries = 1
11
11
  return if tries > 3
12
12
 
13
- res = nil
13
+ sql = build_query dom_name
14
14
 
15
- begin
16
- # http://jakeyesbeck.com/2016/02/14/ruby-threads-and-active-record-connections/
17
- ActiveRecord::Base.connection_pool.with_connection do
18
- sql = build_query dom_name
19
- res = ActiveRecord::Base.connection.execute sql
20
- end
21
-
22
- rescue ActiveRecord::StatementInvalid => e
23
- Log.e "SQL query error. Trying to reconnect #{tries}. Details:\n#{e.desc}"
24
- # http://geoff.evason.name/2015/01/18/postgres-ssl-connection-has-been-closed-unexpectedly
25
- ActiveRecord::Base.connection.reconnect!
26
- find dom_name, (tries+1)
27
-
28
- rescue => e
29
- Log.e "SQL query error. Details:\n#{e.desc}"
15
+ # http://jakeyesbeck.com/2016/02/14/ruby-threads-and-active-record-connections/
16
+ res = ActiveRecord::Base.connection_pool.with_connection do
17
+ ActiveRecord::Base.connection.execute sql
30
18
  end
31
19
 
32
20
  first_record = res&.first
33
21
  record_values = first_record&.values
34
22
  record_values&.first
23
+
24
+ rescue ActiveRecord::StatementInvalid => e
25
+ Log.e "SQL query error. Trying to reconnect #{tries}. Details:\n#{e.desc}"
26
+ # http://geoff.evason.name/2015/01/18/postgres-ssl-connection-has-been-closed-unexpectedly
27
+ ActiveRecord::Base.connection.reconnect!
28
+ find dom_name, (tries+1)
29
+ rescue => e
30
+ Log.e "SQL query error. Details:\n#{e.desc}"
35
31
  end
36
32
 
37
33
  def allow_cache
@@ -1,3 +1,3 @@
1
1
  module DnsOne
2
- VERSION = "0.4.24"
2
+ VERSION = "0.4.25"
3
3
  end
@@ -6,6 +6,7 @@ require 'dns_one/backend/db'
6
6
  module DnsOne; class ZoneSearch
7
7
  include Singleton
8
8
 
9
+ DOM_REGEX = /^[a-z0-9]+([\-\.][a-z0-9]+)*\.[a-z]{2,6}$/i
9
10
  Name = Resolv::DNS::Name
10
11
  IN = Resolv::DNS::Resource::IN
11
12
 
@@ -23,6 +24,8 @@ module DnsOne; class ZoneSearch
23
24
  end
24
25
 
25
26
  def query dom_name, res_class, ip_address
27
+ return unless dom_name =~ DOM_REGEX
28
+
26
29
  dom_name = dom_name.dup
27
30
  res_class_short = Util.last_mod res_class # :A, :NS, found in conf.yml:record_sets items
28
31
  Log.d "request #{ dom_name }/#{res_class_short} from #{ip_address}..."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dns_one
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.24
4
+ version: 0.4.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Lobato
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-28 00:00:00.000000000 Z
11
+ date: 2017-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -155,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
- rubygems_version: 2.5.2
158
+ rubygems_version: 2.5.1
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: DNS server for many zones sharing only one or few records, written in Ruby.