mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
Reimplemented the built-in CHAOS zones using sdb.
This commit is contained in:
parent
d8720af3a3
commit
17453368fa
@ -13,7 +13,7 @@
|
|||||||
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||||
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
# $Id: Makefile.in,v 1.76 2001/11/06 20:05:01 bwelling Exp $
|
# $Id: Makefile.in,v 1.77 2001/11/20 01:14:55 gson Exp $
|
||||||
|
|
||||||
srcdir = @srcdir@
|
srcdir = @srcdir@
|
||||||
VPATH = @srcdir@
|
VPATH = @srcdir@
|
||||||
@ -63,7 +63,8 @@ SUBDIRS = unix
|
|||||||
|
|
||||||
TARGETS = named lwresd
|
TARGETS = named lwresd
|
||||||
|
|
||||||
OBJS = aclconf.@O@ client.@O@ config.@O@ control.@O@ controlconf.@O@ interfacemgr.@O@ \
|
OBJS = aclconf.@O@ builtin.@O@ client.@O@ config.@O@ control.@O@ \
|
||||||
|
controlconf.@O@ interfacemgr.@O@ \
|
||||||
listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \
|
listenlist.@O@ log.@O@ logconf.@O@ main.@O@ notify.@O@ \
|
||||||
query.@O@ server.@O@ sortlist.@O@ \
|
query.@O@ server.@O@ sortlist.@O@ \
|
||||||
tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
|
tkeyconf.@O@ tsigconf.@O@ update.@O@ xfrout.@O@ \
|
||||||
@ -74,7 +75,8 @@ OBJS = aclconf.@O@ client.@O@ config.@O@ control.@O@ controlconf.@O@ interfacem
|
|||||||
|
|
||||||
UOBJS = unix/os.@O@
|
UOBJS = unix/os.@O@
|
||||||
|
|
||||||
SRCS = aclconf.c client.c config.c control.c controlconf.c interfacemgr.c \
|
SRCS = aclconf.c builtin.c client.c config.c control.c \
|
||||||
|
controlconf.c interfacemgr.c \
|
||||||
listenlist.c log.c logconf.c main.c notify.c \
|
listenlist.c log.c logconf.c main.c notify.c \
|
||||||
query.c server.c sortlist.c \
|
query.c server.c sortlist.c \
|
||||||
tkeyconf.c tsigconf.c update.c xfrout.c \
|
tkeyconf.c tsigconf.c update.c xfrout.c \
|
||||||
|
207
bin/named/builtin.c
Normal file
207
bin/named/builtin.c
Normal file
@ -0,0 +1,207 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2001 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id: builtin.c,v 1.1 2001/11/20 01:14:56 gson Exp $ */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The built-in "version", "hostname", and "authors" databases.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <config.h>
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <isc/print.h>
|
||||||
|
#include <isc/result.h>
|
||||||
|
#include <isc/util.h>
|
||||||
|
|
||||||
|
#include <dns/sdb.h>
|
||||||
|
#include <dns/result.h>
|
||||||
|
|
||||||
|
#include <named/builtin.h>
|
||||||
|
#include <named/globals.h>
|
||||||
|
#include <named/server.h>
|
||||||
|
#include <named/os.h>
|
||||||
|
|
||||||
|
typedef struct builtin builtin_t;
|
||||||
|
|
||||||
|
static isc_result_t do_version_lookup(dns_sdblookup_t *lookup);
|
||||||
|
static isc_result_t do_hostname_lookup(dns_sdblookup_t *lookup);
|
||||||
|
static isc_result_t do_authors_lookup(dns_sdblookup_t *lookup);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We can't use function pointers as the db_data directly
|
||||||
|
* because ANSI C does not guarantee that function pointers
|
||||||
|
* can safely be cast to void pointers and back.
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct builtin {
|
||||||
|
isc_result_t (*do_lookup)(dns_sdblookup_t *lookup);
|
||||||
|
};
|
||||||
|
|
||||||
|
static builtin_t version_builtin = { do_version_lookup };
|
||||||
|
static builtin_t hostname_builtin = { do_hostname_lookup };
|
||||||
|
static builtin_t authors_builtin = { do_authors_lookup };
|
||||||
|
|
||||||
|
static dns_sdbimplementation_t *builtin_impl;
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
builtin_lookup(const char *zone, const char *name, void *dbdata,
|
||||||
|
dns_sdblookup_t *lookup)
|
||||||
|
{
|
||||||
|
builtin_t *b = (builtin_t *) dbdata;
|
||||||
|
|
||||||
|
UNUSED(zone);
|
||||||
|
|
||||||
|
if (strcmp(name, "@") == 0)
|
||||||
|
return (b->do_lookup(lookup));
|
||||||
|
else
|
||||||
|
return (ISC_R_NOTFOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
put_txt(dns_sdblookup_t *lookup, const char *text) {
|
||||||
|
unsigned char buf[256];
|
||||||
|
unsigned int len = strlen(text);
|
||||||
|
if (len > 255)
|
||||||
|
len = 255; /* Silently truncate */
|
||||||
|
buf[0] = len;
|
||||||
|
memcpy(&buf[1], text, len);
|
||||||
|
return (dns_sdb_putrdata(lookup, dns_rdatatype_txt, 0, buf, len + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
do_version_lookup(dns_sdblookup_t *lookup) {
|
||||||
|
if (ns_g_server->version_set) {
|
||||||
|
if (ns_g_server->version == NULL)
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
else
|
||||||
|
return (put_txt(lookup, ns_g_server->version));
|
||||||
|
} else {
|
||||||
|
return (put_txt(lookup, ns_g_version));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
do_hostname_lookup(dns_sdblookup_t *lookup) {
|
||||||
|
if (ns_g_server->hostname_set) {
|
||||||
|
if (ns_g_server->hostname == NULL)
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
else
|
||||||
|
return (put_txt(lookup, ns_g_server->hostname));
|
||||||
|
} else {
|
||||||
|
unsigned char buf[256];
|
||||||
|
isc_result_t result = ns_os_gethostname(buf, sizeof(buf));
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (result);
|
||||||
|
return (put_txt(lookup, buf));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
do_authors_lookup(dns_sdblookup_t *lookup) {
|
||||||
|
isc_result_t result;
|
||||||
|
const char **p;
|
||||||
|
static const char *authors[] = {
|
||||||
|
"Mark Andrews",
|
||||||
|
"James Brister",
|
||||||
|
"Ben Cottrell",
|
||||||
|
"Michael Graff",
|
||||||
|
"Andreas Gustafsson",
|
||||||
|
"Bob Halley",
|
||||||
|
"David Lawrence",
|
||||||
|
"Danny Mayer",
|
||||||
|
"Damien Neil",
|
||||||
|
"Matt Nelson",
|
||||||
|
"Michael Sawyer",
|
||||||
|
"Brian Wellington",
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If a version string is specified, disable the authors.bind zone.
|
||||||
|
*/
|
||||||
|
if (ns_g_server->version_set)
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
|
for (p = authors; *p != NULL; p++) {
|
||||||
|
result = put_txt(lookup, *p);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (result);
|
||||||
|
}
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
builtin_authority(const char *zone, void *dbdata, dns_sdblookup_t *lookup) {
|
||||||
|
isc_result_t result;
|
||||||
|
|
||||||
|
UNUSED(zone);
|
||||||
|
UNUSED(dbdata);
|
||||||
|
|
||||||
|
result = dns_sdb_putsoa(lookup, "@", "hostmaster", 0);
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (ISC_R_FAILURE);
|
||||||
|
result = dns_sdb_putrr(lookup, "ns", 0, "@");
|
||||||
|
if (result != ISC_R_SUCCESS)
|
||||||
|
return (ISC_R_FAILURE);
|
||||||
|
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static isc_result_t
|
||||||
|
builtin_create(const char *zone, int argc, char **argv,
|
||||||
|
void *driverdata, void **dbdata)
|
||||||
|
{
|
||||||
|
UNUSED(zone);
|
||||||
|
UNUSED(driverdata);
|
||||||
|
if (argc != 1)
|
||||||
|
return (DNS_R_SYNTAX);
|
||||||
|
if (strcmp(argv[0], "version") == 0)
|
||||||
|
*dbdata = &version_builtin;
|
||||||
|
else if (strcmp(argv[0], "hostname") == 0)
|
||||||
|
*dbdata = &hostname_builtin;
|
||||||
|
else if (strcmp(argv[0], "authors") == 0)
|
||||||
|
*dbdata = &authors_builtin;
|
||||||
|
else
|
||||||
|
return (ISC_R_NOTIMPLEMENTED);
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
static dns_sdbmethods_t builtin_methods = {
|
||||||
|
builtin_lookup,
|
||||||
|
builtin_authority,
|
||||||
|
NULL, /* allnodes */
|
||||||
|
builtin_create,
|
||||||
|
NULL /* destroy */
|
||||||
|
};
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
|
ns_builtin_init(void) {
|
||||||
|
RUNTIME_CHECK(dns_sdb_register("_builtin", &builtin_methods, NULL,
|
||||||
|
DNS_SDBFLAG_RELATIVEOWNER |
|
||||||
|
DNS_SDBFLAG_RELATIVERDATA,
|
||||||
|
ns_g_mctx, &builtin_impl)
|
||||||
|
== ISC_R_SUCCESS);
|
||||||
|
return (ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ns_builtin_deinit(void) {
|
||||||
|
dns_sdb_unregister(&builtin_impl);
|
||||||
|
}
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: config.c,v 1.19 2001/11/07 04:25:11 marka Exp $ */
|
/* $Id: config.c,v 1.20 2001/11/20 01:14:56 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -87,7 +87,6 @@ options {\n\
|
|||||||
treat-cr-as-space true;\n\
|
treat-cr-as-space true;\n\
|
||||||
use-id-pool true;\n\
|
use-id-pool true;\n\
|
||||||
use-ixfr true;\n\
|
use-ixfr true;\n\
|
||||||
version \""VERSION"\";\n\
|
|
||||||
\n\
|
\n\
|
||||||
/* view */\n\
|
/* view */\n\
|
||||||
allow-notify {none;};\n\
|
allow-notify {none;};\n\
|
||||||
@ -144,7 +143,27 @@ options {\n\
|
|||||||
zone-statistics false;\n\
|
zone-statistics false;\n\
|
||||||
max-journal-size unlimited;\n\
|
max-journal-size unlimited;\n\
|
||||||
ixfr-from-differences false;\n\
|
ixfr-from-differences false;\n\
|
||||||
};";
|
};
|
||||||
|
|
||||||
|
view \"_bind\" chaos {
|
||||||
|
recursion no;
|
||||||
|
|
||||||
|
zone \"version.bind\" chaos {
|
||||||
|
type master;
|
||||||
|
database \"_builtin version\";
|
||||||
|
};
|
||||||
|
|
||||||
|
zone \"hostname.bind\" chaos {
|
||||||
|
type master;
|
||||||
|
database \"_builtin hostname\";
|
||||||
|
};
|
||||||
|
|
||||||
|
zone \"authors.bind\" chaos {
|
||||||
|
type master;
|
||||||
|
database \"_builtin authors\";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
";
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
ns_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
|
ns_config_parsedefaults(cfg_parser_t *parser, cfg_obj_t **conf) {
|
||||||
|
29
bin/named/include/named/builtin.h
Normal file
29
bin/named/include/named/builtin.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2001 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* $Id: builtin.h,v 1.1 2001/11/20 01:18:15 gson Exp $ */
|
||||||
|
|
||||||
|
#ifndef NAMED_BUILTIN_H
|
||||||
|
#define NAMED_BUILTIN_H 1
|
||||||
|
|
||||||
|
#include <isc/types.h>
|
||||||
|
|
||||||
|
isc_result_t ns_builtin_init(void);
|
||||||
|
|
||||||
|
void ns_builtin_deinit(void);
|
||||||
|
|
||||||
|
#endif /* NAMED_BUILTIN_H */
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: server.h,v 1.61 2001/09/15 14:23:26 marka Exp $ */
|
/* $Id: server.h,v 1.62 2001/11/20 01:15:00 gson Exp $ */
|
||||||
|
|
||||||
#ifndef NAMED_SERVER_H
|
#ifndef NAMED_SERVER_H
|
||||||
#define NAMED_SERVER_H 1
|
#define NAMED_SERVER_H 1
|
||||||
@ -49,6 +49,12 @@ struct ns_server {
|
|||||||
isc_quota_t tcpquota;
|
isc_quota_t tcpquota;
|
||||||
isc_quota_t recursionquota;
|
isc_quota_t recursionquota;
|
||||||
dns_acl_t *blackholeacl;
|
dns_acl_t *blackholeacl;
|
||||||
|
char * statsfile; /* Statistics file name */
|
||||||
|
char * dumpfile; /* Dump file name */
|
||||||
|
isc_boolean_t version_set; /* User has set version */
|
||||||
|
char * version; /* User-specified version */
|
||||||
|
isc_boolean_t hostname_set; /* User has set hostname */
|
||||||
|
char * hostname; /* User-specified hostname */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current ACL environment. This defines the
|
* Current ACL environment. This defines the
|
||||||
@ -76,11 +82,8 @@ struct ns_server {
|
|||||||
isc_boolean_t flushonshutdown;
|
isc_boolean_t flushonshutdown;
|
||||||
isc_boolean_t log_queries; /* For BIND 8 compatibility */
|
isc_boolean_t log_queries; /* For BIND 8 compatibility */
|
||||||
|
|
||||||
char * statsfile; /* Statistics file name */
|
|
||||||
isc_uint64_t * querystats; /* Query statistics counters */
|
isc_uint64_t * querystats; /* Query statistics counters */
|
||||||
|
|
||||||
char * dumpfile; /* Dump file name */
|
|
||||||
|
|
||||||
ns_controls_t * controls; /* Control channels */
|
ns_controls_t * controls; /* Control channels */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: main.c,v 1.125 2001/10/26 22:54:22 gson Exp $ */
|
/* $Id: main.c,v 1.126 2001/11/20 01:14:57 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -50,6 +50,7 @@
|
|||||||
*/
|
*/
|
||||||
#define NS_MAIN 1
|
#define NS_MAIN 1
|
||||||
|
|
||||||
|
#include <named/builtin.h>
|
||||||
#include <named/control.h>
|
#include <named/control.h>
|
||||||
#include <named/globals.h> /* Explicit, though named/log.h includes it. */
|
#include <named/globals.h> /* Explicit, though named/log.h includes it. */
|
||||||
#include <named/interfacemgr.h>
|
#include <named/interfacemgr.h>
|
||||||
@ -570,6 +571,8 @@ setup(void) {
|
|||||||
ns_main_earlyfatal("create_managers() failed: %s",
|
ns_main_earlyfatal("create_managers() failed: %s",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
|
|
||||||
|
ns_builtin_init();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add calls to register sdb drivers here.
|
* Add calls to register sdb drivers here.
|
||||||
*/
|
*/
|
||||||
@ -584,6 +587,8 @@ cleanup(void) {
|
|||||||
|
|
||||||
ns_server_destroy(&ns_g_server);
|
ns_server_destroy(&ns_g_server);
|
||||||
|
|
||||||
|
ns_builtin_deinit();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Add calls to unregister sdb drivers here.
|
* Add calls to unregister sdb drivers here.
|
||||||
*/
|
*/
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: server.c,v 1.361 2001/11/07 23:01:41 gson Exp $ */
|
/* $Id: server.c,v 1.362 2001/11/20 01:14:58 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -482,7 +482,8 @@ configure_peer(cfg_obj_t *cpeer, isc_mem_t *mctx, dns_peer_t **peerp) {
|
|||||||
*/
|
*/
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||||
isc_mem_t *mctx, ns_aclconfctx_t *actx)
|
isc_mem_t *mctx, ns_aclconfctx_t *actx,
|
||||||
|
isc_boolean_t need_hints)
|
||||||
{
|
{
|
||||||
cfg_obj_t *maps[4];
|
cfg_obj_t *maps[4];
|
||||||
cfg_obj_t *cfgmaps[3];
|
cfg_obj_t *cfgmaps[3];
|
||||||
@ -694,15 +695,16 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
|||||||
*/
|
*/
|
||||||
if (view->hints == NULL) {
|
if (view->hints == NULL) {
|
||||||
dns_zone_t *rootzone = NULL;
|
dns_zone_t *rootzone = NULL;
|
||||||
dns_view_findzone(view, dns_rootname, &rootzone);
|
(void)dns_view_findzone(view, dns_rootname, &rootzone);
|
||||||
if (rootzone != NULL) {
|
if (rootzone != NULL) {
|
||||||
dns_zone_detach(&rootzone);
|
dns_zone_detach(&rootzone);
|
||||||
} else {
|
need_hints = ISC_FALSE;
|
||||||
|
}
|
||||||
|
if (need_hints)
|
||||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
|
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
|
||||||
NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
NS_LOGMODULE_SERVER, ISC_LOG_WARNING,
|
||||||
"no root hints for view '%s'",
|
"no root hints for view '%s'",
|
||||||
view->name);
|
view->name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -868,301 +870,6 @@ configure_view(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
|||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the special view that handles queries under "bind. CH".
|
|
||||||
*/
|
|
||||||
static isc_result_t
|
|
||||||
create_bind_view(dns_view_t **viewp) {
|
|
||||||
isc_result_t result;
|
|
||||||
dns_view_t *view = NULL;
|
|
||||||
|
|
||||||
REQUIRE(viewp != NULL && *viewp == NULL);
|
|
||||||
|
|
||||||
CHECK(dns_view_create(ns_g_mctx, dns_rdataclass_ch, "_bind", &view));
|
|
||||||
|
|
||||||
/* Transfer ownership. */
|
|
||||||
*viewp = view;
|
|
||||||
view = NULL;
|
|
||||||
|
|
||||||
result = ISC_R_SUCCESS;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (view != NULL)
|
|
||||||
dns_view_detach(&view);
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the zone that handles queries for "version.bind. CH". The
|
|
||||||
* version string is returned either from the "version" configuration
|
|
||||||
* option or the global defaults.
|
|
||||||
*/
|
|
||||||
static isc_result_t
|
|
||||||
create_version_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) {
|
|
||||||
isc_result_t result;
|
|
||||||
dns_db_t *db = NULL;
|
|
||||||
dns_zone_t *zone = NULL;
|
|
||||||
dns_dbversion_t *dbver = NULL;
|
|
||||||
dns_difftuple_t *tuple = NULL;
|
|
||||||
dns_diff_t diff;
|
|
||||||
char *versiontext;
|
|
||||||
unsigned char buf[256];
|
|
||||||
isc_region_t r;
|
|
||||||
size_t len;
|
|
||||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
|
||||||
static unsigned char origindata[] = "\007version\004bind";
|
|
||||||
dns_name_t origin;
|
|
||||||
cfg_obj_t *obj = NULL;
|
|
||||||
|
|
||||||
dns_diff_init(ns_g_mctx, &diff);
|
|
||||||
|
|
||||||
dns_name_init(&origin, NULL);
|
|
||||||
r.base = origindata;
|
|
||||||
r.length = sizeof(origindata);
|
|
||||||
dns_name_fromregion(&origin, &r);
|
|
||||||
|
|
||||||
result = ns_config_get(maps, "version", &obj);
|
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
|
||||||
if (cfg_obj_isvoid(obj))
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
|
|
||||||
versiontext = cfg_obj_asstring(obj);
|
|
||||||
len = strlen(versiontext);
|
|
||||||
if (len > 255)
|
|
||||||
len = 255; /* Silently truncate. */
|
|
||||||
buf[0] = len;
|
|
||||||
memcpy(buf + 1, versiontext, len);
|
|
||||||
|
|
||||||
r.base = buf;
|
|
||||||
r.length = 1 + len;
|
|
||||||
dns_rdata_fromregion(&rdata, dns_rdataclass_ch, dns_rdatatype_txt, &r);
|
|
||||||
|
|
||||||
CHECK(dns_zone_create(&zone, ns_g_mctx));
|
|
||||||
CHECK(dns_zone_setorigin(zone, &origin));
|
|
||||||
dns_zone_settype(zone, dns_zone_master);
|
|
||||||
dns_zone_setclass(zone, dns_rdataclass_ch);
|
|
||||||
dns_zone_setview(zone, view);
|
|
||||||
|
|
||||||
CHECK(dns_zonemgr_managezone(zmgr, zone));
|
|
||||||
|
|
||||||
CHECK(dns_db_create(ns_g_mctx, "rbt", &origin, dns_dbtype_zone,
|
|
||||||
dns_rdataclass_ch, 0, NULL, &db));
|
|
||||||
|
|
||||||
CHECK(dns_db_newversion(db, &dbver));
|
|
||||||
|
|
||||||
CHECK(dns_difftuple_create(ns_g_mctx, DNS_DIFFOP_ADD, &origin,
|
|
||||||
0, &rdata, &tuple));
|
|
||||||
dns_diff_append(&diff, &tuple);
|
|
||||||
CHECK(dns_diff_apply(&diff, db, dbver));
|
|
||||||
|
|
||||||
dns_db_closeversion(db, &dbver, ISC_TRUE);
|
|
||||||
|
|
||||||
CHECK(dns_zone_replacedb(zone, db, ISC_FALSE));
|
|
||||||
|
|
||||||
CHECK(dns_view_addzone(view, zone));
|
|
||||||
|
|
||||||
result = ISC_R_SUCCESS;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (zone != NULL)
|
|
||||||
dns_zone_detach(&zone);
|
|
||||||
if (dbver != NULL)
|
|
||||||
dns_db_closeversion(db, &dbver, ISC_FALSE);
|
|
||||||
if (db != NULL)
|
|
||||||
dns_db_detach(&db);
|
|
||||||
dns_diff_clear(&diff);
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the zone that handles queries for "hostname.bind. CH". The
|
|
||||||
* hostname string is returned either from the "hostname" configuration
|
|
||||||
* option or the the result of gethostbyname().
|
|
||||||
*/
|
|
||||||
static isc_result_t
|
|
||||||
create_hostname_zone(cfg_obj_t **maps, dns_zonemgr_t *zmgr, dns_view_t *view) {
|
|
||||||
isc_result_t result;
|
|
||||||
dns_db_t *db = NULL;
|
|
||||||
dns_zone_t *zone = NULL;
|
|
||||||
dns_dbversion_t *dbver = NULL;
|
|
||||||
dns_difftuple_t *tuple = NULL;
|
|
||||||
dns_diff_t diff;
|
|
||||||
char *hostnametext;
|
|
||||||
unsigned char buf[256];
|
|
||||||
isc_region_t r;
|
|
||||||
size_t len;
|
|
||||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
|
||||||
static unsigned char origindata[] = "\010hostname\004bind";
|
|
||||||
dns_name_t origin;
|
|
||||||
cfg_obj_t *obj = NULL;
|
|
||||||
|
|
||||||
dns_name_init(&origin, NULL);
|
|
||||||
r.base = origindata;
|
|
||||||
r.length = sizeof(origindata);
|
|
||||||
dns_name_fromregion(&origin, &r);
|
|
||||||
|
|
||||||
result = ns_config_get(maps, "hostname", &obj);
|
|
||||||
if (result == ISC_R_SUCCESS) {
|
|
||||||
if (cfg_obj_isvoid(obj))
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
hostnametext = cfg_obj_asstring(obj);
|
|
||||||
len = strlen(hostnametext);
|
|
||||||
if (len > 255)
|
|
||||||
len = 255; /* Silently truncate. */
|
|
||||||
buf[0] = len;
|
|
||||||
memcpy(buf + 1, hostnametext, len);
|
|
||||||
} else {
|
|
||||||
result = ns_os_gethostname((char *)buf + 1, sizeof(buf) - 1);
|
|
||||||
if (result != ISC_R_SUCCESS)
|
|
||||||
return (ISC_R_SUCCESS); /* Silent failure */
|
|
||||||
len = strlen((char *)buf + 1);
|
|
||||||
buf[0] = len;
|
|
||||||
}
|
|
||||||
|
|
||||||
r.base = buf;
|
|
||||||
r.length = 1 + len;
|
|
||||||
dns_rdata_fromregion(&rdata, dns_rdataclass_ch, dns_rdatatype_txt, &r);
|
|
||||||
|
|
||||||
dns_diff_init(ns_g_mctx, &diff);
|
|
||||||
|
|
||||||
CHECK(dns_zone_create(&zone, ns_g_mctx));
|
|
||||||
CHECK(dns_zone_setorigin(zone, &origin));
|
|
||||||
dns_zone_settype(zone, dns_zone_master);
|
|
||||||
dns_zone_setclass(zone, dns_rdataclass_ch);
|
|
||||||
dns_zone_setview(zone, view);
|
|
||||||
|
|
||||||
CHECK(dns_zonemgr_managezone(zmgr, zone));
|
|
||||||
|
|
||||||
CHECK(dns_db_create(ns_g_mctx, "rbt", &origin, dns_dbtype_zone,
|
|
||||||
dns_rdataclass_ch, 0, NULL, &db));
|
|
||||||
|
|
||||||
CHECK(dns_db_newversion(db, &dbver));
|
|
||||||
|
|
||||||
CHECK(dns_difftuple_create(ns_g_mctx, DNS_DIFFOP_ADD, &origin,
|
|
||||||
0, &rdata, &tuple));
|
|
||||||
dns_diff_append(&diff, &tuple);
|
|
||||||
CHECK(dns_diff_apply(&diff, db, dbver));
|
|
||||||
|
|
||||||
dns_db_closeversion(db, &dbver, ISC_TRUE);
|
|
||||||
|
|
||||||
CHECK(dns_zone_replacedb(zone, db, ISC_FALSE));
|
|
||||||
|
|
||||||
CHECK(dns_view_addzone(view, zone));
|
|
||||||
|
|
||||||
result = ISC_R_SUCCESS;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (zone != NULL)
|
|
||||||
dns_zone_detach(&zone);
|
|
||||||
if (dbver != NULL)
|
|
||||||
dns_db_closeversion(db, &dbver, ISC_FALSE);
|
|
||||||
if (db != NULL)
|
|
||||||
dns_db_detach(&db);
|
|
||||||
dns_diff_clear(&diff);
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create the special zone that handles queries for "authors.bind. CH".
|
|
||||||
* The strings returned list the BIND 9 authors.
|
|
||||||
*/
|
|
||||||
static isc_result_t
|
|
||||||
create_authors_zone(cfg_obj_t *options, dns_zonemgr_t *zmgr, dns_view_t *view)
|
|
||||||
{
|
|
||||||
isc_result_t result;
|
|
||||||
dns_db_t *db = NULL;
|
|
||||||
dns_zone_t *zone = NULL;
|
|
||||||
dns_dbversion_t *dbver = NULL;
|
|
||||||
dns_difftuple_t *tuple;
|
|
||||||
dns_diff_t diff;
|
|
||||||
isc_constregion_t r;
|
|
||||||
isc_constregion_t cr;
|
|
||||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
|
||||||
static const char origindata[] = "\007authors\004bind";
|
|
||||||
dns_name_t origin;
|
|
||||||
int i;
|
|
||||||
static const char *authors[] = {
|
|
||||||
"\014Mark Andrews",
|
|
||||||
"\015James Brister",
|
|
||||||
"\014Ben Cottrell",
|
|
||||||
"\015Michael Graff",
|
|
||||||
"\022Andreas Gustafsson",
|
|
||||||
"\012Bob Halley",
|
|
||||||
"\016David Lawrence",
|
|
||||||
"\013Danny Mayer",
|
|
||||||
"\013Damien Neil",
|
|
||||||
"\013Matt Nelson",
|
|
||||||
"\016Michael Sawyer",
|
|
||||||
"\020Brian Wellington",
|
|
||||||
NULL,
|
|
||||||
};
|
|
||||||
cfg_obj_t *obj = NULL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If a version string is specified, disable the authors.bind zone.
|
|
||||||
*/
|
|
||||||
if (options != NULL &&
|
|
||||||
cfg_map_get(options, "version", &obj) == ISC_R_SUCCESS)
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
|
|
||||||
dns_diff_init(ns_g_mctx, &diff);
|
|
||||||
|
|
||||||
dns_name_init(&origin, NULL);
|
|
||||||
r.base = origindata;
|
|
||||||
r.length = sizeof(origindata);
|
|
||||||
dns_name_fromregion(&origin, (isc_region_t *)&r);
|
|
||||||
|
|
||||||
CHECK(dns_zone_create(&zone, ns_g_mctx));
|
|
||||||
CHECK(dns_zone_setorigin(zone, &origin));
|
|
||||||
dns_zone_settype(zone, dns_zone_master);
|
|
||||||
dns_zone_setclass(zone, dns_rdataclass_ch);
|
|
||||||
dns_zone_setview(zone, view);
|
|
||||||
|
|
||||||
CHECK(dns_zonemgr_managezone(zmgr, zone));
|
|
||||||
|
|
||||||
CHECK(dns_db_create(ns_g_mctx, "rbt", &origin, dns_dbtype_zone,
|
|
||||||
dns_rdataclass_ch, 0, NULL, &db));
|
|
||||||
|
|
||||||
CHECK(dns_db_newversion(db, &dbver));
|
|
||||||
|
|
||||||
for (i = 0; authors[i] != NULL; i++) {
|
|
||||||
cr.base = authors[i];
|
|
||||||
cr.length = strlen(authors[i]);
|
|
||||||
INSIST(cr.length == ((const unsigned char *)cr.base)[0] + 1U);
|
|
||||||
dns_rdata_fromregion(&rdata, dns_rdataclass_ch,
|
|
||||||
dns_rdatatype_txt, (isc_region_t *)&cr);
|
|
||||||
tuple = NULL;
|
|
||||||
CHECK(dns_difftuple_create(ns_g_mctx, DNS_DIFFOP_ADD, &origin,
|
|
||||||
0, &rdata, &tuple));
|
|
||||||
dns_diff_append(&diff, &tuple);
|
|
||||||
dns_rdata_reset(&rdata);
|
|
||||||
}
|
|
||||||
|
|
||||||
CHECK(dns_diff_apply(&diff, db, dbver));
|
|
||||||
|
|
||||||
dns_db_closeversion(db, &dbver, ISC_TRUE);
|
|
||||||
|
|
||||||
CHECK(dns_zone_replacedb(zone, db, ISC_FALSE));
|
|
||||||
|
|
||||||
CHECK(dns_view_addzone(view, zone));
|
|
||||||
|
|
||||||
result = ISC_R_SUCCESS;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
if (zone != NULL)
|
|
||||||
dns_zone_detach(&zone);
|
|
||||||
if (dbver != NULL)
|
|
||||||
dns_db_closeversion(db, &dbver, ISC_FALSE);
|
|
||||||
if (db != NULL)
|
|
||||||
dns_db_detach(&db);
|
|
||||||
dns_diff_clear(&diff);
|
|
||||||
|
|
||||||
return (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
configure_hints(dns_view_t *view, const char *filename) {
|
configure_hints(dns_view_t *view, const char *filename) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
@ -1623,34 +1330,41 @@ heartbeat_timer_tick(isc_task_t *task, isc_event_t *event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace the current value of '*field', a dynamically allocated
|
||||||
|
* string or NULL, with a dynamically allocated copy of the
|
||||||
|
* null-terminated string pointed to by 'value', or NULL.
|
||||||
|
*/
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
setstatsfile(ns_server_t *server, const char *name) {
|
setstring(ns_server_t *server, char **field, const char *value) {
|
||||||
char *p;
|
char *copy;
|
||||||
|
|
||||||
REQUIRE(name != NULL);
|
if (value != NULL) {
|
||||||
|
copy = isc_mem_strdup(server->mctx, value);
|
||||||
|
if (copy == NULL)
|
||||||
|
return (ISC_R_NOMEMORY);
|
||||||
|
} else {
|
||||||
|
copy = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
p = isc_mem_strdup(server->mctx, name);
|
if (*field != NULL)
|
||||||
if (p == NULL)
|
isc_mem_free(server->mctx, *field);
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
if (server->statsfile != NULL)
|
*field = copy;
|
||||||
isc_mem_free(server->mctx, server->statsfile);
|
|
||||||
server->statsfile = p;
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Replace the current value of '*field', a dynamically allocated
|
||||||
|
* string or NULL, with another dynamically allocated string
|
||||||
|
* or NULL if whether 'obj' is a string or void value, respectively.
|
||||||
|
*/
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
setdumpfile(ns_server_t *server, const char *name) {
|
setoptstring(ns_server_t *server, char **field, cfg_obj_t *obj) {
|
||||||
char *p;
|
if (cfg_obj_isvoid(obj))
|
||||||
|
return (setstring(server, field, NULL));
|
||||||
REQUIRE(name != NULL);
|
else
|
||||||
|
return (setstring(server, field, cfg_obj_asstring(obj)));
|
||||||
p = isc_mem_strdup(server->mctx, name);
|
|
||||||
if (p == NULL)
|
|
||||||
return (ISC_R_NOMEMORY);
|
|
||||||
if (server->dumpfile != NULL)
|
|
||||||
isc_mem_free(server->mctx, server->dumpfile);
|
|
||||||
server->dumpfile = p;
|
|
||||||
return (ISC_R_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -1707,6 +1421,7 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||||||
cfg_obj_t *views;
|
cfg_obj_t *views;
|
||||||
cfg_obj_t *obj;
|
cfg_obj_t *obj;
|
||||||
cfg_obj_t *maps[3];
|
cfg_obj_t *maps[3];
|
||||||
|
cfg_obj_t *builtin_views;
|
||||||
cfg_listelt_t *element;
|
cfg_listelt_t *element;
|
||||||
dns_view_t *view = NULL;
|
dns_view_t *view = NULL;
|
||||||
dns_view_t *view_next;
|
dns_view_t *view_next;
|
||||||
@ -1965,14 +1680,13 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||||||
element != NULL;
|
element != NULL;
|
||||||
element = cfg_list_next(element))
|
element = cfg_list_next(element))
|
||||||
{
|
{
|
||||||
cfg_obj_t *vconfig;
|
cfg_obj_t *vconfig = cfg_listelt_value(element);
|
||||||
|
|
||||||
view = NULL;
|
view = NULL;
|
||||||
vconfig = cfg_listelt_value(element);
|
|
||||||
CHECK(create_view(vconfig, &viewlist, &view));
|
CHECK(create_view(vconfig, &viewlist, &view));
|
||||||
INSIST(view != NULL);
|
INSIST(view != NULL);
|
||||||
CHECK(configure_view(view, config, vconfig,
|
CHECK(configure_view(view, config, vconfig,
|
||||||
ns_g_mctx, &aclconfctx));
|
ns_g_mctx, &aclconfctx, ISC_TRUE));
|
||||||
dns_view_freeze(view);
|
dns_view_freeze(view);
|
||||||
dns_view_detach(&view);
|
dns_view_detach(&view);
|
||||||
}
|
}
|
||||||
@ -1990,21 +1704,30 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||||||
*/
|
*/
|
||||||
CHECK(create_view(NULL, &viewlist, &view));
|
CHECK(create_view(NULL, &viewlist, &view));
|
||||||
CHECK(configure_view(view, config, NULL, ns_g_mctx,
|
CHECK(configure_view(view, config, NULL, ns_g_mctx,
|
||||||
&aclconfctx));
|
&aclconfctx, ISC_TRUE));
|
||||||
dns_view_freeze(view);
|
dns_view_freeze(view);
|
||||||
dns_view_detach(&view);
|
dns_view_detach(&view);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create (or recreate) the internal _bind view.
|
* Create (or recreate) the built-in views. Currently
|
||||||
|
* there is only one, the _bind view.
|
||||||
*/
|
*/
|
||||||
CHECK(create_bind_view(&view));
|
builtin_views = NULL;
|
||||||
ISC_LIST_APPEND(viewlist, view, link);
|
RUNTIME_CHECK(cfg_map_get(ns_g_config, "view",
|
||||||
CHECK(create_version_zone(maps, server->zonemgr, view));
|
&builtin_views) == ISC_R_SUCCESS);
|
||||||
CHECK(create_authors_zone(options, server->zonemgr, view));
|
for (element = cfg_list_first(builtin_views);
|
||||||
CHECK(create_hostname_zone(maps, server->zonemgr, view));
|
element != NULL;
|
||||||
dns_view_freeze(view);
|
element = cfg_list_next(element))
|
||||||
view = NULL;
|
{
|
||||||
|
cfg_obj_t *vconfig = cfg_listelt_value(element);
|
||||||
|
CHECK(create_view(vconfig, &viewlist, &view));
|
||||||
|
CHECK(configure_view(view, config, cfg_listelt_value(element),
|
||||||
|
ns_g_mctx, &aclconfctx, ISC_FALSE));
|
||||||
|
dns_view_freeze(view);
|
||||||
|
dns_view_detach(&view);
|
||||||
|
view = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Swap our new view list with the production one.
|
* Swap our new view list with the production one.
|
||||||
@ -2167,12 +1890,34 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||||||
obj = NULL;
|
obj = NULL;
|
||||||
result = ns_config_get(maps, "statistics-file", &obj);
|
result = ns_config_get(maps, "statistics-file", &obj);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
CHECKM(setstatsfile(server, cfg_obj_asstring(obj)), "strdup");
|
CHECKM(setstring(server, &server->statsfile, cfg_obj_asstring(obj)),
|
||||||
|
"strdup");
|
||||||
|
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
result = ns_config_get(maps, "dump-file", &obj);
|
result = ns_config_get(maps, "dump-file", &obj);
|
||||||
INSIST(result == ISC_R_SUCCESS);
|
INSIST(result == ISC_R_SUCCESS);
|
||||||
CHECKM(setdumpfile(server, cfg_obj_asstring(obj)), "strdup");
|
CHECKM(setstring(server, &server->dumpfile, cfg_obj_asstring(obj)),
|
||||||
|
"strdup");
|
||||||
|
|
||||||
|
obj = NULL;
|
||||||
|
result = ns_config_get(maps, "version", &obj);
|
||||||
|
if (result == ISC_R_SUCCESS) {
|
||||||
|
CHECKM(setoptstring(server, &server->version, obj), "strdup");
|
||||||
|
server->version_set = ISC_TRUE;
|
||||||
|
} else {
|
||||||
|
server->version_set = ISC_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
obj = NULL;
|
||||||
|
result = ns_config_get(maps, "hostname", &obj);
|
||||||
|
if (result == ISC_R_SUCCESS) {
|
||||||
|
CHECKM(setoptstring(server, &server->hostname, obj), "strdup");
|
||||||
|
server->hostname_set = ISC_TRUE;
|
||||||
|
} else {
|
||||||
|
server->hostname_set = ISC_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
result = ISC_R_SUCCESS;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
ns_aclconfctx_destroy(&aclconfctx);
|
ns_aclconfctx_destroy(&aclconfctx);
|
||||||
@ -2456,13 +2201,19 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
|
|||||||
CHECKFATAL(server->statsfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS,
|
CHECKFATAL(server->statsfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS,
|
||||||
"isc_mem_strdup");
|
"isc_mem_strdup");
|
||||||
server->querystats = NULL;
|
server->querystats = NULL;
|
||||||
CHECKFATAL(dns_stats_alloccounters(ns_g_mctx, &server->querystats),
|
|
||||||
"dns_stats_alloccounters");
|
|
||||||
|
|
||||||
server->dumpfile = isc_mem_strdup(server->mctx, "named_dump.db");
|
server->dumpfile = isc_mem_strdup(server->mctx, "named_dump.db");
|
||||||
CHECKFATAL(server->dumpfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS,
|
CHECKFATAL(server->dumpfile == NULL ? ISC_R_NOMEMORY : ISC_R_SUCCESS,
|
||||||
"isc_mem_strdup");
|
"isc_mem_strdup");
|
||||||
|
|
||||||
|
server->hostname_set = ISC_FALSE;
|
||||||
|
server->hostname = NULL;
|
||||||
|
server->version_set = ISC_FALSE;
|
||||||
|
server->version = NULL;
|
||||||
|
|
||||||
|
CHECKFATAL(dns_stats_alloccounters(ns_g_mctx, &server->querystats),
|
||||||
|
"dns_stats_alloccounters");
|
||||||
|
|
||||||
server->flushonshutdown = ISC_FALSE;
|
server->flushonshutdown = ISC_FALSE;
|
||||||
server->log_queries = ISC_FALSE;
|
server->log_queries = ISC_FALSE;
|
||||||
|
|
||||||
@ -2482,10 +2233,15 @@ ns_server_destroy(ns_server_t **serverp) {
|
|||||||
ns_controls_destroy(&server->controls);
|
ns_controls_destroy(&server->controls);
|
||||||
|
|
||||||
dns_stats_freecounters(server->mctx, &server->querystats);
|
dns_stats_freecounters(server->mctx, &server->querystats);
|
||||||
isc_mem_free(server->mctx, server->statsfile);
|
|
||||||
|
|
||||||
|
isc_mem_free(server->mctx, server->statsfile);
|
||||||
isc_mem_free(server->mctx, server->dumpfile);
|
isc_mem_free(server->mctx, server->dumpfile);
|
||||||
|
|
||||||
|
if (server->version != NULL)
|
||||||
|
isc_mem_free(server->mctx, server->version);
|
||||||
|
if (server->hostname != NULL)
|
||||||
|
isc_mem_free(server->mctx, server->hostname);
|
||||||
|
|
||||||
dns_zonemgr_detach(&server->zonemgr);
|
dns_zonemgr_detach(&server->zonemgr);
|
||||||
|
|
||||||
if (server->tkeyctx != NULL)
|
if (server->tkeyctx != NULL)
|
||||||
|
@ -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.352 2001/11/12 19:05:38 gson Exp $ */
|
/* $Id: zone.c,v 1.353 2001/11/20 01:15:01 gson Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@ -1333,7 +1333,10 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
|
|||||||
zone_needdump(zone, DNS_DUMP_DELAY);
|
zone_needdump(zone, DNS_DUMP_DELAY);
|
||||||
if (zone->task != NULL)
|
if (zone->task != NULL)
|
||||||
zone_settimer(zone, &now);
|
zone_settimer(zone, &now);
|
||||||
dns_zone_log(zone, ISC_LOG_INFO, "loaded serial %u", zone->serial);
|
|
||||||
|
if (! dns_db_ispersistent(db))
|
||||||
|
dns_zone_log(zone, ISC_LOG_INFO, "loaded serial %u", zone->serial);
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
@ -85,11 +85,13 @@
|
|||||||
./bin/named/.cvsignore X 1999,2000,2001
|
./bin/named/.cvsignore X 1999,2000,2001
|
||||||
./bin/named/Makefile.in MAKE 1998,1999,2000,2001
|
./bin/named/Makefile.in MAKE 1998,1999,2000,2001
|
||||||
./bin/named/aclconf.c C 1999,2000,2001
|
./bin/named/aclconf.c C 1999,2000,2001
|
||||||
|
./bin/named/builtin.c C 2001
|
||||||
./bin/named/client.c C 1999,2000,2001
|
./bin/named/client.c C 1999,2000,2001
|
||||||
./bin/named/config.c C 2001
|
./bin/named/config.c C 2001
|
||||||
./bin/named/control.c C 2001
|
./bin/named/control.c C 2001
|
||||||
./bin/named/controlconf.c C 2001
|
./bin/named/controlconf.c C 2001
|
||||||
./bin/named/include/named/aclconf.h C 1999,2000,2001
|
./bin/named/include/named/aclconf.h C 1999,2000,2001
|
||||||
|
./bin/named/include/named/builtin.h C 2001
|
||||||
./bin/named/include/named/client.h C 1999,2000,2001
|
./bin/named/include/named/client.h C 1999,2000,2001
|
||||||
./bin/named/include/named/config.h C 2001
|
./bin/named/include/named/config.h C 2001
|
||||||
./bin/named/include/named/control.h C 2001
|
./bin/named/include/named/control.h C 2001
|
||||||
|
Loading…
x
Reference in New Issue
Block a user