dyndnsd 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/exe/dyndnsd +6 -0
- data/lib/dyndnsd.rb +1 -1
- data/lib/dyndnsd/database.rb +1 -0
- data/lib/dyndnsd/generator/bind.rb +1 -0
- data/lib/dyndnsd/helper.rb +1 -0
- data/lib/dyndnsd/responder/dyndns_style.rb +1 -0
- data/lib/dyndnsd/responder/rest_style.rb +1 -0
- data/lib/dyndnsd/textfile_reporter.rb +1 -0
- data/lib/dyndnsd/updater/command_with_bind_zone.rb +1 -0
- data/lib/dyndnsd/version.rb +2 -1
- metadata +38 -61
- data/.gitignore +0 -4
- data/.rubocop.yml +0 -87
- data/.solargraph.yml +0 -16
- data/.travis.yml +0 -12
- data/Gemfile +0 -3
- data/Rakefile +0 -22
- data/bin/dyndnsd +0 -4
- data/dyndnsd.gemspec +0 -37
- data/spec/daemon_spec.rb +0 -240
- data/spec/spec_helper.rb +0 -8
- data/spec/support/dummy_database.rb +0 -27
- data/spec/support/dummy_updater.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38018d9a0981b3c2a641440f3848eebadac2ca688e22cd3d3f48dca362ecbb72
|
4
|
+
data.tar.gz: 98685b2439de5962c7e6ebb6aee708e361541f2cc9be83f4f21b28fe8f8af873
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1057f502a1bbe3e99c6282747765bc25d7e9a2f37c7409e50969847fe353e877c6eefb698099bf148543a6412cd0c6e33df3039a0099551391c8dfb0cdb5e80f
|
7
|
+
data.tar.gz: dcce864fad0992c9868394000286cb6200512e1103017d373358aa3c71c89a94e27796c8bfd11a11ec96fe6d63fc3318938942621178cf111879863fad7347cf
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 2.2.0 (March 6, 2020)
|
4
|
+
|
5
|
+
IMPROVEMENTS:
|
6
|
+
|
7
|
+
- Refactor gemspec based on [recommendations](https://piotrmurach.com/articles/writing-a-ruby-gem-specification/) so tests are now excluded from gem and binaries move to `./exe` directory
|
8
|
+
- Adopt Ruby 2.3 frozen string literals for source code potentially reducing memory consumption
|
9
|
+
|
3
10
|
## 2.1.1 (March 1, 2020)
|
4
11
|
|
5
12
|
IMPROVEMENTS:
|
data/exe/dyndnsd
ADDED
data/lib/dyndnsd.rb
CHANGED
data/lib/dyndnsd/database.rb
CHANGED
data/lib/dyndnsd/helper.rb
CHANGED
data/lib/dyndnsd/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dyndnsd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Nicolai
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: jaeger-client
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.10.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
26
|
+
version: 0.10.0
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: metriks
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -67,33 +53,33 @@ dependencies:
|
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: 0.5.0
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rack
|
56
|
+
name: rack
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
59
|
- - "~>"
|
74
60
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
61
|
+
version: '2.0'
|
76
62
|
type: :runtime
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
66
|
- - "~>"
|
81
67
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
68
|
+
version: '2.0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
70
|
+
name: rack-tracer
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
73
|
- - "~>"
|
88
74
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
75
|
+
version: 0.9.0
|
90
76
|
type: :runtime
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
80
|
- - "~>"
|
95
81
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
82
|
+
version: 0.9.0
|
97
83
|
- !ruby/object:Gem::Dependency
|
98
84
|
name: bundler
|
99
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,21 +95,21 @@ dependencies:
|
|
109
95
|
- !ruby/object:Gem::Version
|
110
96
|
version: '0'
|
111
97
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
98
|
+
name: bundler-audit
|
113
99
|
requirement: !ruby/object:Gem::Requirement
|
114
100
|
requirements:
|
115
|
-
- - "
|
101
|
+
- - "~>"
|
116
102
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
103
|
+
version: 0.6.0
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
107
|
requirements:
|
122
|
-
- - "
|
108
|
+
- - "~>"
|
123
109
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
110
|
+
version: 0.6.0
|
125
111
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
112
|
+
name: rack-test
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
128
114
|
requirements:
|
129
115
|
- - ">="
|
@@ -137,7 +123,7 @@ dependencies:
|
|
137
123
|
- !ruby/object:Gem::Version
|
138
124
|
version: '0'
|
139
125
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
126
|
+
name: rake
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
142
128
|
requirements:
|
143
129
|
- - ">="
|
@@ -151,33 +137,33 @@ dependencies:
|
|
151
137
|
- !ruby/object:Gem::Version
|
152
138
|
version: '0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
|
-
name:
|
140
|
+
name: rspec
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
|
-
- - "
|
143
|
+
- - ">="
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0
|
145
|
+
version: '0'
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
|
-
- - "
|
150
|
+
- - ">="
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version: 0
|
152
|
+
version: '0'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
|
-
name:
|
154
|
+
name: rubocop
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
170
156
|
requirements:
|
171
157
|
- - "~>"
|
172
158
|
- !ruby/object:Gem::Version
|
173
|
-
version: 0.
|
159
|
+
version: 0.80.0
|
174
160
|
type: :development
|
175
161
|
prerelease: false
|
176
162
|
version_requirements: !ruby/object:Gem::Requirement
|
177
163
|
requirements:
|
178
164
|
- - "~>"
|
179
165
|
- !ruby/object:Gem::Version
|
180
|
-
version: 0.
|
166
|
+
version: 0.80.0
|
181
167
|
- !ruby/object:Gem::Dependency
|
182
168
|
name: solargraph
|
183
169
|
requirement: !ruby/object:Gem::Requirement
|
@@ -194,23 +180,19 @@ dependencies:
|
|
194
180
|
version: '0'
|
195
181
|
description: A small, lightweight and extensible DynDNS server written with Ruby and
|
196
182
|
Rack.
|
197
|
-
email:
|
183
|
+
email:
|
198
184
|
executables:
|
199
185
|
- dyndnsd
|
200
186
|
extensions: []
|
201
|
-
extra_rdoc_files:
|
187
|
+
extra_rdoc_files:
|
188
|
+
- README.md
|
189
|
+
- CHANGELOG.md
|
190
|
+
- LICENSE
|
202
191
|
files:
|
203
|
-
- ".gitignore"
|
204
|
-
- ".rubocop.yml"
|
205
|
-
- ".solargraph.yml"
|
206
|
-
- ".travis.yml"
|
207
192
|
- CHANGELOG.md
|
208
|
-
- Gemfile
|
209
193
|
- LICENSE
|
210
194
|
- README.md
|
211
|
-
-
|
212
|
-
- bin/dyndnsd
|
213
|
-
- dyndnsd.gemspec
|
195
|
+
- exe/dyndnsd
|
214
196
|
- init.d/debian-6-dyndnsd
|
215
197
|
- lib/dyndnsd.rb
|
216
198
|
- lib/dyndnsd/database.rb
|
@@ -221,14 +203,13 @@ files:
|
|
221
203
|
- lib/dyndnsd/textfile_reporter.rb
|
222
204
|
- lib/dyndnsd/updater/command_with_bind_zone.rb
|
223
205
|
- lib/dyndnsd/version.rb
|
224
|
-
- spec/daemon_spec.rb
|
225
|
-
- spec/spec_helper.rb
|
226
|
-
- spec/support/dummy_database.rb
|
227
|
-
- spec/support/dummy_updater.rb
|
228
206
|
homepage: https://github.com/cmur2/dyndnsd
|
229
207
|
licenses:
|
230
208
|
- Apache-2.0
|
231
|
-
metadata:
|
209
|
+
metadata:
|
210
|
+
bug_tracker_uri: https://github.com/cmur2/dyndnsd/issues
|
211
|
+
changelog_uri: https://github.com/cmur2/dyndnsd/blob/master/CHANGELOG.md
|
212
|
+
source_code_uri: https://github.com/cmur2/dyndnsd
|
232
213
|
post_install_message:
|
233
214
|
rdoc_options: []
|
234
215
|
require_paths:
|
@@ -248,8 +229,4 @@ rubygems_version: 3.0.6
|
|
248
229
|
signing_key:
|
249
230
|
specification_version: 4
|
250
231
|
summary: dyndnsd.rb
|
251
|
-
test_files:
|
252
|
-
- spec/daemon_spec.rb
|
253
|
-
- spec/spec_helper.rb
|
254
|
-
- spec/support/dummy_database.rb
|
255
|
-
- spec/support/dummy_updater.rb
|
232
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
AllCops:
|
2
|
-
TargetRubyVersion: '2.3'
|
3
|
-
|
4
|
-
Gemspec/OrderedDependencies:
|
5
|
-
Enabled: false
|
6
|
-
|
7
|
-
Layout/EmptyLineAfterGuardClause:
|
8
|
-
Enabled: false
|
9
|
-
|
10
|
-
# allows nicer usage of private_class_method
|
11
|
-
Layout/EmptyLinesAroundArguments:
|
12
|
-
Enabled: false
|
13
|
-
|
14
|
-
Layout/HashAlignment:
|
15
|
-
Enabled: false
|
16
|
-
|
17
|
-
Layout/LeadingEmptyLines:
|
18
|
-
Enabled: false
|
19
|
-
|
20
|
-
Layout/LineLength:
|
21
|
-
Max: 200
|
22
|
-
|
23
|
-
Layout/SpaceInsideHashLiteralBraces:
|
24
|
-
Enabled: false
|
25
|
-
|
26
|
-
Metrics/AbcSize:
|
27
|
-
Enabled: false
|
28
|
-
|
29
|
-
Metrics/BlockLength:
|
30
|
-
Enabled: false
|
31
|
-
|
32
|
-
Metrics/ClassLength:
|
33
|
-
Enabled: false
|
34
|
-
|
35
|
-
Metrics/CyclomaticComplexity:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
Metrics/MethodLength:
|
39
|
-
Enabled: false
|
40
|
-
|
41
|
-
Metrics/PerceivedComplexity:
|
42
|
-
Enabled: false
|
43
|
-
|
44
|
-
Naming/MethodParameterName:
|
45
|
-
Enabled: false
|
46
|
-
|
47
|
-
Naming/MemoizedInstanceVariableName:
|
48
|
-
Enabled: false
|
49
|
-
|
50
|
-
Style/ConditionalAssignment:
|
51
|
-
Enabled: false
|
52
|
-
|
53
|
-
Style/Documentation:
|
54
|
-
Enabled: false
|
55
|
-
|
56
|
-
Style/FormatStringToken:
|
57
|
-
Enabled: false
|
58
|
-
|
59
|
-
Style/FrozenStringLiteralComment:
|
60
|
-
Enabled: false
|
61
|
-
|
62
|
-
Style/GuardClause:
|
63
|
-
Enabled: false
|
64
|
-
|
65
|
-
Style/HashEachMethods:
|
66
|
-
Enabled: true
|
67
|
-
|
68
|
-
Style/HashTransformKeys:
|
69
|
-
Enabled: true
|
70
|
-
|
71
|
-
Style/HashTransformValues:
|
72
|
-
Enabled: true
|
73
|
-
|
74
|
-
Style/IdenticalConditionalBranches:
|
75
|
-
Enabled: false
|
76
|
-
|
77
|
-
Style/InverseMethods:
|
78
|
-
Enabled: false
|
79
|
-
|
80
|
-
Style/NegatedIf:
|
81
|
-
Enabled: false
|
82
|
-
|
83
|
-
Style/RescueModifier:
|
84
|
-
Enabled: false
|
85
|
-
|
86
|
-
Style/SymbolArray:
|
87
|
-
Enabled: false
|
data/.solargraph.yml
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'rubocop/rake_task'
|
4
|
-
require 'bundler/audit/task'
|
5
|
-
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
7
|
-
RuboCop::RakeTask.new
|
8
|
-
Bundler::Audit::Task.new
|
9
|
-
|
10
|
-
desc 'Should be run by developer once to prepare initial solargraph usage (fill caches etc.)'
|
11
|
-
task :'solargraph:init' do
|
12
|
-
sh 'solargraph download-core'
|
13
|
-
end
|
14
|
-
|
15
|
-
desc 'Run experimental solargraph type checker'
|
16
|
-
task :'solargraph:tc' do
|
17
|
-
sh 'solargraph typecheck'
|
18
|
-
end
|
19
|
-
|
20
|
-
task default: [:rubocop, :spec, 'bundle:audit']
|
21
|
-
|
22
|
-
task travis: [:default, :'solargraph:tc']
|
data/bin/dyndnsd
DELETED
data/dyndnsd.gemspec
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
$LOAD_PATH.push File.expand_path('lib', __dir__)
|
3
|
-
|
4
|
-
require 'dyndnsd/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = 'dyndnsd'
|
8
|
-
s.version = Dyndnsd::VERSION
|
9
|
-
s.summary = 'dyndnsd.rb'
|
10
|
-
s.description = 'A small, lightweight and extensible DynDNS server written with Ruby and Rack.'
|
11
|
-
s.author = 'Christian Nicolai'
|
12
|
-
s.email = 'chrnicolai@gmail.com'
|
13
|
-
s.homepage = 'https://github.com/cmur2/dyndnsd'
|
14
|
-
s.license = 'Apache-2.0'
|
15
|
-
|
16
|
-
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
17
|
-
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
18
|
-
s.require_paths = ['lib']
|
19
|
-
s.executables = ['dyndnsd']
|
20
|
-
|
21
|
-
s.required_ruby_version = '>= 2.3'
|
22
|
-
|
23
|
-
s.add_runtime_dependency 'rack', '~> 2.0'
|
24
|
-
s.add_runtime_dependency 'json'
|
25
|
-
s.add_runtime_dependency 'metriks'
|
26
|
-
s.add_runtime_dependency 'opentracing', '~> 0.5.0'
|
27
|
-
s.add_runtime_dependency 'rack-tracer', '~> 0.9.0'
|
28
|
-
s.add_runtime_dependency 'jaeger-client', '~> 0.10.0'
|
29
|
-
|
30
|
-
s.add_development_dependency 'bundler'
|
31
|
-
s.add_development_dependency 'rake'
|
32
|
-
s.add_development_dependency 'rspec'
|
33
|
-
s.add_development_dependency 'rack-test'
|
34
|
-
s.add_development_dependency 'rubocop', '~> 0.80.0'
|
35
|
-
s.add_development_dependency 'bundler-audit', '~> 0.6.0'
|
36
|
-
s.add_development_dependency 'solargraph'
|
37
|
-
end
|
data/spec/daemon_spec.rb
DELETED
@@ -1,240 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Dyndnsd::Daemon do
|
4
|
-
include Rack::Test::Methods
|
5
|
-
|
6
|
-
def app
|
7
|
-
Dyndnsd.logger = Logger.new(STDOUT)
|
8
|
-
Dyndnsd.logger.level = Logger::UNKNOWN
|
9
|
-
|
10
|
-
config = {
|
11
|
-
'domain' => 'example.org',
|
12
|
-
'users' => {
|
13
|
-
'test' => {
|
14
|
-
'password' => 'secret',
|
15
|
-
'hosts' => ['foo.example.org', 'bar.example.org']
|
16
|
-
}
|
17
|
-
}
|
18
|
-
}
|
19
|
-
db = Dyndnsd::DummyDatabase.new({})
|
20
|
-
updater = Dyndnsd::Updater::Dummy.new
|
21
|
-
daemon = Dyndnsd::Daemon.new(config, db, updater)
|
22
|
-
|
23
|
-
app = Rack::Auth::Basic.new(daemon, 'DynDNS', &daemon.method(:authorized?))
|
24
|
-
|
25
|
-
app = Dyndnsd::Responder::DynDNSStyle.new(app)
|
26
|
-
|
27
|
-
Rack::Tracer.new(app, trust_incoming_span: false)
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'requires authentication' do
|
31
|
-
get '/'
|
32
|
-
expect(last_response.status).to eq(401)
|
33
|
-
expect(last_response.body).to eq('badauth')
|
34
|
-
end
|
35
|
-
|
36
|
-
it 'requires configured correct credentials' do
|
37
|
-
authorize 'test', 'wrongsecret'
|
38
|
-
get '/'
|
39
|
-
expect(last_response.status).to eq(401)
|
40
|
-
expect(last_response.body).to eq('badauth')
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'only supports GET requests' do
|
44
|
-
authorize 'test', 'secret'
|
45
|
-
post '/nic/update'
|
46
|
-
expect(last_response.status).to eq(405)
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'provides only the /nic/update URL' do
|
50
|
-
authorize 'test', 'secret'
|
51
|
-
get '/other/url'
|
52
|
-
expect(last_response.status).to eq(404)
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'requires the hostname query parameter' do
|
56
|
-
authorize 'test', 'secret'
|
57
|
-
get '/nic/update'
|
58
|
-
expect(last_response).to be_ok
|
59
|
-
expect(last_response.body).to eq('notfqdn')
|
60
|
-
end
|
61
|
-
|
62
|
-
it 'supports multiple hostnames in request' do
|
63
|
-
authorize 'test', 'secret'
|
64
|
-
|
65
|
-
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=1.2.3.4'
|
66
|
-
expect(last_response).to be_ok
|
67
|
-
expect(last_response.body).to eq("good 1.2.3.4\ngood 1.2.3.4")
|
68
|
-
|
69
|
-
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=2001:db8::1'
|
70
|
-
expect(last_response).to be_ok
|
71
|
-
expect(last_response.body).to eq("good 2001:db8::1\ngood 2001:db8::1")
|
72
|
-
end
|
73
|
-
|
74
|
-
it 'rejects request if one hostname is invalid' do
|
75
|
-
authorize 'test', 'secret'
|
76
|
-
|
77
|
-
get '/nic/update?hostname=test'
|
78
|
-
expect(last_response).to be_ok
|
79
|
-
expect(last_response.body).to eq('notfqdn')
|
80
|
-
|
81
|
-
get '/nic/update?hostname=test.example.com'
|
82
|
-
expect(last_response).to be_ok
|
83
|
-
expect(last_response.body).to eq('notfqdn')
|
84
|
-
|
85
|
-
get '/nic/update?hostname=test.example.org.me'
|
86
|
-
expect(last_response).to be_ok
|
87
|
-
expect(last_response.body).to eq('notfqdn')
|
88
|
-
|
89
|
-
get '/nic/update?hostname=foo.test.example.org'
|
90
|
-
expect(last_response).to be_ok
|
91
|
-
expect(last_response.body).to eq('notfqdn')
|
92
|
-
|
93
|
-
get '/nic/update?hostname=in%20valid.example.org'
|
94
|
-
expect(last_response).to be_ok
|
95
|
-
expect(last_response.body).to eq('notfqdn')
|
96
|
-
|
97
|
-
get '/nic/update?hostname=valid.example.org,in.valid.example.org'
|
98
|
-
expect(last_response).to be_ok
|
99
|
-
expect(last_response.body).to eq('notfqdn')
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'rejects request if user does not own one hostname' do
|
103
|
-
authorize 'test', 'secret'
|
104
|
-
|
105
|
-
get '/nic/update?hostname=notmyhost.example.org'
|
106
|
-
expect(last_response).to be_ok
|
107
|
-
expect(last_response.body).to eq('nohost')
|
108
|
-
|
109
|
-
get '/nic/update?hostname=foo.example.org,notmyhost.example.org'
|
110
|
-
expect(last_response).to be_ok
|
111
|
-
expect(last_response.body).to eq('nohost')
|
112
|
-
end
|
113
|
-
|
114
|
-
it 'updates a host on IP change' do
|
115
|
-
authorize 'test', 'secret'
|
116
|
-
|
117
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
|
118
|
-
expect(last_response).to be_ok
|
119
|
-
|
120
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.40'
|
121
|
-
expect(last_response).to be_ok
|
122
|
-
expect(last_response.body).to eq('good 1.2.3.40')
|
123
|
-
|
124
|
-
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
|
125
|
-
expect(last_response).to be_ok
|
126
|
-
|
127
|
-
get '/nic/update?hostname=foo.example.org&myip=2001:db8::10'
|
128
|
-
expect(last_response).to be_ok
|
129
|
-
expect(last_response.body).to eq('good 2001:db8::10')
|
130
|
-
end
|
131
|
-
|
132
|
-
it 'returns IP no change' do
|
133
|
-
authorize 'test', 'secret'
|
134
|
-
|
135
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
|
136
|
-
expect(last_response).to be_ok
|
137
|
-
|
138
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
|
139
|
-
expect(last_response).to be_ok
|
140
|
-
expect(last_response.body).to eq('nochg 1.2.3.4')
|
141
|
-
|
142
|
-
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
|
143
|
-
expect(last_response).to be_ok
|
144
|
-
|
145
|
-
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
|
146
|
-
expect(last_response).to be_ok
|
147
|
-
expect(last_response.body).to eq('nochg 2001:db8::1')
|
148
|
-
end
|
149
|
-
|
150
|
-
it 'outputs IP status per hostname' do
|
151
|
-
authorize 'test', 'secret'
|
152
|
-
|
153
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
|
154
|
-
expect(last_response).to be_ok
|
155
|
-
expect(last_response.body).to eq('good 1.2.3.4')
|
156
|
-
|
157
|
-
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=1.2.3.4'
|
158
|
-
expect(last_response).to be_ok
|
159
|
-
expect(last_response.body).to eq("nochg 1.2.3.4\ngood 1.2.3.4")
|
160
|
-
|
161
|
-
get '/nic/update?hostname=foo.example.org&myip=2001:db8::1'
|
162
|
-
expect(last_response).to be_ok
|
163
|
-
expect(last_response.body).to eq('good 2001:db8::1')
|
164
|
-
|
165
|
-
get '/nic/update?hostname=foo.example.org,bar.example.org&myip=2001:db8::1'
|
166
|
-
expect(last_response).to be_ok
|
167
|
-
expect(last_response.body).to eq("nochg 2001:db8::1\ngood 2001:db8::1")
|
168
|
-
end
|
169
|
-
|
170
|
-
it 'offlines a host' do
|
171
|
-
authorize 'test', 'secret'
|
172
|
-
|
173
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
|
174
|
-
expect(last_response).to be_ok
|
175
|
-
expect(last_response.body).to eq('good 1.2.3.4')
|
176
|
-
|
177
|
-
get '/nic/update?hostname=foo.example.org&offline=YES'
|
178
|
-
expect(last_response).to be_ok
|
179
|
-
expect(last_response.body).to eq('good ')
|
180
|
-
|
181
|
-
get '/nic/update?hostname=foo.example.org&offline=YES'
|
182
|
-
expect(last_response).to be_ok
|
183
|
-
expect(last_response.body).to eq('nochg ')
|
184
|
-
|
185
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4'
|
186
|
-
expect(last_response).to be_ok
|
187
|
-
expect(last_response.body).to eq('good 1.2.3.4')
|
188
|
-
|
189
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4&offline=YES'
|
190
|
-
expect(last_response).to be_ok
|
191
|
-
expect(last_response.body).to eq('good ')
|
192
|
-
|
193
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4&offline=YES'
|
194
|
-
expect(last_response).to be_ok
|
195
|
-
expect(last_response.body).to eq('nochg ')
|
196
|
-
end
|
197
|
-
|
198
|
-
it 'uses clients remote IP address if myip not specified' do
|
199
|
-
authorize 'test', 'secret'
|
200
|
-
get '/nic/update?hostname=foo.example.org'
|
201
|
-
expect(last_response).to be_ok
|
202
|
-
expect(last_response.body).to eq('good 127.0.0.1')
|
203
|
-
end
|
204
|
-
|
205
|
-
it 'uses clients remote IP address from X-Real-IP header if behind proxy' do
|
206
|
-
authorize 'test', 'secret'
|
207
|
-
|
208
|
-
get '/nic/update?hostname=foo.example.org', '', 'HTTP_X_REAL_IP' => '10.0.0.1'
|
209
|
-
expect(last_response).to be_ok
|
210
|
-
expect(last_response.body).to eq('good 10.0.0.1')
|
211
|
-
|
212
|
-
get '/nic/update?hostname=foo.example.org', '', 'HTTP_X_REAL_IP' => '2001:db8::1'
|
213
|
-
expect(last_response).to be_ok
|
214
|
-
expect(last_response.body).to eq('good 2001:db8::1')
|
215
|
-
end
|
216
|
-
|
217
|
-
it 'supports an IPv4 and an IPv6 address in one request' do
|
218
|
-
authorize 'test', 'secret'
|
219
|
-
|
220
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4&myip6=2001:db8::1'
|
221
|
-
expect(last_response).to be_ok
|
222
|
-
expect(last_response.body).to eq('good 1.2.3.4 2001:db8::1')
|
223
|
-
|
224
|
-
get '/nic/update?hostname=foo.example.org&myip=BROKENIP&myip6=2001:db8::1'
|
225
|
-
expect(last_response).to be_ok
|
226
|
-
expect(last_response.body).to eq('nohost')
|
227
|
-
|
228
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.4&myip6=BROKENIP'
|
229
|
-
expect(last_response).to be_ok
|
230
|
-
expect(last_response.body).to eq('nohost')
|
231
|
-
|
232
|
-
get '/nic/update?hostname=foo.example.org&myip6=2001:db8::10'
|
233
|
-
expect(last_response).to be_ok
|
234
|
-
expect(last_response.body).to eq('nohost')
|
235
|
-
|
236
|
-
get '/nic/update?hostname=foo.example.org&myip=1.2.3.40'
|
237
|
-
expect(last_response).to be_ok
|
238
|
-
expect(last_response.body).to eq('good 1.2.3.40')
|
239
|
-
end
|
240
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'forwardable'
|
3
|
-
|
4
|
-
module Dyndnsd
|
5
|
-
class DummyDatabase
|
6
|
-
extend Forwardable
|
7
|
-
|
8
|
-
def_delegators :@db, :[], :[]=, :each, :has_key?
|
9
|
-
|
10
|
-
def initialize(db_init)
|
11
|
-
@db_init = db_init
|
12
|
-
end
|
13
|
-
|
14
|
-
def load
|
15
|
-
@db = @db_init
|
16
|
-
@db_hash = @db.hash
|
17
|
-
end
|
18
|
-
|
19
|
-
def save
|
20
|
-
@db_hash = @db.hash
|
21
|
-
end
|
22
|
-
|
23
|
-
def changed?
|
24
|
-
@db_hash != @db.hash
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|