2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-03 08:05:21 +00:00

fix: dev: Add missing locks when returning addresses

Add missing locks in dns_zone_getxfrsource4 et al.  Addresses CID 468706, 468708, 468741, 468742, 468785, and 468778.

Cleanup dns_zone_setxfrsource4 et al to now return void.

Remove double copies with dns_zone_getprimaryaddr and dns_zone_getsourceaddr.

Closes #4933

Merge branch '4933-add-missing-locks-when-returning-addresses' into 'main'

See merge request isc-projects/bind9!9485
This commit is contained in:
Mark Andrews
2025-03-15 06:04:34 +00:00
4 changed files with 98 additions and 97 deletions

View File

@@ -1603,7 +1603,7 @@ xfrin_xmlrender(dns_zone_t *zone, void *arg) {
isc_sockaddr_format(addrp, addr_buf, sizeof(addr_buf)); isc_sockaddr_format(addrp, addr_buf, sizeof(addr_buf));
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf)); TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf));
} else if (is_presoa) { } else if (is_presoa) {
addr = dns_zone_getsourceaddr(zone); dns_zone_getsourceaddr(zone, &addr);
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf)); isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf)); TRY0(xmlTextWriterWriteString(writer, ISC_XMLCHAR addr_buf));
} else { } else {
@@ -2660,7 +2660,7 @@ xfrin_jsonrender(dns_zone_t *zone, void *arg) {
json_object_object_add(xfrinobj, "localaddr", json_object_object_add(xfrinobj, "localaddr",
json_object_new_string(addr_buf)); json_object_new_string(addr_buf));
} else if (is_presoa) { } else if (is_presoa) {
addr = dns_zone_getsourceaddr(zone); dns_zone_getsourceaddr(zone, &addr);
isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf)); isc_sockaddr_format(&addr, addr_buf, sizeof(addr_buf));
json_object_object_add(xfrinobj, "localaddr", json_object_object_add(xfrinobj, "localaddr",
json_object_new_string(addr_buf)); json_object_new_string(addr_buf));

View File

