mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
libdns refactoring: get rid of multiple versions of dns_dt_create, dns_view_setcache, dns_zt_apply, dns_message_logfmtpacket, dns_message_logpacket, dns_ssutable_checkrules and dns_ttl_totext
This commit is contained in:
parent
d54d482af0
commit
c8aa1ee9e6
@ -4229,7 +4229,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
|
||||
ISC_LINK_INIT(nsc, link);
|
||||
ISC_LIST_APPEND(*cachelist, nsc, link);
|
||||
}
|
||||
dns_view_setcache2(view, cache, shared_cache);
|
||||
dns_view_setcache(view, cache, shared_cache);
|
||||
|
||||
/*
|
||||
* cache-file cannot be inherited if views are present, but this
|
||||
@ -9013,7 +9013,7 @@ load_configuration(const char *filename, named_server_t *server,
|
||||
{
|
||||
dns_view_setviewrevert(view);
|
||||
(void)dns_zt_apply(view->zonetable, ISC_FALSE,
|
||||
removed, view);
|
||||
NULL, removed, view);
|
||||
}
|
||||
dns_view_detach(&view);
|
||||
}
|
||||
@ -10380,7 +10380,7 @@ add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) {
|
||||
ISC_LIST_INIT(vle->zonelist);
|
||||
ISC_LIST_APPEND(dctx->viewlist, vle, link);
|
||||
if (dctx->dumpzones)
|
||||
result = dns_zt_apply(view->zonetable, ISC_TRUE,
|
||||
result = dns_zt_apply(view->zonetable, ISC_TRUE, NULL,
|
||||
add_zone_tolist, dctx);
|
||||
return (result);
|
||||
}
|
||||
@ -11622,7 +11622,7 @@ named_server_sync(named_server_t *server, isc_lex_t *lex, isc_buffer_t **text) {
|
||||
view != NULL;
|
||||
view = ISC_LIST_NEXT(view, link)) {
|
||||
result = dns_zt_apply(view->zonetable, ISC_FALSE,
|
||||
synczone, &cleanup);
|
||||
NULL, synczone, &cleanup);
|
||||
if (result != ISC_R_SUCCESS &&
|
||||
tresult == ISC_R_SUCCESS)
|
||||
tresult = result;
|
||||
|
@ -1916,7 +1916,7 @@ generatexml(named_server_t *server, isc_uint32_t flags,
|
||||
TRY0(xmlTextWriterStartElement(writer,
|
||||
ISC_XMLCHAR "zones"));
|
||||
result = dns_zt_apply(view->zonetable, ISC_TRUE,
|
||||
zone_xmlrender, writer);
|
||||
NULL, zone_xmlrender, writer);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
goto error;
|
||||
TRY0(xmlTextWriterEndElement(writer)); /* /zones */
|
||||
@ -2609,8 +2609,10 @@ generatejson(named_server_t *server, size_t *msglen,
|
||||
CHECKMEM(za);
|
||||
|
||||
if ((flags & STATS_JSON_ZONES) != 0) {
|
||||
result = dns_zt_apply(view->zonetable, ISC_TRUE,
|
||||
zone_jsonrender, za);
|
||||
result = dns_zt_apply(view->zonetable,
|
||||
ISC_TRUE,
|
||||
NULL, zone_jsonrender,
|
||||
za);
|
||||
if (result != ISC_R_SUCCESS) {
|
||||
goto error;
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ create_view(void) {
|
||||
dns_rdataclass_in, "", "rbt", 0, NULL,
|
||||
&cache);
|
||||
check_result(result, "dns_cache_create");
|
||||
dns_view_setcache(view, cache);
|
||||
dns_view_setcache(view, cache, ISC_FALSE);
|
||||
dns_cache_detach(&cache);
|
||||
|
||||
{
|
||||
|
@ -205,7 +205,7 @@ main(int argc, char *argv[]) {
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
dns_view_setcache(view, cache);
|
||||
dns_view_setcache(view, cache, ISC_FALSE);
|
||||
dns_view_freeze(view);
|
||||
|
||||
dns_cache_detach(&cache);
|
||||
|
@ -322,7 +322,7 @@ main(int argc, char *argv[]) {
|
||||
== ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
dns_view_setcache(view, cache);
|
||||
dns_view_setcache(view, cache, ISC_FALSE);
|
||||
dns_view_freeze(view);
|
||||
|
||||
dns_cache_detach(&cache);
|
||||
|
@ -77,7 +77,7 @@ bdb_putrdata(DB *db, dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
|
||||
|
||||
isc_buffer_init(&databuf, rdatatext, MAX_RDATATEXT);
|
||||
|
||||
dns_ttl_totext(ttl, ISC_FALSE, &databuf);
|
||||
dns_ttl_totext(ttl, ISC_FALSE, ISC_TRUE, &databuf);
|
||||
*(char *)isc_buffer_used(&databuf) = ' ';
|
||||
isc_buffer_add(&databuf, 1);
|
||||
|
||||
|
@ -185,15 +185,8 @@ unlock:
|
||||
|
||||
isc_result_t
|
||||
dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
|
||||
struct fstrm_iothr_options **foptp, dns_dtenv_t **envp)
|
||||
{
|
||||
return (dns_dt_create2(mctx, mode, path, foptp, NULL, envp));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_dt_create2(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
|
||||
struct fstrm_iothr_options **foptp, isc_task_t *reopen_task,
|
||||
dns_dtenv_t **envp)
|
||||
struct fstrm_iothr_options **foptp, isc_task_t *reopen_task,
|
||||
dns_dtenv_t **envp)
|
||||
{
|
||||
isc_result_t result = ISC_R_SUCCESS;
|
||||
fstrm_res res;
|
||||
|
@ -118,12 +118,8 @@ struct dns_dtdata {
|
||||
|
||||
isc_result_t
|
||||
dns_dt_create(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
|
||||
struct fstrm_iothr_options **foptp, dns_dtenv_t **envp);
|
||||
|
||||
isc_result_t
|
||||
dns_dt_create2(isc_mem_t *mctx, dns_dtmode_t mode, const char *path,
|
||||
struct fstrm_iothr_options **foptp, isc_task_t *reopen_task,
|
||||
dns_dtenv_t **envp);
|
||||
struct fstrm_iothr_options **foptp, isc_task_t *reopen_task,
|
||||
dns_dtenv_t **envp);
|
||||
/*%<
|
||||
* Create and initialize the dnstap environment.
|
||||
*
|
||||
|
@ -1375,25 +1375,17 @@ dns_message_gettimeadjust(dns_message_t *msg);
|
||||
*/
|
||||
|
||||
void
|
||||
dns_message_logpacket(dns_message_t *message, const char *description,
|
||||
dns_message_logpacket(dns_message_t *message,
|
||||
const char *description, const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
int level, isc_mem_t *mctx);
|
||||
void
|
||||
dns_message_logpacket2(dns_message_t *message,
|
||||
const char *description, const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
int level, isc_mem_t *mctx);
|
||||
|
||||
void
|
||||
dns_message_logfmtpacket(dns_message_t *message, const char *description,
|
||||
const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
const dns_master_style_t *style, int level,
|
||||
isc_mem_t *mctx);
|
||||
void
|
||||
dns_message_logfmtpacket2(dns_message_t *message, const char *description,
|
||||
const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
const dns_master_style_t *style, int level,
|
||||
isc_mem_t *mctx);
|
||||
/*%<
|
||||
* Log 'message' at the specified logging parameters.
|
||||
*
|
||||
|
@ -129,10 +129,6 @@ dns_ssutable_addrule(dns_ssutable_t *table, isc_boolean_t grant,
|
||||
|
||||
isc_boolean_t
|
||||
dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer,
|
||||
const dns_name_t *name, const isc_netaddr_t *addr,
|
||||
dns_rdatatype_t type, const dst_key_t *key);
|
||||
isc_boolean_t
|
||||
dns_ssutable_checkrules2(dns_ssutable_t *table, const dns_name_t *signer,
|
||||
const dns_name_t *name, const isc_netaddr_t *addr,
|
||||
isc_boolean_t tcp, const dns_aclenv_t *env,
|
||||
dns_rdatatype_t type, const dst_key_t *key);
|
||||
|
@ -31,10 +31,7 @@ ISC_LANG_BEGINDECLS
|
||||
|
||||
isc_result_t
|
||||
dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose,
|
||||
isc_buffer_t *target);
|
||||
isc_result_t
|
||||
dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose,
|
||||
isc_boolean_t upcase, isc_buffer_t *target);
|
||||
isc_boolean_t upcase, isc_buffer_t *target);
|
||||
/*%<
|
||||
* Output a TTL or other time interval in a human-readable form.
|
||||
* The time interval is given as a count of seconds in 'src'.
|
||||
|
@ -416,9 +416,7 @@ dns_view_createresolver(dns_view_t *view,
|
||||
*/
|
||||
|
||||
void
|
||||
dns_view_setcache(dns_view_t *view, dns_cache_t *cache);
|
||||
void
|
||||
dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared);
|
||||
dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared);
|
||||
/*%<
|
||||
* Set the view's cache database. If 'shared' is true, this means the cache
|
||||
* is created by another view and is shared with that view. dns_view_setcache()
|
||||
|
@ -172,12 +172,8 @@ dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze);
|
||||
*/
|
||||
|
||||
isc_result_t
|
||||
dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop,
|
||||
dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
|
||||
isc_result_t (*action)(dns_zone_t *, void *), void *uap);
|
||||
|
||||
isc_result_t
|
||||
dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
|
||||
isc_result_t (*action)(dns_zone_t *, void *), void *uap);
|
||||
/*%<
|
||||
* Apply a given 'action' to all zone zones in the table.
|
||||
* If 'stop' is 'ISC_TRUE' then walking the zone tree will stop if
|
||||
|
@ -558,7 +558,7 @@ rdataset_totext(dns_rdataset_t *rdataset,
|
||||
INDENT_TO(ttl_column);
|
||||
if ((ctx->style.flags & DNS_STYLEFLAG_TTL_UNITS) != 0) {
|
||||
length = target->used;
|
||||
result = dns_ttl_totext2(rdataset->ttl,
|
||||
result = dns_ttl_totext(rdataset->ttl,
|
||||
ISC_FALSE, ISC_FALSE,
|
||||
target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@ -880,7 +880,8 @@ dump_rdataset(isc_mem_t *mctx, const dns_name_t *name,
|
||||
{
|
||||
isc_buffer_clear(buffer);
|
||||
result = dns_ttl_totext(rdataset->ttl,
|
||||
ISC_TRUE, buffer);
|
||||
ISC_TRUE, ISC_TRUE,
|
||||
buffer);
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
isc_buffer_usedregion(buffer, &r);
|
||||
fprintf(f, "$TTL %u\t; %.*s\n", rdataset->ttl,
|
||||
|
@ -3604,6 +3604,7 @@ dns_message_pseudosectiontoyaml(dns_message_t *msg,
|
||||
ADD_STRING(target, buf);
|
||||
ADD_STRING(target, " (");
|
||||
result = dns_ttl_totext(secs,
|
||||
ISC_TRUE,
|
||||
ISC_TRUE,
|
||||
target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@ -3855,6 +3856,7 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
|
||||
ADD_STRING(target, buf);
|
||||
ADD_STRING(target, " (");
|
||||
result = dns_ttl_totext(secs,
|
||||
ISC_TRUE,
|
||||
ISC_TRUE,
|
||||
target);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
@ -4248,19 +4250,10 @@ dns_opcode_totext(dns_opcode_t opcode, isc_buffer_t *target) {
|
||||
}
|
||||
|
||||
void
|
||||
dns_message_logpacket(dns_message_t *message, const char *description,
|
||||
dns_message_logpacket(dns_message_t *message,
|
||||
const char *description, const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
int level, isc_mem_t *mctx)
|
||||
{
|
||||
logfmtpacket(message, description, NULL, category, module,
|
||||
&dns_master_style_debug, level, mctx);
|
||||
}
|
||||
|
||||
void
|
||||
dns_message_logpacket2(dns_message_t *message,
|
||||
const char *description, const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
int level, isc_mem_t *mctx)
|
||||
{
|
||||
REQUIRE(address != NULL);
|
||||
|
||||
@ -4269,22 +4262,12 @@ dns_message_logpacket2(dns_message_t *message,
|
||||
}
|
||||
|
||||
void
|
||||
dns_message_logfmtpacket(dns_message_t *message, const char *description,
|
||||
dns_message_logfmtpacket(dns_message_t *message,
|
||||
const char *description,
|
||||
const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
const dns_master_style_t *style, int level,
|
||||
isc_mem_t *mctx)
|
||||
{
|
||||
logfmtpacket(message, description, NULL, category, module, style,
|
||||
level, mctx);
|
||||
}
|
||||
|
||||
void
|
||||
dns_message_logfmtpacket2(dns_message_t *message,
|
||||
const char *description,
|
||||
const isc_sockaddr_t *address,
|
||||
isc_logcategory_t *category, isc_logmodule_t *module,
|
||||
const dns_master_style_t *style, int level,
|
||||
isc_mem_t *mctx)
|
||||
{
|
||||
REQUIRE(address != NULL);
|
||||
|
||||
|
@ -138,7 +138,8 @@ totext_soa(ARGS_TOTEXT) {
|
||||
/* Print times in week/day/hour/minute/second form */
|
||||
if (i >= 1) {
|
||||
RETERR(str_totext(" (", target));
|
||||
RETERR(dns_ttl_totext(num, ISC_TRUE, target));
|
||||
RETERR(dns_ttl_totext(num, ISC_TRUE,
|
||||
ISC_TRUE, target));
|
||||
RETERR(str_totext(")", target));
|
||||
}
|
||||
RETERR(str_totext(tctx->linebreak, target));
|
||||
|
@ -2762,13 +2762,13 @@ resquery_send(resquery_t *query) {
|
||||
/*
|
||||
* Log the outgoing packet.
|
||||
*/
|
||||
dns_message_logfmtpacket2(fctx->qmessage, "sending packet to",
|
||||
&query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_PACKETS,
|
||||
&dns_master_style_comment,
|
||||
ISC_LOG_DEBUG(11),
|
||||
fctx->res->mctx);
|
||||
dns_message_logfmtpacket(fctx->qmessage, "sending packet to",
|
||||
&query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_PACKETS,
|
||||
&dns_master_style_comment,
|
||||
ISC_LOG_DEBUG(11),
|
||||
fctx->res->mctx);
|
||||
|
||||
/*
|
||||
* We're now done with the query message.
|
||||
@ -7692,13 +7692,13 @@ rctx_edns(respctx_t *rctx) {
|
||||
fctx->rmessage->rcode == dns_rcode_yxdomain) &&
|
||||
bad_edns(fctx, &query->addrinfo->sockaddr))
|
||||
{
|
||||
dns_message_logpacket2(fctx->rmessage,
|
||||
"received packet (bad edns) from",
|
||||
&query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_RESOLVER,
|
||||
ISC_LOG_DEBUG(3),
|
||||
fctx->res->mctx);
|
||||
dns_message_logpacket(fctx->rmessage,
|
||||
"received packet (bad edns) from",
|
||||
&query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_RESOLVER,
|
||||
ISC_LOG_DEBUG(3),
|
||||
fctx->res->mctx);
|
||||
dns_adb_changeflags(fctx->adb, query->addrinfo,
|
||||
DNS_FETCHOPT_NOEDNS0,
|
||||
DNS_FETCHOPT_NOEDNS0);
|
||||
@ -7720,12 +7720,12 @@ rctx_edns(respctx_t *rctx) {
|
||||
* should be safe to do for any rcode we limit it to NOERROR
|
||||
* and NXDOMAIN.
|
||||
*/
|
||||
dns_message_logpacket2(fctx->rmessage,
|
||||
"received packet (no opt) from",
|
||||
&query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_RESOLVER,
|
||||
ISC_LOG_DEBUG(3), fctx->res->mctx);
|
||||
dns_message_logpacket(fctx->rmessage,
|
||||
"received packet (no opt) from",
|
||||
&query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_RESOLVER,
|
||||
ISC_LOG_DEBUG(3), fctx->res->mctx);
|
||||
dns_adb_changeflags(fctx->adb, query->addrinfo,
|
||||
DNS_FETCHOPT_NOEDNS0,
|
||||
DNS_FETCHOPT_NOEDNS0);
|
||||
@ -9221,14 +9221,14 @@ rctx_logpacket(respctx_t *rctx) {
|
||||
isc_buffer_t zb;
|
||||
#endif /* HAVE_DNSTAP */
|
||||
|
||||
dns_message_logfmtpacket2(rctx->fctx->rmessage,
|
||||
"received packet from",
|
||||
&rctx->query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_PACKETS,
|
||||
&dns_master_style_comment,
|
||||
ISC_LOG_DEBUG(10),
|
||||
rctx->fctx->res->mctx);
|
||||
dns_message_logfmtpacket(rctx->fctx->rmessage,
|
||||
"received packet from",
|
||||
&rctx->query->addrinfo->sockaddr,
|
||||
DNS_LOGCATEGORY_RESOLVER,
|
||||
DNS_LOGMODULE_PACKETS,
|
||||
&dns_master_style_comment,
|
||||
ISC_LOG_DEBUG(10),
|
||||
rctx->fctx->res->mctx);
|
||||
|
||||
#ifdef HAVE_DNSTAP
|
||||
/*
|
||||
|
@ -343,19 +343,9 @@ stf_from_address(dns_name_t *stfself, const isc_netaddr_t *tcpaddr) {
|
||||
|
||||
isc_boolean_t
|
||||
dns_ssutable_checkrules(dns_ssutable_t *table, const dns_name_t *signer,
|
||||
const dns_name_t *name, const isc_netaddr_t *tcpaddr,
|
||||
const dns_name_t *name, const isc_netaddr_t *addr,
|
||||
isc_boolean_t tcp, const dns_aclenv_t *env,
|
||||
dns_rdatatype_t type, const dst_key_t *key)
|
||||
{
|
||||
return (dns_ssutable_checkrules2
|
||||
(table, signer, name, tcpaddr,
|
||||
tcpaddr == NULL ? ISC_FALSE : ISC_TRUE,
|
||||
NULL, type, key));
|
||||
}
|
||||
isc_boolean_t
|
||||
dns_ssutable_checkrules2(dns_ssutable_t *table, const dns_name_t *signer,
|
||||
const dns_name_t *name, const isc_netaddr_t *addr,
|
||||
isc_boolean_t tcp, const dns_aclenv_t *env,
|
||||
dns_rdatatype_t type, const dst_key_t *key)
|
||||
{
|
||||
dns_ssurule_t *rule;
|
||||
unsigned int i;
|
||||
|
@ -72,7 +72,7 @@ ATF_TC_BODY(create, tc) {
|
||||
ATF_REQUIRE(fopt != NULL);
|
||||
fstrm_iothr_options_set_num_input_queues(fopt, 1);
|
||||
|
||||
result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, &dtenv);
|
||||
result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, NULL, &dtenv);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
if (dtenv != NULL)
|
||||
dns_dt_detach(&dtenv);
|
||||
@ -85,7 +85,7 @@ ATF_TC_BODY(create, tc) {
|
||||
ATF_REQUIRE(fopt != NULL);
|
||||
fstrm_iothr_options_set_num_input_queues(fopt, 1);
|
||||
|
||||
result = dns_dt_create(mctx, dns_dtmode_unix, TAPSOCK, &fopt, &dtenv);
|
||||
result = dns_dt_create(mctx, dns_dtmode_unix, TAPSOCK, &fopt, NULL, &dtenv);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
if (dtenv != NULL)
|
||||
dns_dt_detach(&dtenv);
|
||||
@ -99,7 +99,7 @@ ATF_TC_BODY(create, tc) {
|
||||
ATF_REQUIRE(fopt != NULL);
|
||||
fstrm_iothr_options_set_num_input_queues(fopt, 1);
|
||||
|
||||
result = dns_dt_create(mctx, 33, TAPSOCK, &fopt, &dtenv);
|
||||
result = dns_dt_create(mctx, 33, TAPSOCK, &fopt, NULL, &dtenv);
|
||||
ATF_CHECK_EQ(result, ISC_R_FAILURE);
|
||||
ATF_CHECK_EQ(dtenv, NULL);
|
||||
if (dtenv != NULL)
|
||||
@ -154,7 +154,7 @@ ATF_TC_BODY(send, tc) {
|
||||
ATF_REQUIRE(fopt != NULL);
|
||||
fstrm_iothr_options_set_num_input_queues(fopt, 1);
|
||||
|
||||
result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, &dtenv);
|
||||
result = dns_dt_create(mctx, dns_dtmode_file, TAPFILE, &fopt, NULL, &dtenv);
|
||||
ATF_REQUIRE(result == ISC_R_SUCCESS);
|
||||
|
||||
dns_dt_attach(dtenv, &view->dtenv);
|
||||
|
@ -118,7 +118,8 @@ ATF_TC_BODY(apply, tc) {
|
||||
ATF_REQUIRE(view->zonetable != NULL);
|
||||
|
||||
ATF_CHECK_EQ(0, nzones);
|
||||
result = dns_zt_apply(view->zonetable, ISC_FALSE, count_zone, &nzones);
|
||||
result = dns_zt_apply(view->zonetable, ISC_FALSE, NULL, count_zone,
|
||||
&nzones);
|
||||
ATF_CHECK_EQ(result, ISC_R_SUCCESS);
|
||||
ATF_CHECK_EQ(1, nzones);
|
||||
|
||||
|
@ -72,13 +72,8 @@ ttlfmt(unsigned int t, const char *s, isc_boolean_t verbose,
|
||||
* Derived from bind8 ns_format_ttl().
|
||||
*/
|
||||
isc_result_t
|
||||
dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose, isc_buffer_t *target) {
|
||||
return (dns_ttl_totext2(src, verbose, ISC_TRUE, target));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_ttl_totext2(isc_uint32_t src, isc_boolean_t verbose,
|
||||
isc_boolean_t upcase, isc_buffer_t *target)
|
||||
dns_ttl_totext(isc_uint32_t src, isc_boolean_t verbose,
|
||||
isc_boolean_t upcase, isc_buffer_t *target)
|
||||
{
|
||||
unsigned secs, mins, hours, days, weeks, x;
|
||||
|
||||
|
@ -652,7 +652,7 @@ dns_view_dialup(dns_view_t *view) {
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
REQUIRE(view->zonetable != NULL);
|
||||
|
||||
(void)dns_zt_apply(view->zonetable, ISC_FALSE, dialup, NULL);
|
||||
(void)dns_zt_apply(view->zonetable, ISC_FALSE, NULL, dialup, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
@ -845,12 +845,7 @@ dns_view_createresolver(dns_view_t *view,
|
||||
}
|
||||
|
||||
void
|
||||
dns_view_setcache(dns_view_t *view, dns_cache_t *cache) {
|
||||
dns_view_setcache2(view, cache, ISC_FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
dns_view_setcache2(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) {
|
||||
dns_view_setcache(dns_view_t *view, dns_cache_t *cache, isc_boolean_t shared) {
|
||||
REQUIRE(DNS_VIEW_VALID(view));
|
||||
REQUIRE(!view->frozen);
|
||||
|
||||
|
@ -339,7 +339,6 @@ dns_dsdigest_totext
|
||||
dns_dt_attach
|
||||
dns_dt_close
|
||||
dns_dt_create
|
||||
dns_dt_create2
|
||||
dns_dt_datatotext
|
||||
dns_dt_detach
|
||||
dns_dt_getframe
|
||||
@ -496,9 +495,7 @@ dns_message_gettimeadjust
|
||||
dns_message_gettsig
|
||||
dns_message_gettsigkey
|
||||
dns_message_logfmtpacket
|
||||
dns_message_logfmtpacket2
|
||||
dns_message_logpacket
|
||||
dns_message_logpacket2
|
||||
dns_message_movename
|
||||
dns_message_nextname
|
||||
dns_message_parse
|
||||
@ -978,7 +975,6 @@ dns_ssu_mtypefromstring
|
||||
dns_ssutable_addrule
|
||||
dns_ssutable_attach
|
||||
dns_ssutable_checkrules
|
||||
dns_ssutable_checkrules2
|
||||
dns_ssutable_create
|
||||
dns_ssutable_createdlz
|
||||
dns_ssutable_detach
|
||||
@ -1030,7 +1026,6 @@ dns_tsigrcode_fromtext
|
||||
dns_tsigrcode_totext
|
||||
dns_ttl_fromtext
|
||||
dns_ttl_totext
|
||||
dns_ttl_totext2
|
||||
dns_update_signatures
|
||||
dns_update_signaturesinc
|
||||
dns_update_soaserial
|
||||
@ -1084,7 +1079,6 @@ dns_view_saventa
|
||||
dns_view_searchdlz
|
||||
dns_view_setadbstats
|
||||
dns_view_setcache
|
||||
dns_view_setcache2
|
||||
dns_view_setdstport
|
||||
dns_view_setdynamickeyring
|
||||
dns_view_setfailttl
|
||||
@ -1335,7 +1329,6 @@ dns_zonemgr_unreachable
|
||||
dns_zonemgr_unreachableadd
|
||||
dns_zonemgr_unreachabledel
|
||||
dns_zt_apply
|
||||
dns_zt_apply2
|
||||
dns_zt_asyncload
|
||||
dns_zt_attach
|
||||
dns_zt_create
|
||||
|
@ -1234,11 +1234,11 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
|
||||
DNS_MESSAGEPARSE_PRESERVEORDER);
|
||||
|
||||
if (result == ISC_R_SUCCESS)
|
||||
dns_message_logpacket2(msg, "received message from",
|
||||
&tcpmsg->address,
|
||||
DNS_LOGCATEGORY_XFER_IN,
|
||||
DNS_LOGMODULE_XFER_IN,
|
||||
ISC_LOG_DEBUG(10), xfr->mctx);
|
||||
dns_message_logpacket(msg, "received message from",
|
||||
&tcpmsg->address,
|
||||
DNS_LOGCATEGORY_XFER_IN,
|
||||
DNS_LOGMODULE_XFER_IN,
|
||||
ISC_LOG_DEBUG(10), xfr->mctx);
|
||||
else
|
||||
xfrin_log(xfr, ISC_LOG_DEBUG(10), "dns_message_parse: %s",
|
||||
dns_result_totext(result));
|
||||
|
19
lib/dns/zt.c
19
lib/dns/zt.c
@ -199,7 +199,7 @@ flush(dns_zone_t *zone, void *uap) {
|
||||
static void
|
||||
zt_destroy(dns_zt_t *zt) {
|
||||
if (zt->flush)
|
||||
(void)dns_zt_apply(zt, ISC_FALSE, flush, NULL);
|
||||
(void)dns_zt_apply(zt, ISC_FALSE, NULL, flush, NULL);
|
||||
dns_rbt_destroy(&zt->table);
|
||||
isc_rwlock_destroy(&zt->rwlock);
|
||||
zt->magic = 0;
|
||||
@ -249,7 +249,7 @@ dns_zt_load(dns_zt_t *zt, isc_boolean_t stop) {
|
||||
REQUIRE(VALID_ZT(zt));
|
||||
|
||||
RWLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
result = dns_zt_apply(zt, stop, load, NULL);
|
||||
result = dns_zt_apply(zt, stop, NULL, load, NULL);
|
||||
RWUNLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
return (result);
|
||||
}
|
||||
@ -277,7 +277,7 @@ dns_zt_asyncload(dns_zt_t *zt, dns_zt_allloaded_t alldone, void *arg) {
|
||||
RWLOCK(&zt->rwlock, isc_rwlocktype_write);
|
||||
|
||||
INSIST(zt->loads_pending == 0);
|
||||
result = dns_zt_apply2(zt, ISC_FALSE, NULL, asyncload, &dl);
|
||||
result = dns_zt_apply(zt, ISC_FALSE, NULL, asyncload, &dl);
|
||||
|
||||
pending = zt->loads_pending;
|
||||
if (pending != 0) {
|
||||
@ -328,7 +328,7 @@ dns_zt_loadnew(dns_zt_t *zt, isc_boolean_t stop) {
|
||||
REQUIRE(VALID_ZT(zt));
|
||||
|
||||
RWLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
result = dns_zt_apply(zt, stop, loadnew, NULL);
|
||||
result = dns_zt_apply(zt, stop, NULL, loadnew, NULL);
|
||||
RWUNLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
return (result);
|
||||
}
|
||||
@ -352,7 +352,7 @@ dns_zt_freezezones(dns_zt_t *zt, isc_boolean_t freeze) {
|
||||
REQUIRE(VALID_ZT(zt));
|
||||
|
||||
RWLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
result = dns_zt_apply2(zt, ISC_FALSE, &tresult, freezezones, &freeze);
|
||||
result = dns_zt_apply(zt, ISC_FALSE, &tresult, freezezones, &freeze);
|
||||
RWUNLOCK(&zt->rwlock, isc_rwlocktype_read);
|
||||
if (tresult == ISC_R_NOTFOUND)
|
||||
tresult = ISC_R_SUCCESS;
|
||||
@ -475,15 +475,8 @@ dns_zt_setviewrevert(dns_zt_t *zt) {
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop,
|
||||
dns_zt_apply(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
|
||||
isc_result_t (*action)(dns_zone_t *, void *), void *uap)
|
||||
{
|
||||
return (dns_zt_apply2(zt, stop, NULL, action, uap));
|
||||
}
|
||||
|
||||
isc_result_t
|
||||
dns_zt_apply2(dns_zt_t *zt, isc_boolean_t stop, isc_result_t *sub,
|
||||
isc_result_t (*action)(dns_zone_t *, void *), void *uap)
|
||||
{
|
||||
dns_rbtnode_t *node;
|
||||
dns_rbtnodechain_t chain;
|
||||
|
@ -324,7 +324,7 @@ ns_test_makeview(const char *name, isc_boolean_t with_cache,
|
||||
CHECK(dns_cache_create(mctx, mctx, taskmgr, timermgr,
|
||||
dns_rdataclass_in, "", "rbt", 0, NULL,
|
||||
&cache));
|
||||
dns_view_setcache(view, cache);
|
||||
dns_view_setcache(view, cache, ISC_FALSE);
|
||||
/*
|
||||
* Reference count for "cache" is now at 2, so decrement it in
|
||||
* order for the cache to be automatically freed when "view"
|
||||
|
@ -895,10 +895,10 @@ ssu_checkrule(void *data, dns_rdataset_t *rrset) {
|
||||
if (rrset->type == dns_rdatatype_rrsig ||
|
||||
rrset->type == dns_rdatatype_nsec)
|
||||
return (ISC_R_SUCCESS);
|
||||
result = dns_ssutable_checkrules2(ssuinfo->table, ssuinfo->signer,
|
||||
ssuinfo->name, ssuinfo->addr,
|
||||
ssuinfo->tcp, ssuinfo->aclenv,
|
||||
rrset->type, ssuinfo->key);
|
||||
result = dns_ssutable_checkrules(ssuinfo->table, ssuinfo->signer,
|
||||
ssuinfo->name, ssuinfo->addr,
|
||||
ssuinfo->tcp, ssuinfo->aclenv,
|
||||
rrset->type, ssuinfo->key);
|
||||
return (result == ISC_TRUE ? ISC_R_SUCCESS : ISC_R_FAILURE);
|
||||
}
|
||||
|
||||
@ -2750,10 +2750,10 @@ update_action(isc_task_t *task, isc_event_t *event) {
|
||||
tsigkey = client->message->tsigkey->key;
|
||||
|
||||
if (rdata.type != dns_rdatatype_any) {
|
||||
if (!dns_ssutable_checkrules2
|
||||
(ssutable, client->signer, name, &netaddr,
|
||||
ISC_TF(TCPCLIENT(client)),
|
||||
env, rdata.type, tsigkey))
|
||||
if (!dns_ssutable_checkrules
|
||||
(ssutable, client->signer, name, &netaddr,
|
||||
ISC_TF(TCPCLIENT(client)),
|
||||
env, rdata.type, tsigkey))
|
||||
{
|
||||
FAILC(DNS_R_REFUSED,
|
||||
"rejected by secure update");
|
||||
|
Loading…
x
Reference in New Issue
Block a user