Compare commits

..

2 Commits

Author SHA1 Message Date
723c1a83a0 Update expected messages. 2024-04-28 16:17:47 +02:00
ebd9bd75a5 Prevent a basic hack. 2024-04-28 16:17:28 +02:00
2 changed files with 7 additions and 1 deletions

View File

@ -51,7 +51,11 @@ class DNSManager::Client < IPC
def user_domain_add(domain : String) def user_domain_add(domain : String)
request = Request::NewDomain.new domain request = Request::NewDomain.new domain
send_now request send_now request
parse_message [ Response::Success ], read parse_message [ Response::DomainAdded,
Response::DomainAlreadyExists,
Response::InvalidDomainName,
Response::UnacceptableDomain
], read
end end
# Remove a domain. # Remove a domain.

View File

@ -133,6 +133,8 @@ class DNSManager::Storage
end end
matching_domains.each do |md| matching_domains.each do |md|
# Prevent empty domains (from crafted requests) to be accepted.
return Response::InvalidDomainName.new unless (domain.chomp md).size > 2
Baguette::Log.info "Add new domain #{domain} (matching domain #{md})" Baguette::Log.info "Add new domain #{domain} (matching domain #{md})"
end end