@@ -1279,22 +1279,22 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL; obj = NULL;
result = named_config_get(maps, "parental-source", &obj); result = named_config_get(maps, "parental-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
CHECK(dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj))); dns_zone_setparentalsrc4(zone, cfg_obj_assockaddr(obj));
obj = NULL; obj = NULL;
result = named_config_get(maps, "parental-source-v6", &obj); result = named_config_get(maps, "parental-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
CHECK(dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj))); dns_zone_setparentalsrc6(zone, cfg_obj_assockaddr(obj));
obj = NULL; obj = NULL;
result = named_config_get(maps, "notify-source", &obj); result = named_config_get(maps, "notify-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
CHECK(dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj))); dns_zone_setnotifysrc4(zone, cfg_obj_assockaddr(obj));
obj = NULL; obj = NULL;
result = named_config_get(maps, "notify-source-v6", &obj); result = named_config_get(maps, "notify-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
CHECK(dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj))); dns_zone_setnotifysrc6(zone, cfg_obj_assockaddr(obj));
obj = NULL; obj = NULL;
result = named_config_get(maps, "notify-to-soa", &obj); result = named_config_get(maps, "notify-to-soa", &obj);
@@ -1938,14 +1938,12 @@ named_zone_configure(const cfg_obj_t *config, const cfg_obj_t *vconfig,
obj = NULL; obj = NULL;
result = named_config_get(maps, "transfer-source", &obj); result = named_config_get(maps, "transfer-source", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
CHECK(dns_zone_setxfrsource4(mayberaw, dns_zone_setxfrsource4(mayberaw, cfg_obj_assockaddr(obj));
cfg_obj_assockaddr(obj)));
obj = NULL; obj = NULL;
result = named_config_get(maps, "transfer-source-v6", &obj); result = named_config_get(maps, "transfer-source-v6", &obj);
INSIST(result == ISC_R_SUCCESS && obj != NULL); INSIST(result == ISC_R_SUCCESS && obj != NULL);
CHECK(dns_zone_setxfrsource6(mayberaw, dns_zone_setxfrsource6(mayberaw, cfg_obj_assockaddr(obj));
cfg_obj_assockaddr(obj)));
obj = NULL; obj = NULL;
(void)named_config_get(maps, "try-tcp-refresh", &obj); (void)named_config_get(maps, "try-tcp-refresh", &obj);

View File

@@ -818,7 +818,7 @@ dns_zone_setmaxretrytime(dns_zone_t *zone, uint32_t val);
* val > 0. * val > 0.
*/ */
isc_result_t void
dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
/*%< /*%<
* Set the source address to be used in IPv4 zone transfers. * Set the source address to be used in IPv4 zone transfers.
@@ -826,22 +826,20 @@ dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'xfrsource' to contain the address. *\li 'xfrsource' to contain the address.
*
* Returns:
*\li #ISC_R_SUCCESS
*/ */
isc_sockaddr_t * void
dns_zone_getxfrsource4(dns_zone_t *zone); dns_zone_getxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource);
/*%< /*%<
* Returns the source address set by a previous dns_zone_setxfrsource4 * Returns the source address set by a previous dns_zone_setxfrsource4
* call, or the default of inaddr_any, port 0. * call, or the default of inaddr_any, port 0.
* *
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'xfrsource' to not be NULL
*/ */
isc_result_t void
dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource); dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
/*%< /*%<
* Set the source address to be used in IPv6 zone transfers. * Set the source address to be used in IPv6 zone transfers.
@@ -849,22 +847,20 @@ dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource);
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'xfrsource' to contain the address. *\li 'xfrsource' to contain the address.
*
* Returns:
*\li #ISC_R_SUCCESS
*/ */
isc_sockaddr_t * void
dns_zone_getxfrsource6(dns_zone_t *zone); dns_zone_getxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource);
/*%< /*%<
* Returns the source address set by a previous dns_zone_setxfrsource6 * Returns the source address set by a previous dns_zone_setxfrsource6
* call, or the default of in6addr_any, port 0. * call, or the default of in6addr_any, port 0.
* *
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'xfrsource' to not be NULL
*/ */
isc_result_t void
dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc); dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
/*%< /*%<
* Set the source address to be used with IPv4 parental DS queries. * Set the source address to be used with IPv4 parental DS queries.
@@ -872,22 +868,20 @@ dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'parentalsrc' to contain the address. *\li 'parentalsrc' to contain the address.
*
* Returns:
*\li #ISC_R_SUCCESS
*/ */
isc_sockaddr_t * void
dns_zone_getparentalsrc4(dns_zone_t *zone); dns_zone_getparentalsrc4(dns_zone_t *zone, isc_sockaddr_t *parentalsrc);
/*%< /*%<
* Returns the source address set by a previous dns_zone_setparentalsrc4 * Returns the source address set by a previous dns_zone_setparentalsrc4
* call, or the default of inaddr_any, port 0. * call, or the default of inaddr_any, port 0.
* *
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'parentalsrc' to be non NULL.
*/ */
isc_result_t void
dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc); dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
/*%< /*%<
* Set the source address to be used with IPv6 parental DS queries. * Set the source address to be used with IPv6 parental DS queries.
@@ -895,22 +889,20 @@ dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc);
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'parentalsrc' to contain the address. *\li 'parentalsrc' to contain the address.
*
* Returns:
*\li #ISC_R_SUCCESS
*/ */
isc_sockaddr_t * void
dns_zone_getparentalsrc6(dns_zone_t *zone); dns_zone_getparentalsrc6(dns_zone_t *zone, isc_sockaddr_t *parentalsrc);
/*%< /*%<
* Returns the source address set by a previous dns_zone_setparentalsrc6 * Returns the source address set by a previous dns_zone_setparentalsrc6
* call, or the default of in6addr_any, port 0. * call, or the default of in6addr_any, port 0.
* *
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'parentalsrc' to be non NULL.
*/ */
isc_result_t void
dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
/*%< /*%<
* Set the source address to be used with IPv4 NOTIFY messages. * Set the source address to be used with IPv4 NOTIFY messages.
@@ -918,22 +910,20 @@ dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'notifysrc' to contain the address. *\li 'notifysrc' to contain the address.
*
* Returns:
*\li #ISC_R_SUCCESS
*/ */
isc_sockaddr_t * void
dns_zone_getnotifysrc4(dns_zone_t *zone); dns_zone_getnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc);
/*%< /*%<
* Returns the source address set by a previous dns_zone_setnotifysrc4 * Returns the source address set by a previous dns_zone_setnotifysrc4
* call, or the default of inaddr_any, port 0. * call, or the default of inaddr_any, port 0.
* *
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'notifysrc' to be non NULL.
*/ */
isc_result_t void
dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc); dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
/*%< /*%<
* Set the source address to be used with IPv6 NOTIFY messages. * Set the source address to be used with IPv6 NOTIFY messages.
@@ -941,19 +931,17 @@ dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc);
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'notifysrc' to contain the address. *\li 'notifysrc' to contain the address.
*
* Returns:
*\li #ISC_R_SUCCESS
*/ */
isc_sockaddr_t * void
dns_zone_getnotifysrc6(dns_zone_t *zone); dns_zone_getnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc);
/*%< /*%<
* Returns the source address set by a previous dns_zone_setnotifysrc6 * Returns the source address set by a previous dns_zone_setnotifysrc6
* call, or the default of in6addr_any, port 0. * call, or the default of in6addr_any, port 0.
* *
* Require: * Require:
*\li 'zone' to be a valid zone. *\li 'zone' to be a valid zone.
*\li 'notifysrc' to be non NULL.
*/ */
void void
@@ -1528,8 +1516,8 @@ dns_zone_getsigresigninginterval(dns_zone_t *zone);
* \li 'zone' to be a valid zone. * \li 'zone' to be a valid zone.
*/ */
isc_sockaddr_t void
dns_zone_getsourceaddr(dns_zone_t *zone); dns_zone_getsourceaddr(dns_zone_t *zone, isc_sockaddr_t *sourceaddr);
/*%< /*%<
* Get the zone's source address from which it has last contacted the current * Get the zone's source address from which it has last contacted the current
* primary server. * primary server.
@@ -1537,17 +1525,18 @@ dns_zone_getsourceaddr(dns_zone_t *zone);
* Requires: * Requires:
* \li 'zone' to be a valid zone. * \li 'zone' to be a valid zone.
* \li 'zone' has a non-empty primaries list. * \li 'zone' has a non-empty primaries list.
* \li 'sourceaddr' to be non-NULL.
*/ */
isc_result_t isc_result_t
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *dest); dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *primaryaddr);
/*%< /*%<
* Get the zone's current primary server into '*dest'. * Get the zone's current primary server into '*primaryaddr'.
* *
* Requires: * Requires:
* \li 'zone' to be a valid zone. * \li 'zone' to be a valid zone.
* \li 'zone' has a non-empty primaries list. * \li 'zone' has a non-empty primaries list.
* \li 'dest' != NULL. * \li 'primaryaddr' to be non-NULL.
* *
* Returns: * Returns:
*\li #ISC_R_SUCCESS if the current primary server was found *\li #ISC_R_SUCCESS if the current primary server was found

View File

@@ -5998,106 +5998,123 @@ dns_zone_getkeyopts(dns_zone_t *zone) {
return atomic_load_relaxed(&zone->keyopts); return atomic_load_relaxed(&zone->keyopts);
} }
isc_result_t void
dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) { dns_zone_setxfrsource4(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(xfrsource != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
zone->xfrsource4 = *xfrsource; zone->xfrsource4 = *xfrsource;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return ISC_R_SUCCESS;
} }
isc_sockaddr_t * void
dns_zone_getxfrsource4(dns_zone_t *zone) { dns_zone_getxfrsource4(dns_zone_t *zone, isc_sockaddr_t *xfrsource) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
return &zone->xfrsource4; REQUIRE(xfrsource != NULL);
LOCK_ZONE(zone);
*xfrsource = zone->xfrsource4;
UNLOCK_ZONE(zone);
} }
isc_result_t void
dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) { dns_zone_setxfrsource6(dns_zone_t *zone, const isc_sockaddr_t *xfrsource) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(xfrsource != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
zone->xfrsource6 = *xfrsource; zone->xfrsource6 = *xfrsource;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return ISC_R_SUCCESS;
} }
isc_sockaddr_t * void
dns_zone_getxfrsource6(dns_zone_t *zone) { dns_zone_getxfrsource6(dns_zone_t *zone, isc_sockaddr_t *xfrsource) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
return &zone->xfrsource6; REQUIRE(xfrsource != NULL);
LOCK_ZONE(zone);
*xfrsource = zone->xfrsource6;
UNLOCK_ZONE(zone);
} }
isc_result_t void
dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc) { dns_zone_setparentalsrc4(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(parentalsrc != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
zone->parentalsrc4 = *parentalsrc; zone->parentalsrc4 = *parentalsrc;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return ISC_R_SUCCESS;
} }
isc_sockaddr_t * void
dns_zone_getparentalsrc4(dns_zone_t *zone) { dns_zone_getparentalsrc4(dns_zone_t *zone, isc_sockaddr_t *parentalsrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
return &zone->parentalsrc4; REQUIRE(parentalsrc != NULL);
LOCK_ZONE(zone);
*parentalsrc = zone->parentalsrc4;
UNLOCK_ZONE(zone);
} }
isc_result_t void
dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc) { dns_zone_setparentalsrc6(dns_zone_t *zone, const isc_sockaddr_t *parentalsrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
LOCK_ZONE(zone); LOCK_ZONE(zone);
zone->parentalsrc6 = *parentalsrc; zone->parentalsrc6 = *parentalsrc;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return ISC_R_SUCCESS;
} }
isc_sockaddr_t * void
dns_zone_getparentalsrc6(dns_zone_t *zone) { dns_zone_getparentalsrc6(dns_zone_t *zone, isc_sockaddr_t *parentalsrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
return &zone->parentalsrc6; REQUIRE(parentalsrc != NULL);
LOCK_ZONE(zone);
*parentalsrc = zone->parentalsrc6;
UNLOCK_ZONE(zone);
} }
isc_result_t void
dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) { dns_zone_setnotifysrc4(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(notifysrc != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
zone->notifysrc4 = *notifysrc; zone->notifysrc4 = *notifysrc;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return ISC_R_SUCCESS;
} }
isc_sockaddr_t * void
dns_zone_getnotifysrc4(dns_zone_t *zone) { dns_zone_getnotifysrc4(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
return &zone->notifysrc4; REQUIRE(notifysrc != NULL);
LOCK_ZONE(zone);
*notifysrc = zone->notifysrc4;
UNLOCK_ZONE(zone);
} }
isc_result_t void
dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) { dns_zone_setnotifysrc6(dns_zone_t *zone, const isc_sockaddr_t *notifysrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(notifysrc != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
zone->notifysrc6 = *notifysrc; zone->notifysrc6 = *notifysrc;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return ISC_R_SUCCESS;
} }
isc_sockaddr_t * void
dns_zone_getnotifysrc6(dns_zone_t *zone) { dns_zone_getnotifysrc6(dns_zone_t *zone, isc_sockaddr_t *notifysrc) {
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
return &zone->notifysrc6; REQUIRE(notifysrc != NULL);
LOCK_ZONE(zone);
*notifysrc = zone->notifysrc6;
UNLOCK_ZONE(zone);
} }
void void
@@ -18371,31 +18388,28 @@ dns_zone_getsigresigninginterval(dns_zone_t *zone) {
return zone->sigresigninginterval; return zone->sigresigninginterval;
} }
isc_sockaddr_t void
dns_zone_getsourceaddr(dns_zone_t *zone) { dns_zone_getsourceaddr(dns_zone_t *zone, isc_sockaddr_t *sourceaddr) {
isc_sockaddr_t sourceaddr;
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(sourceaddr != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
INSIST(dns_remote_count(&zone->primaries) > 0); INSIST(dns_remote_count(&zone->primaries) > 0);
sourceaddr = zone->sourceaddr; *sourceaddr = zone->sourceaddr;
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return sourceaddr;
} }
isc_result_t isc_result_t
dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *dest) { dns_zone_getprimaryaddr(dns_zone_t *zone, isc_sockaddr_t *primaryaddr) {
isc_result_t result = ISC_R_NOMORE; isc_result_t result = ISC_R_NOMORE;
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE(dest != NULL); REQUIRE(primaryaddr != NULL);
LOCK_ZONE(zone); LOCK_ZONE(zone);
INSIST(dns_remote_count(&zone->primaries) > 0); INSIST(dns_remote_count(&zone->primaries) > 0);
if (!dns_remote_done(&zone->primaries)) { if (!dns_remote_done(&zone->primaries)) {
*dest = dns_remote_curraddr(&zone->primaries); *primaryaddr = dns_remote_curraddr(&zone->primaries);
result = ISC_R_SUCCESS; result = ISC_R_SUCCESS;
} }
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);