2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-01 23:25:38 +00:00

Fix RT #2309 differently, allowing rather than rejecting empty

also-notify clauses
This commit is contained in:
Andreas Gustafsson
2002-01-23 02:03:05 +00:00
parent de619d1e81
commit b6e20238b6
2 changed files with 16 additions and 23 deletions

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: zone.h,v 1.111 2002/01/22 22:05:56 bwelling Exp $ */ /* $Id: zone.h,v 1.112 2002/01/23 02:03:05 gson Exp $ */
#ifndef DNS_ZONE_H #ifndef DNS_ZONE_H
#define DNS_ZONE_H 1 #define DNS_ZONE_H 1
@@ -423,15 +423,12 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
isc_uint32_t count); isc_uint32_t count);
/* /*
* Set the list of additional servers to be notified when * Set the list of additional servers to be notified when
* a zone changes. To clear the list use 'notify = NULL' * a zone changes. To clear the list use 'count = 0'.
* and 'count = 0'.
* *
* Require: * Require:
* 'zone' to be a valid zone. * 'zone' to be a valid zone.
* 'notify' to be non NULL. * 'notify' to be non-NULL if count != 0.
* 'count' the number of notify. * 'count' to be the number of notifyees.
*
* If 'notify' is NULL then 'count' must be zero.
* *
* Returns: * Returns:
* ISC_R_SUCCESS * ISC_R_SUCCESS

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: zone.c,v 1.360 2002/01/22 22:05:53 bwelling Exp $ */ /* $Id: zone.c,v 1.361 2002/01/23 02:03:04 gson Exp $ */
#include <config.h> #include <config.h>
@@ -1792,8 +1792,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
isc_sockaddr_t *new; isc_sockaddr_t *new;
REQUIRE(DNS_ZONE_VALID(zone)); REQUIRE(DNS_ZONE_VALID(zone));
REQUIRE((notify == NULL && count == 0) || REQUIRE(count == 0 || notify != NULL);
(notify != NULL && count != 0));
LOCK_ZONE(zone); LOCK_ZONE(zone);
if (zone->notify != NULL) { if (zone->notify != NULL) {
@@ -1802,19 +1801,16 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
zone->notify = NULL; zone->notify = NULL;
zone->notifycnt = 0; zone->notifycnt = 0;
} }
if (notify == NULL) if (count != 0) {
goto unlock; new = isc_mem_get(zone->mctx, count * sizeof *new);
if (new == NULL) {
new = isc_mem_get(zone->mctx, count * sizeof(*new)); UNLOCK_ZONE(zone);
if (new == NULL) { return (ISC_R_NOMEMORY);
UNLOCK_ZONE(zone); }
return (ISC_R_NOMEMORY); memcpy(new, notify, count * sizeof *new);
} zone->notify = new;
memcpy(new, notify, count * sizeof(*new)); zone->notifycnt = count;
zone->notify = new; }
zone->notifycnt = count;
unlock:
UNLOCK_ZONE(zone); UNLOCK_ZONE(zone);
return (ISC_R_SUCCESS); return (ISC_R_SUCCESS);
} }