mirror of
https://github.com/cmur2/dyndnsd.git
synced 2025-08-08 08:33:56 +02:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
3d787a46ea | |||
3a5b1bcb27 | |||
![]() |
d066b3ecee |
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 3.7.1 (September 20th, 2022)
|
||||||
|
|
||||||
|
IMPROVEMENTS:
|
||||||
|
|
||||||
|
- fix [TypeError](https://github.com/cmur2/dyndnsd/issues/205) when user has no hosts configured
|
||||||
|
|
||||||
## 3.7.0 (September 16th, 2022)
|
## 3.7.0 (September 16th, 2022)
|
||||||
|
|
||||||
IMPROVEMENTS:
|
IMPROVEMENTS:
|
||||||
|
@@ -30,9 +30,9 @@ Gem::Specification.new do |s|
|
|||||||
s.add_runtime_dependency 'async', '~> 1.30.0'
|
s.add_runtime_dependency 'async', '~> 1.30.0'
|
||||||
s.add_runtime_dependency 'async-dns', '~> 1.3.0'
|
s.add_runtime_dependency 'async-dns', '~> 1.3.0'
|
||||||
s.add_runtime_dependency 'metriks'
|
s.add_runtime_dependency 'metriks'
|
||||||
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.21.0'
|
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.22.0'
|
||||||
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.20.0'
|
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.21.0'
|
||||||
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.0.0.rc2'
|
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.2.0'
|
||||||
s.add_runtime_dependency 'rack', '~> 3.0'
|
s.add_runtime_dependency 'rack', '~> 3.0'
|
||||||
s.add_runtime_dependency 'rackup'
|
s.add_runtime_dependency 'rackup'
|
||||||
s.add_runtime_dependency 'webrick', '>= 1.6.1'
|
s.add_runtime_dependency 'webrick', '>= 1.6.1'
|
||||||
|
@@ -215,10 +215,11 @@ module Dyndnsd
|
|||||||
invalid_hostnames = hostnames.select { |h| !Helper.fqdn_valid?(h, @domain) }
|
invalid_hostnames = hostnames.select { |h| !Helper.fqdn_valid?(h, @domain) }
|
||||||
return [422, {'X-DynDNS-Response' => 'hostname_malformed'}, []] if invalid_hostnames.any?
|
return [422, {'X-DynDNS-Response' => 'hostname_malformed'}, []] if invalid_hostnames.any?
|
||||||
|
|
||||||
|
# we can trust this information since user was authorized by middleware
|
||||||
user = env['REMOTE_USER']
|
user = env['REMOTE_USER']
|
||||||
|
|
||||||
# check for hostnames that the user does not own
|
# check for hostnames that the user does not own
|
||||||
forbidden_hostnames = hostnames - @users[user]['hosts']
|
forbidden_hostnames = hostnames - @users[user].fetch('hosts', [])
|
||||||
return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if forbidden_hostnames.any?
|
return [422, {'X-DynDNS-Response' => 'host_forbidden'}, []] if forbidden_hostnames.any?
|
||||||
|
|
||||||
if params['offline'] == 'YES'
|
if params['offline'] == 'YES'
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Dyndnsd
|
module Dyndnsd
|
||||||
VERSION = '3.7.0'
|
VERSION = '3.7.1'
|
||||||
end
|
end
|
||||||
|
@@ -15,6 +15,9 @@ describe Dyndnsd::Daemon do
|
|||||||
'test' => {
|
'test' => {
|
||||||
'password' => 'secret',
|
'password' => 'secret',
|
||||||
'hosts' => ['foo.example.org', 'bar.example.org']
|
'hosts' => ['foo.example.org', 'bar.example.org']
|
||||||
|
},
|
||||||
|
'test2' => {
|
||||||
|
'password' => 'ihavenohosts'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,6 +102,14 @@ describe Dyndnsd::Daemon do
|
|||||||
expect(last_response.body).to eq('notfqdn')
|
expect(last_response.body).to eq('notfqdn')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'rejects request if user does not own any hostnames' do
|
||||||
|
authorize 'test2', 'ihavenohosts'
|
||||||
|
|
||||||
|
get '/nic/update?hostname=doesnotexisthost.example.org'
|
||||||
|
expect(last_response).to be_ok
|
||||||
|
expect(last_response.body).to eq('nohost')
|
||||||
|
end
|
||||||
|
|
||||||
it 'rejects request if user does not own one hostname' do
|
it 'rejects request if user does not own one hostname' do
|
||||||
authorize 'test', 'secret'
|
authorize 'test', 'secret'
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user