Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/dist/bind/bin/named Pull up revisions 1.1-1.2 (new) (re...



details:   https://anonhg.NetBSD.org/src/rev/5b6f1254bf29
branches:  netbsd-1-4
changeset: 469784:5b6f1254bf29
user:      he <he%NetBSD.org@localhost>
date:      Sat Dec 04 16:54:13 1999 +0000

description:
Pull up revisions 1.1-1.2 (new) (requested by christos and veego):
  Update to BIND 8.2.2-P5.

diffstat:

 dist/bind/bin/named/ns_config.c |  3062 +++++++++++++++++++++++++++++++++++++++
 1 files changed, 3062 insertions(+), 0 deletions(-)

diffs (truncated from 3066 to 300 lines):

diff -r f28d80f199bc -r 5b6f1254bf29 dist/bind/bin/named/ns_config.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/dist/bind/bin/named/ns_config.c   Sat Dec 04 16:54:13 1999 +0000
@@ -0,0 +1,3062 @@
+/*     $NetBSD: ns_config.c,v 1.2.2.2 1999/12/04 16:54:13 he Exp $     */
+
+#if !defined(lint) && !defined(SABER)
+static const char rcsid[] = "Id: ns_config.c,v 8.104 1999/11/08 23:09:42 vixie Exp";
+#endif /* not lint */
+
+/*
+ * Copyright (c) 1996-1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1999 by Check Point Software Technologies, Inc.
+ * 
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies, and that
+ * the name of Check Point Software Technologies Incorporated not be used 
+ * in advertising or publicity pertaining to distribution of the document 
+ * or software without specific, written prior permission.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS" AND CHECK POINT SOFTWARE TECHNOLOGIES 
+ * INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.   
+ * IN NO EVENT SHALL CHECK POINT SOFTWARE TECHNOLOGIES INCORPRATED
+ * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR 
+ * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
+ * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT 
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#include "port_before.h"
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/un.h>
+
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <resolv.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <syslog.h>
+#include <time.h>
+#include <unistd.h>
+#include <fcntl.h>
+
+#include <isc/eventlib.h>
+#include <isc/logging.h>
+#include <isc/memcluster.h>
+
+#include <isc/dst.h>
+
+#include "port_after.h"
+
+#ifdef HAVE_GETRUSAGE          /* XXX */
+#include <sys/resource.h>
+#endif
+
+#include "named.h"
+#include "ns_parseutil.h"
+
+/* Private. */
+
+static int tmpnum = 0;
+static int config_initialized = 0;
+
+static int need_logging_free = 0;
+static int default_logging_installed;
+
+static int options_installed = 0;
+static int logging_installed = 0;
+static int default_options_installed;
+static int initial_configuration = 1;
+
+static char **logging_categories;
+static char *current_pid_filename = NULL;
+
+#define ZONE_SYM_TABLE_SIZE 4973
+static symbol_table zone_symbol_table;
+
+/* Zones */
+
+void
+free_zone_timerinfo(struct zoneinfo *zp) {
+       if (zp->z_timerinfo != NULL) {
+               freestr(zp->z_timerinfo->name);
+               memput(zp->z_timerinfo, sizeof *zp->z_timerinfo);
+               zp->z_timerinfo = NULL;
+       } else
+               ns_error(ns_log_config, "timer for zone '%s' had no timerinfo",
+                        zp->z_origin);
+}
+
+void
+free_zone_contents(struct zoneinfo *zp, int undefine_sym) {
+       INSIST(zp != NULL);
+
+       if (undefine_sym)
+               undefine_symbol(zone_symbol_table, zp->z_origin, zp->z_class);
+       if (zp->z_flags & Z_TIMER_SET) {
+               free_zone_timerinfo(zp);
+               if (evClearTimer(ev, zp->z_timer) < 0)
+                       ns_error(ns_log_config,
+                        "evClearTimer for zone '%s' failed in ns_init: %s",
+                                zp->z_origin,
+                                strerror(errno));
+       }
+       if (zp->z_origin != NULL)
+               freestr(zp->z_origin);
+       zp->z_origin = NULL;
+       if (zp->z_source != NULL)
+               freestr(zp->z_source);
+       zp->z_source = NULL;
+       if (zp->z_ixfr_base != NULL)
+               freestr(zp->z_ixfr_base);
+       zp->z_ixfr_base = NULL;
+       if (zp->z_ixfr_tmp != NULL)
+               freestr(zp->z_ixfr_tmp);
+       zp->z_ixfr_tmp = NULL;
+       if (zp->z_update_acl != NULL)
+               free_ip_match_list(zp->z_update_acl);
+       zp->z_update_acl = NULL;
+       if (zp->z_query_acl != NULL)
+               free_ip_match_list(zp->z_query_acl);
+       zp->z_query_acl = NULL;
+       if (zp->z_transfer_acl != NULL)
+               free_ip_match_list(zp->z_transfer_acl);
+       zp->z_transfer_acl = NULL;
+#ifdef BIND_UPDATE
+       if (zp->z_updatelog != NULL)
+               freestr(zp->z_updatelog);
+       zp->z_updatelog = NULL;
+#endif /* BIND_UPDATE */
+#ifdef BIND_NOTIFY
+       if (zp->z_also_notify != NULL)
+               memput(zp->z_also_notify,
+                      zp->z_notify_count * sizeof *zp->z_also_notify);
+       zp->z_also_notify = NULL;
+#endif
+       block_signals();
+       if (LINKED(zp, z_reloadlink))
+               UNLINK(reloadingzones, zp, z_reloadlink);
+       unblock_signals();
+}
+
+static void
+release_zone(struct zoneinfo *zp) {
+       INSIST(zp != NULL);
+
+       free_zone_contents(zp, 0);
+       memput(zp, sizeof *zp);
+}
+
+struct zoneinfo *
+find_zone(const char *name, int class) {
+       struct zoneinfo *zp;
+       symbol_value value;
+
+       ns_debug(ns_log_config, 3, "find_zone(%s, %d)",
+                *name ? name : ".", class);
+       if (lookup_symbol(zone_symbol_table, name, class, &value)) {
+               INSIST(value.integer >= 0 && value.integer < nzones);
+               ns_debug(ns_log_config, 3, "find_zone: existing zone %d",
+                        value.integer);
+               zp = &zones[value.integer];
+               return (zp);
+       }
+       ns_debug(ns_log_config, 3, "find_zone: unknown zone");
+       return (NULL);
+}
+
+static struct zoneinfo *
+new_zone(int class, int type) {
+       struct zoneinfo *zp;
+
+       if (EMPTY(freezones))
+               make_new_zones();
+
+       zp = HEAD(freezones);
+       UNLINK(freezones, zp, z_freelink);
+       return (zp);
+}
+
+/*
+ * Check out a zoneinfo structure and return non-zero if it's OK.
+ */
+static int
+validate_zone(struct zoneinfo *zp) {
+       char filename[MAXPATHLEN+1];
+
+       /* Check name */
+       if (!res_dnok(zp->z_origin)) {
+               ns_error(ns_log_config, "invalid zone name '%s'",
+                        zp->z_origin);
+               return (0);
+       }
+
+       /* Check class */
+       if (zp->z_class == C_ANY || zp->z_class == C_NONE) {
+               ns_error(ns_log_config, "invalid class %d for zone '%s'",
+                        zp->z_class, zp->z_origin);
+               return (0);
+       }
+
+       /* Check type. */
+       if (zp->z_type == 0) {
+               ns_error(ns_log_config, "no type specified for zone '%s'",
+                        zp->z_origin);
+               return (0);
+       }
+       if (zp->z_type == z_cache && ns_samename(zp->z_origin, "") != 1) {
+               ns_error(ns_log_config,
+                        "only the root zone may be a cache zone (zone '%s')",
+                        zp->z_origin);
+               return (0);
+       }
+       if (zp->z_type == z_hint && ns_samename(zp->z_origin, "") != 1) {
+               ns_error(ns_log_config,
+                        "only the root zone may be a hint zone (zone '%s')",
+                        zp->z_origin);
+               return (0);
+       }
+
+       /* Check filename. */
+       if (zp->z_type == z_master && zp->z_source == NULL) {
+               ns_error(ns_log_config,
+                        "'file' statement missing for master zone %s",
+                        zp->z_origin);
+               return (0);
+       }
+       /*
+        * XXX  We should run filename through an OS-specific
+        *      validator here.
+        */
+       if (zp->z_source != NULL && 
+           strlen(zp->z_source) > MAXPATHLEN) {
+               ns_error(ns_log_config, "filename too long for zone '%s'",
+                        zp->z_origin);
+               return (0);
+       }
+
+       if (zp->z_ixfr_base != NULL && strlen(zp->z_ixfr_base) > MAXPATHLEN) {
+               ns_error(ns_log_config, "ixfr filename too long for zone '%s'",
+                        zp->z_origin);
+               return (0);
+       }
+       if (zp->z_ixfr_tmp != NULL && strlen(zp->z_ixfr_tmp) > MAXPATHLEN) {
+               ns_error(ns_log_config, "tmp ixfr filename too long for zone '%s'",
+                        zp->z_origin);
+               return (0);
+       }
+
+       /* Check masters */
+       if (zp->z_addrcnt != 0) {
+               if (zp->z_type == z_master || zp->z_type == z_hint ||
+                   zp->z_type == z_cache) {
+                       ns_error(ns_log_config,
+                               "'masters' statement present for %s zone '%s'",
+                                (zp->z_type == z_master) ? "master" :
+                                (zp->z_type == z_hint) ? "hint" : "cache",
+                                zp->z_origin);
+                       return (0);
+               }
+       } else {
+               if (zp->z_type == z_slave || zp->z_type == z_stub) {
+                       ns_error(ns_log_config,
+                         "no 'masters' statement for non-master zone '%s'",
+                                zp->z_origin);
+                       return (0);
+               }
+       }
+
+       /* Check allow-update and allow-transfer. */
+       if (zp->z_update_acl || zp->z_transfer_acl) {
+               if (zp->z_type != z_master && zp->z_type != z_slave) {



Home | Main Index | Thread Index | Old Index