mirror of
https://github.com/cmur2/dyndnsd.git
synced 2025-06-26 02:30:22 +02:00
gem: allow config to contain users without any hosts
This commit is contained in:
@ -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'
|
||||
|
Reference in New Issue
Block a user