Token update: validate the IP addresses before update.

master
Philippe Pittoli 2024-03-15 03:47:35 +01:00
parent 611765d45d
commit 59304cf751
1 changed files with 2 additions and 2 deletions

View File

@ -341,15 +341,15 @@ class DNSManager::Storage
# Same address, no need to change anything. # Same address, no need to change anything.
return Response::Success.new if rr.target == address return Response::Success.new if rr.target == address
# TODO: validate target?
case rr case rr
when Zone::A when Zone::A
return Response::Error.new "invalid ipv4" unless Zone.is_ipv4_address_valid? address
rr.target = address rr.target = address
zone.update_rr rr zone.update_rr rr
zones_by_domain.update_or_create zone.domain, zone zones_by_domain.update_or_create zone.domain, zone
Response::Success.new Response::Success.new
when Zone::AAAA when Zone::AAAA
return Response::Error.new "invalid ipv6" unless Zone.is_ipv6_address_valid? address
rr.target = address rr.target = address
zone.update_rr rr zone.update_rr rr
update_zone zone update_zone zone