1
0
mirror of https://github.com/cmur2/dyndnsd.git synced 2025-08-08 08:33:56 +02:00

Compare commits

...

3 Commits

Author SHA1 Message Date
cn
3d787a46ea release: 3.7.1 2022-09-20 19:35:55 +02:00
cn
3a5b1bcb27 gem: allow config to contain users without any hosts 2022-09-20 19:31:46 +02:00
Christian Nicolai
d066b3ecee gems: update opentelemetry 2022-09-16 07:12:10 +02:00
5 changed files with 23 additions and 5 deletions

View File

@@ -1,5 +1,11 @@
# 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)
IMPROVEMENTS:

View File

@@ -30,9 +30,9 @@ Gem::Specification.new do |s|
s.add_runtime_dependency 'async', '~> 1.30.0'
s.add_runtime_dependency 'async-dns', '~> 1.3.0'
s.add_runtime_dependency 'metriks'
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.21.0'
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.20.0'
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.0.0.rc2'
s.add_runtime_dependency 'opentelemetry-exporter-jaeger', '~> 0.22.0'
s.add_runtime_dependency 'opentelemetry-instrumentation-rack', '~> 0.21.0'
s.add_runtime_dependency 'opentelemetry-sdk', '~> 1.2.0'
s.add_runtime_dependency 'rack', '~> 3.0'
s.add_runtime_dependency 'rackup'
s.add_runtime_dependency 'webrick', '>= 1.6.1'

View File

@@ -215,10 +215,11 @@ module Dyndnsd
invalid_hostnames = hostnames.select { |h| !Helper.fqdn_valid?(h, @domain) }
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']
# 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?
if params['offline'] == 'YES'

View File

@@ -1,5 +1,5 @@
# frozen_string_literal: true
module Dyndnsd
VERSION = '3.7.0'
VERSION = '3.7.1'
end

View File

@@ -15,6 +15,9 @@ describe Dyndnsd::Daemon do
'test' => {
'password' => 'secret',
'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')
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
authorize 'test', 'secret'