use_token: update only when addresses differ, and update serial.

This commit is contained in:
Philippe Pittoli 2024-03-14 04:43:02 +01:00
parent b3aa91fd07
commit 945e366097

View File

@ -338,6 +338,9 @@ class DNSManager::Storage
zone = zone_must_exist! token.domain
rr = zone.rr_must_exist! token.rrid
# Same address, no need to change anything.
return Response::Success.new if rr.target == address
# TODO: validate target?
case rr
@ -349,7 +352,7 @@ class DNSManager::Storage
when Zone::AAAA
rr.target = address
zone.update_rr rr
zones_by_domain.update_or_create zone.domain, zone
update_zone zone
Response::Success.new
else
Response::Error.new "use token on invalid entry (not A or AAAA)"