Backup dns: don't remove sole record if it's a linked IP

Version 1.52

Bugfix
Finished

Say you have a domain on 1.2.3.4, and you have 1.2.3.5 linked to it for dns, DA will duplicate all A/AAAA records accordingly. So you'd have: www A 1.2.3.4 www A 1.2.3.5 however, some people might manually change the ns1/ns2 records to look like this: ns1 A 1.2.3.4 ns2 A 1.2.3.5 while the other records are doubled up. When DA creates the backup, it will remove the linkeds IPs from the zone, leaving just: www A 1.2.3.4 ns1 A 1.2.3.4 where this would actually cause the write to fail the zone write check, since if this was present: domain.com. NS ns2 the ns2 A record is now missing. This change is to check how many total A+AAAA records there are for that given name, and if there is only 1, then the value is not removed. This can span AAAA records too, eg: ns1 A 1.2.3.4 ns2 AAAA :::1:2:3:5 and DA will ensure if there is only 1 of either A or AAAA, that last value is not removed, even if it's only on the linked IP. This will allow it to pass the zone check. Backups will now also include the domains/domain.com.ip_list, so that DA can eventually be coded to know that the 1.2.3.5 value is an additional value, and should be swapped if the new server is using a different IP. As this change currently sits, when you restore the zone, if you were to set the User/Domain to use 4.3.2.1, it would end up like: www A 4.3.2.1 ns1 A 4.3.2.1 ns2 A 1.2.3.5 Since 1.2.3.5 is considered a "custom" IP at this point, since DA does not yet check that it's a linked IP (as the backup system only currently supports a single IP to restore to) If you're restoring to the same IPs, then it should be fine, it just gets a bit messy if you're restore to a different IP, then 1.2.3.5 would need to be swapped accordingly after the restore.

Interested to try DirectAdmin? Get a 30-day Free Trial!