]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix RT #2309 differently, allowing rather than rejecting empty
authorAndreas Gustafsson <source@isc.org>
Wed, 23 Jan 2002 02:03:05 +0000 (02:03 +0000)
committerAndreas Gustafsson <source@isc.org>
Wed, 23 Jan 2002 02:03:05 +0000 (02:03 +0000)
also-notify clauses

lib/dns/include/dns/zone.h
lib/dns/zone.c

index 6cb8f96c832a46ccd8a34cd9799de9e0c9fbe592..9fd1d836fa984145dcc933592f06459c461a97fc 100644 (file)
@@ -15,7 +15,7 @@
  * 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
 #define DNS_ZONE_H 1
@@ -423,15 +423,12 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
                       isc_uint32_t count);
 /*
  *     Set the list of additional servers to be notified when
- *     a zone changes.  To clear the list use 'notify = NULL'
- *     and 'count = 0'.
+ *     a zone changes.  To clear the list use 'count = 0'.
  *
  * Require:
  *     'zone' to be a valid zone.
- *     'notify' to be non NULL.
- *     'count' the number of notify.
- *
- *     If 'notify' is NULL then 'count' must be zero.
+ *     'notify' to be non-NULL if count != 0.
+ *     'count' to be the number of notifyees.
  *
  * Returns:
  *     ISC_R_SUCCESS
index b1f716e55eab89ab5aba84285181a5232888b597..9942577a7720bab8a3ee3f8e9c29f68d907e2e9e 100644 (file)
@@ -15,7 +15,7 @@
  * 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>
 
@@ -1792,8 +1792,7 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
        isc_sockaddr_t *new;
 
        REQUIRE(DNS_ZONE_VALID(zone));
-       REQUIRE((notify == NULL && count == 0) ||
-               (notify != NULL && count != 0));
+       REQUIRE(count == 0 || notify != NULL);
 
        LOCK_ZONE(zone);
        if (zone->notify != NULL) {
@@ -1802,19 +1801,16 @@ dns_zone_setalsonotify(dns_zone_t *zone, isc_sockaddr_t *notify,
                zone->notify = NULL;
                zone->notifycnt = 0;
        }
-       if (notify == NULL)
-               goto unlock;
-
-       new = isc_mem_get(zone->mctx, count * sizeof(*new));
-       if (new == NULL) {
-               UNLOCK_ZONE(zone);
-               return (ISC_R_NOMEMORY);
-       }
-       memcpy(new, notify, count * sizeof(*new));
-       zone->notify = new;
-       zone->notifycnt = count;
-
- unlock:
+       if (count != 0) {
+               new = isc_mem_get(zone->mctx, count * sizeof *new);
+               if (new == NULL) {
+                       UNLOCK_ZONE(zone);
+                       return (ISC_R_NOMEMORY);
+               }
+               memcpy(new, notify, count * sizeof *new);
+               zone->notify = new;
+               zone->notifycnt = count;
+        }
        UNLOCK_ZONE(zone);
        return (ISC_R_SUCCESS);
 }