Token update: validate the IP addresses before update.
parent
611765d45d
commit
59304cf751
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue