From 1599bd6998f54b2b34804d7332f543744368a586 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Sun, 17 Dec 2000 23:43:12 +0000 Subject: [PATCH] 620. [bug] dns_master_load*inc() now require 'task' and 'load' to be non-null. Also 'done' will not be called if dns_master_load*inc() fails immediately. [RT #565] --- CHANGES | 3 +++ lib/dns/include/dns/master.h | 8 +++---- lib/dns/master.c | 45 ++++++++++++++---------------------- 3 files changed, 24 insertions(+), 32 deletions(-) diff --git a/CHANGES b/CHANGES index e134e056e9..988f27e7d1 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ + 620. [bug] dns_master_load*inc() now require 'task' and 'load' + to be non-null. Also 'done' will not be called if + dns_master_load*inc() fails immediately. [RT #565] 618. [bug] Queries to a signed zone could sometimes cause an assertion failure. diff --git a/lib/dns/include/dns/master.h b/lib/dns/include/dns/master.h index 269bbf4bd4..73d2a7830a 100644 --- a/lib/dns/include/dns/master.h +++ b/lib/dns/include/dns/master.h @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.h,v 1.25 2000/10/17 07:22:36 marka Exp $ */ +/* $Id: master.h,v 1.26 2000/12/17 23:43:12 marka Exp $ */ #ifndef DNS_MASTER_H #define DNS_MASTER_H 1 @@ -119,7 +119,8 @@ dns_master_loadfilequota(const char *master_file, dns_name_t *top, * 'callbacks->warn' to generate any error messages required. * * 'done' is called with 'done_arg' and a result code when the loading - * is completed or has failed if 'done' is non NULL. + * is completed or has failed. If the initial setup fails 'done' is + * not called. * * Requires: * 'master_file' points to a valid string. @@ -128,9 +129,8 @@ dns_master_loadfilequota(const char *master_file, dns_name_t *top, * 'callbacks->commit' points to a valid function. * 'callbacks->error' points to a valid function. * 'callbacks->warn' points to a valid function. - * 'callbacks->done' points to a valid function or NULL. * 'mctx' points to a valid memory context. - * 'task' and 'done' to be NULL or 'task' and 'done' to be valid. + * 'task' and 'done' to be valid. * 'lmgr' to be valid. * 'ctxp != NULL && ctxp == NULL'. * diff --git a/lib/dns/master.c b/lib/dns/master.c index 6b55b22cf2..90b872e065 100644 --- a/lib/dns/master.c +++ b/lib/dns/master.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: master.c,v 1.86 2000/12/07 20:15:49 marka Exp $ */ +/* $Id: master.c,v 1.87 2000/12/17 23:43:10 marka Exp $ */ #include @@ -1610,6 +1610,9 @@ dns_master_loadfileinc(const char *master_file, dns_name_t *top, dns_loadctx_t *ctx = NULL; isc_result_t tresult; isc_result_t result; + + REQUIRE(task != NULL); + REQUIRE(done != NULL); result = loadctx_create(mctx, age_ttl, top, zclass, origin, callbacks, task, done, done_arg, &ctx); @@ -1620,15 +1623,9 @@ dns_master_loadfileinc(const char *master_file, dns_name_t *top, if (result != ISC_R_SUCCESS) goto cleanup; - result = load(&ctx); - if (result == DNS_R_CONTINUE) { - tresult = task_send(ctx); - if (tresult == ISC_R_SUCCESS) - return (result); - result = tresult; - } - if (ctx->done != NULL) - (ctx->done)(ctx->done_arg, result); + result = task_send(ctx); + if (result == ISC_R_SUCCESS) + return (DNS_R_CONTINUE); cleanup: if (ctx != NULL) @@ -1676,6 +1673,8 @@ dns_master_loadstreaminc(FILE *stream, dns_name_t *top, dns_name_t *origin, dns_loadctx_t *ctx = NULL; REQUIRE(stream != NULL); + REQUIRE(task != NULL); + REQUIRE(done != NULL); result = loadctx_create(mctx, age_ttl, top, zclass, origin, callbacks, task, done, done_arg, &ctx); @@ -1686,15 +1685,9 @@ dns_master_loadstreaminc(FILE *stream, dns_name_t *top, dns_name_t *origin, if (result != ISC_R_SUCCESS) goto cleanup; - result = load(&ctx); - if (result == DNS_R_CONTINUE) { - tresult = task_send(ctx); - if (tresult == ISC_R_SUCCESS) - return (result); - result = tresult; - } - if (ctx->done != NULL) - (ctx->done)(ctx->done_arg, result); + result = task_send(ctx); + if (result == ISC_R_SUCCESS) + return (DNS_R_CONTINUE); cleanup: if (ctx != NULL) @@ -1744,6 +1737,8 @@ dns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top, dns_loadctx_t *ctx = NULL; REQUIRE(buffer != NULL); + REQUIRE(task != NULL); + REQUIRE(done != NULL); result = loadctx_create(mctx, age_ttl, top, zclass, origin, callbacks, task, done, done_arg, &ctx); @@ -1754,15 +1749,9 @@ dns_master_loadbufferinc(isc_buffer_t *buffer, dns_name_t *top, if (result != ISC_R_SUCCESS) goto cleanup; - result = load(&ctx); - if (result == DNS_R_CONTINUE) { - tresult = task_send(ctx); - if (tresult == ISC_R_SUCCESS) - return (result); - result = tresult; - } - if (ctx->done != NULL) - (ctx->done)(ctx->done_arg, result); + result = task_send(ctx); + if (result == ISC_R_SUCCESS) + return (DNS_R_CONTINUE); cleanup: if (ctx != NULL)