Commit b20ee662 authored by Mark Andrews's avatar Mark Andrews
Browse files

521. [bug] Detect master files which contain $INCLUDE and always

                        reload. [RT #196]

new result code DNS_R_SEENINCLUDE
dns_master_load* can now return DNS_R_SEENINCLUDE
parent 0491a315
521. [bug] Detect master files which contain $INCLUDE and always
reload. [RT #196]
520. [bug] Upgraded libtool to 1.3.5, which allows shared
library builds to work on AIX (and possibly others).
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signkey.c,v 1.37 2000/09/26 22:11:22 bwelling Exp $ */
/* $Id: dnssec-signkey.c,v 1.38 2000/10/17 07:22:21 marka Exp $ */
#include <config.h>
......@@ -273,7 +273,7 @@ main(int argc, char *argv[]) {
check_result(result, "dns_db_create()");
result = dns_db_load(db, argv[0]);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
fatal("failed to load database from '%s': %s", argv[0],
isc_result_totext(result));
......
......@@ -17,7 +17,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dnssec-signzone.c,v 1.100 2000/09/26 22:11:23 bwelling Exp $ */
/* $Id: dnssec-signzone.c,v 1.101 2000/10/17 07:22:22 marka Exp $ */
#include <config.h>
......@@ -460,7 +460,7 @@ opendb(const char *prefix, dns_name_t *name, dns_rdataclass_t rdclass,
check_result(result, "dns_db_create()");
result = dns_db_load(*db, filename);
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
dns_db_detach(db);
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: server.c,v 1.229 2000/10/13 22:35:45 bwelling Exp $ */
/* $Id: server.c,v 1.230 2000/10/17 07:22:23 marka Exp $ */
#include <config.h>
......@@ -477,6 +477,7 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview,
NS_LOGMODULE_SERVER,
ISC_LOG_DEBUG(1), "loading cache '%s'",
ns_g_cachefile);
/* DNS_R_SEENINCLUDE should be impossible here. */
CHECK(dns_db_load(view->cachedb, ns_g_cachefile));
}
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.62 2000/10/13 23:21:16 bwelling Exp $ */
/* $Id: zoneconf.c,v 1.63 2000/10/17 07:22:35 marka Exp $ */
#include <config.h>
......@@ -239,12 +239,14 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
dns_zone_setqueryacl,
dns_zone_clearqueryacl));
result = dns_c_zone_getdialup(czone, &boolean);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getdialup(cctx, &boolean);
if (result != ISC_R_SUCCESS)
boolean = ISC_FALSE;
dns_zone_setoption(zone, DNS_ZONEOPT_DIALUP, boolean);
if (czone->ztype != dns_c_zone_hint) {
result = dns_c_zone_getdialup(czone, &boolean);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getdialup(cctx, &boolean);
if (result != ISC_R_SUCCESS)
boolean = ISC_FALSE;
dns_zone_setoption(zone, DNS_ZONEOPT_DIALUP, boolean);
}
#ifndef NOMINUM_PUBLIC
if (czone->ztype != dns_c_zone_stub) {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db_test.c,v 1.53 2000/08/01 01:12:40 tale Exp $ */
/* $Id: db_test.c,v 1.54 2000/10/17 07:22:25 marka Exp $ */
/*
* Principal Author: Bob Halley
......@@ -284,7 +284,7 @@ load(const char *filename, const char *origintext, isc_boolean_t cache) {
printf("loading %s (%s)\n", filename, origintext);
result = dns_db_load(dbi->db, filename);
if (result != ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
dns_db_detach(&dbi->db);
isc_mem_put(mctx, dbi, sizeof *dbi);
return (result);
......
......@@ -9,4 +9,4 @@
# class is the zone's class
# expected_result is a text representation of a dns_result_t
#
master8.data test in ISC_R_SUCCESS
master8.data test in DNS_R_SEENINCLUDE
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nxtify.c,v 1.16 2000/09/15 21:40:39 bwelling Exp $ */
/* $Id: nxtify.c,v 1.17 2000/10/17 07:22:26 marka Exp $ */
#include <config.h>
......@@ -146,6 +146,8 @@ nxtify(char *filename) {
dns_rdataclass_in, 0, NULL, &db);
check_result(result, "dns_db_create()");
result = dns_db_load(db, filename);
if (result == DNS_R_SEENINCLUDE)
result = ISC_R_SUCCCESS;
check_result(result, "dns_db_load()");
wversion = NULL;
result = dns_db_newversion(db, &wversion);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: db.c,v 1.56 2000/09/26 22:45:52 bwelling Exp $ */
/* $Id: db.c,v 1.57 2000/10/17 07:22:29 marka Exp $ */
/***
*** Imports
......@@ -32,6 +32,7 @@
#include <dns/master.h>
#include <dns/rdata.h>
#include <dns/rdataset.h>
#include <dns/result.h>
/***
*** Private Types
......@@ -287,7 +288,7 @@ dns_db_load(dns_db_t *db, const char *filename) {
* result if dns_master_loadfile() succeeded. If dns_master_loadfile()
* failed, we want to return the result code it gave us.
*/
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE)
result = eresult;
return (result);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.h,v 1.24 2000/09/05 03:35:22 marka Exp $ */
/* $Id: master.h,v 1.25 2000/10/17 07:22:36 marka Exp $ */
#ifndef DNS_MASTER_H
#define DNS_MASTER_H 1
......@@ -136,6 +136,8 @@ dns_master_loadfilequota(const char *master_file, dns_name_t *top,
*
* Returns:
* ISC_R_SUCCESS upon successfully loading the master file.
* ISC_R_SEENINCLUDE upon successfully loading the master file with
* a $INCLUDE statement.
* ISC_R_NOMEMORY out of memory.
* ISC_R_UNEXPECTEDEND expected to be able to read a input token and
* there was not one.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: result.h,v 1.68 2000/10/16 04:08:13 marka Exp $ */
/* $Id: result.h,v 1.69 2000/10/17 07:22:38 marka Exp $ */
#ifndef DNS_RESULT_H
#define DNS_RESULT_H 1
......@@ -102,8 +102,9 @@
#define DNS_R_RECOVERABLE (ISC_RESULTCLASS_DNS + 63)
#define DNS_R_UNKNOWNOPT (ISC_RESULTCLASS_DNS + 64)
#define DNS_R_UNEXPECTEDID (ISC_RESULTCLASS_DNS + 65)
#define DNS_R_SEENINCLUDE (ISC_RESULTCLASS_DNS + 66)
#define DNS_R_NRESULTS 66 /* Number of results */
#define DNS_R_NRESULTS 67 /* Number of results */
/*
* DNS wire format rcodes.
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: master.c,v 1.72 2000/09/23 01:05:35 bwelling Exp $ */
/* $Id: master.c,v 1.73 2000/10/17 07:22:30 marka Exp $ */
#include <config.h>
......@@ -99,6 +99,7 @@ struct dns_loadctx {
isc_boolean_t default_ttl_known;
isc_boolean_t warn_1035;
isc_boolean_t age_ttl;
isc_boolean_t seen_include;
isc_uint32_t ttl;
isc_uint32_t default_ttl;
dns_rdataclass_t zclass;
......@@ -388,6 +389,7 @@ loadctx_create(isc_mem_t *mctx, isc_boolean_t age_ttl, dns_name_t *top,
ctx->default_ttl = 0;
ctx->warn_1035 = ISC_TRUE; /* XXX Argument? */
ctx->age_ttl = age_ttl;
ctx->seen_include = ISC_FALSE;
ctx->zclass = zclass;
dns_fixedname_init(&ctx->fixed_top);
......@@ -754,6 +756,7 @@ load(dns_loadctx_t **ctxp) {
CTX_COPYVAR(ctx, *ctxp, ttl);
CTX_COPYVAR(ctx, *ctxp, default_ttl);
CTX_COPYVAR(ctx, *ctxp, warn_1035);
CTX_COPYVAR(ctx, *ctxp, seen_include);
dns_loadctx_detach(&ctx);
ctx = *ctxp;
continue;
......@@ -1372,7 +1375,8 @@ load(dns_loadctx_t **ctxp) {
if (!done) {
INSIST(ctx->done != NULL && ctx->task != NULL);
result = DNS_R_CONTINUE;
}
} else if (result == ISC_R_SUCCESS && ctx->seen_include)
result = DNS_R_SEENINCLUDE;
goto cleanup;
log_and_cleanup:
......@@ -1427,6 +1431,8 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t **ctxp) {
ctx = *ctxp;
REQUIRE(DNS_LCTX_VALID(ctx));
ctx->seen_include = ISC_TRUE;
result = loadctx_create(ctx->mctx, ctx->age_ttl, ctx->top,
ctx->zclass, origin, ctx->callbacks,
ctx->task, ctx->done, ctx->done_arg,
......@@ -1454,6 +1460,7 @@ pushfile(const char *master_file, dns_name_t *origin, dns_loadctx_t **ctxp) {
CTX_COPYVAR(ctx, new, ttl);
CTX_COPYVAR(ctx, new, default_ttl);
CTX_COPYVAR(ctx, new, warn_1035);
CTX_COPYVAR(ctx, new, seen_include);
result = isc_lex_openfile(new->lex, master_file);
if (result != ISC_R_SUCCESS)
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: result.c,v 1.74 2000/10/16 04:08:11 marka Exp $ */
/* $Id: result.c,v 1.75 2000/10/17 07:22:31 marka Exp $ */
#include <config.h>
......@@ -104,7 +104,8 @@ static const char *text[DNS_R_NRESULTS] = {
"recoverable error occurred", /* 63 DNS_R_RECOVERABLE */
"unknown opt attribute record", /* 64 DNS_R_UNKNOWNOPT */
"unexpected message id" /* 65 DNS_R_UNEXPECTEDID */
"unexpected message id", /* 65 DNS_R_UNEXPECTEDID */
"seen include file" /* 66 DNS_R_SEENINCLUDE */
};
static const char *rcode_text[DNS_R_NRCODERESULTS] = {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rootns.c,v 1.15 2000/08/01 01:22:53 tale Exp $ */
/* $Id: rootns.c,v 1.16 2000/10/17 07:22:32 marka Exp $ */
#include <config.h>
......@@ -26,6 +26,7 @@
#include <dns/callbacks.h>
#include <dns/db.h>
#include <dns/master.h>
#include <dns/result.h>
#include <dns/rootns.h>
static char root_ns[] =
......@@ -108,9 +109,9 @@ dns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
} else
result = ISC_R_NOTFOUND;
eresult = dns_db_endload(db, &callbacks.add_private);
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE)
result = eresult;
if (result != ISC_R_SUCCESS)
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
goto db_detach;
*target = db;
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zone.c,v 1.235 2000/10/16 22:26:25 mws Exp $ */
/* $Id: zone.c,v 1.236 2000/10/17 07:22:34 marka Exp $ */
#include <config.h>
......@@ -195,7 +195,7 @@ struct dns_zone {
#define DNS_ZONEFLG_NEEDDUMP 0x00000002U /* zone need consolidation */
#define DNS_ZONEFLG_USEVC 0x00000004U /* use tcp for refresh query */
#define DNS_ZONEFLG_DUMPING 0x00000008U /* a dump is in progress */
/* #define DNS_ZONEFLG_UNUSED 0x00000010U */ /* unused */
#define DNS_ZONEFLG_HASINCLUDE 0x00000010U /* $INCLUDE in zone file */
#define DNS_ZONEFLG_LOADED 0x00000020U /* database has loaded */
#define DNS_ZONEFLG_EXITING 0x00000040U /* zone is being destroyed */
#define DNS_ZONEFLG_EXPIRED 0x00000080U /* zone has expired */
......@@ -824,13 +824,17 @@ dns_zone_load(dns_zone_t *zone) {
* than the last time the zone was loaded. If the zone has not
* been loaded yet, zone->loadtime will be the epoch.
*/
result = isc_file_getmodtime(zone->dbname, &filetime);
if (result == ISC_R_SUCCESS && ! isc_time_isepoch(&zone->loadtime) &&
isc_time_compare(&filetime, &zone->loadtime) < 0) {
zone_log(zone, me, ISC_LOG_DEBUG(1),
"skipping: database file older than last load");
result = ISC_R_SUCCESS;
goto cleanup;
if (!DNS_ZONEFLG_HASINCLUDE) {
result = isc_file_getmodtime(zone->dbname, &filetime);
if (result == ISC_R_SUCCESS &&
!isc_time_isepoch(&zone->loadtime) &&
isc_time_compare(&filetime, &zone->loadtime) < 0) {
zone_log(zone, me, ISC_LOG_DEBUG(1),
"skipping: database file older"
" than last load");
result = ISC_R_SUCCESS;
goto cleanup;
}
}
/*
......@@ -891,7 +895,8 @@ zone_gotreadhandle(isc_task_t *task, isc_event_t *event) {
load->zone->rdclass, ISC_FALSE,
&load->callbacks, task,
zone_loaddone, load, load->zone->mctx);
if (result != ISC_R_SUCCESS && result != DNS_R_CONTINUE)
if (result != ISC_R_SUCCESS && result != DNS_R_CONTINUE &&
result != DNS_R_SEENINCLUDE)
goto fail;
return;
......@@ -968,7 +973,7 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
* indicates that the "permanent" form does not exist.
* XXX better error feedback to log.
*/
if (result != ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE) {
if (zone->type == dns_zone_slave ||
zone->type == dns_zone_stub) {
if (result == ISC_R_FILENOTFOUND)
......@@ -993,6 +998,10 @@ zone_postload(dns_zone_t *zone, dns_db_t *db, isc_time_t loadtime,
zone_log(zone, me, ISC_LOG_INFO, "loaded");
if (result == DNS_R_SEENINCLUDE)
zone->flags |= DNS_ZONEFLG_HASINCLUDE;
else
zone->flags &= ~DNS_ZONEFLG_HASINCLUDE;
/*
* Apply update log, if any.
*/
......@@ -4445,7 +4454,7 @@ zone_loaddone(void *arg, isc_result_t result) {
DNS_ENTER;
tresult = dns_db_endload(load->db, &load->callbacks.add_private);
if (result == ISC_R_SUCCESS)
if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE)
result = tresult;
LOCK(&load->zone->lock);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: zoneconf.c,v 1.62 2000/10/13 23:21:16 bwelling Exp $ */
/* $Id: zoneconf.c,v 1.63 2000/10/17 07:22:35 marka Exp $ */
#include <config.h>
......@@ -239,12 +239,14 @@ dns_zone_configure(dns_c_ctx_t *cctx, dns_c_view_t *cview,
dns_zone_setqueryacl,
dns_zone_clearqueryacl));
result = dns_c_zone_getdialup(czone, &boolean);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getdialup(cctx, &boolean);
if (result != ISC_R_SUCCESS)
boolean = ISC_FALSE;
dns_zone_setoption(zone, DNS_ZONEOPT_DIALUP, boolean);
if (czone->ztype != dns_c_zone_hint) {
result = dns_c_zone_getdialup(czone, &boolean);
if (result != ISC_R_SUCCESS)
result = dns_c_ctx_getdialup(cctx, &boolean);
if (result != ISC_R_SUCCESS)
boolean = ISC_FALSE;
dns_zone_setoption(zone, DNS_ZONEOPT_DIALUP, boolean);
}
#ifndef NOMINUM_PUBLIC
if (czone->ztype != dns_c_zone_stub) {
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: t_api.c,v 1.42 2000/08/01 01:33:14 tale Exp $ */
/* $Id: t_api.c,v 1.43 2000/10/17 07:22:39 marka Exp $ */
#include <config.h>
......@@ -621,6 +621,7 @@ struct dns_errormap {
{ DNS_R_BADDB, "DNS_R_BADDB" },
{ DNS_R_ZONECUT, "DNS_R_ZONECUT" },
{ DNS_R_NOTZONETOP, "DNS_R_NOTZONETOP" },
{ DNS_R_SEENINCLUDE, "DNS_R_SEENINCLUDE" },
{ (isc_result_t)0, NULL }
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment