2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

Add comments and make a slight REQUIRE change

This commit is contained in:
Michael Sawyer
2000-07-22 00:27:40 +00:00
parent 0371079513
commit f592550498

View File

@@ -15,7 +15,7 @@
* SOFTWARE. * SOFTWARE.
*/ */
/* $Id: zone.c,v 1.163 2000/07/21 23:13:58 mws Exp $ */ /* $Id: zone.c,v 1.164 2000/07/22 00:27:40 mws Exp $ */
#include <config.h> #include <config.h>
@@ -1270,7 +1270,7 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
unsigned int i; unsigned int i;
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE((masters == NULL && count == 0) || REQUIRE((count == 0) ||
(masters != NULL && count != 0)); (masters != NULL && count != 0));
if (keynames != NULL) { if (keynames != NULL) {
REQUIRE(count != 0); REQUIRE(count != 0);
@@ -1298,9 +1298,16 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
zone->masterkeynames = NULL; zone->masterkeynames = NULL;
} }
zone->masterscnt = 0; zone->masterscnt = 0;
if (masters == NULL) /*
* If count == 0, don't allocate any space for masters or keynames
* so internally, those pointers are NULL if count == 0
*/
if (count == 0)
goto unlock; goto unlock;
/*
* masters must countain count elements!
*/
new = isc_mem_get(zone->mctx, new = isc_mem_get(zone->mctx,
count * sizeof(isc_sockaddr_t)); count * sizeof(isc_sockaddr_t));
if (new == NULL) { if (new == NULL) {
@@ -1312,6 +1319,9 @@ dns_zone_setmasterswithkeys(dns_zone_t *zone, isc_sockaddr_t *masters,
zone->masterscnt = count; zone->masterscnt = count;
zone->flags &= ~DNS_ZONEFLG_NOMASTERS; zone->flags &= ~DNS_ZONEFLG_NOMASTERS;
/*
* if keynames is non-NULL, it must contain count elements!
*/
if (keynames != NULL) { if (keynames != NULL) {
newname = isc_mem_get(zone->mctx, newname = isc_mem_get(zone->mctx,
count * sizeof(dns_name_t *)); count * sizeof(dns_name_t *));