mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 21:47:59 +00:00
update cfgmgr consumer after slight cfgmgr api changes
This commit is contained in:
parent
1820b5e625
commit
67059beec2
@ -52,6 +52,7 @@
|
||||
#include <dns/acl.h>
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/client.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/fixedname.h>
|
||||
@ -2218,17 +2219,17 @@ init_cfgmgr(void) {
|
||||
* here depending on param args (as the code run by delv is the same
|
||||
* than named one).
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_init(mctx, "/tmp/delv-cfgmgr-lmdb") == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_init(mctx);
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEBUILTIN);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEBUILTIN);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEUSER);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEUSER);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODERUNNING);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODERUNNING);
|
||||
}
|
||||
|
||||
int
|
||||
@ -2290,7 +2291,7 @@ cleanup:
|
||||
dns_master_styledestroy(&style, mctx);
|
||||
}
|
||||
|
||||
isc_cfgmgr_deinit();
|
||||
dns_cfgmgr_deinit();
|
||||
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
|
||||
|
||||
return 0;
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/backtrace.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/crypto.h>
|
||||
#include <isc/dir.h>
|
||||
@ -46,6 +45,7 @@
|
||||
#include <isc/uv.h>
|
||||
#include <isc/xml.h>
|
||||
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/dyndb.h>
|
||||
#include <dns/lib.h>
|
||||
@ -1224,7 +1224,7 @@ setup(void) {
|
||||
isc_result_totext(result));
|
||||
}
|
||||
|
||||
REQUIRE(isc_cfgmgr_init(named_g_mctx, "/tmp/cfgmgr") == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_init(named_g_mctx);
|
||||
named_server_create(named_g_mctx, &named_g_server);
|
||||
ENSURE(named_g_server != NULL);
|
||||
sctx = named_g_server->sctx;
|
||||
@ -1294,7 +1294,7 @@ cleanup(void) {
|
||||
}
|
||||
|
||||
named_server_destroy(&named_g_server);
|
||||
isc_cfgmgr_deinit();
|
||||
dns_cfgmgr_deinit();
|
||||
named_builtin_deinit();
|
||||
|
||||
/*
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include <isc/async.h>
|
||||
#include <isc/attributes.h>
|
||||
#include <isc/base64.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/commandline.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
@ -62,6 +61,7 @@
|
||||
#include <dns/badcache.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/catz.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/dlz.h>
|
||||
@ -612,7 +612,7 @@ configure_view_acl(dns_view_t *view, const cfg_obj_t *vconfig,
|
||||
* need to use something else to configure its ACL.
|
||||
*/
|
||||
if (view != NULL) {
|
||||
result = dns_view_setacl(view, aclname, acl);
|
||||
dns_view_setacl(view, aclname, acl);
|
||||
}
|
||||
|
||||
if (aclp) {
|
||||
@ -3824,12 +3824,12 @@ configure_view_acls(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
*/
|
||||
if (cacheacl == NULL) {
|
||||
if (recursionacl != NULL) {
|
||||
CHECK(dns_view_setacl(view, "allow-query-cache",
|
||||
recursionacl));
|
||||
dns_view_setacl(view, "allow-query-cache",
|
||||
recursionacl);
|
||||
cacheacl = recursionacl;
|
||||
} else if (queryacl != NULL) {
|
||||
CHECK(dns_view_setacl(view, "allow-query-cache",
|
||||
queryacl));
|
||||
dns_view_setacl(view, "allow-query-cache",
|
||||
queryacl);
|
||||
cacheacl = queryacl;
|
||||
}
|
||||
}
|
||||
@ -3840,12 +3840,12 @@ configure_view_acls(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
*/
|
||||
if (recursionacl == NULL) {
|
||||
if (cacheacl != NULL) {
|
||||
CHECK(dns_view_setacl(view, "allow-recursion",
|
||||
cacheacl));
|
||||
dns_view_setacl(view, "allow-recursion",
|
||||
cacheacl);
|
||||
recursionacl = cacheacl;
|
||||
} else if (queryacl != NULL) {
|
||||
CHECK(dns_view_setacl(view, "allow-recursion",
|
||||
queryacl));
|
||||
dns_view_setacl(view, "allow-recursion",
|
||||
queryacl);
|
||||
recursionacl = queryacl;
|
||||
}
|
||||
}
|
||||
@ -3855,8 +3855,8 @@ configure_view_acls(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
* if set.
|
||||
*/
|
||||
if (cacheonacl == NULL && recursiononacl != NULL) {
|
||||
CHECK(dns_view_setacl(view, "allow-query-cache-on",
|
||||
recursiononacl));
|
||||
dns_view_setacl(view, "allow-query-cache-on",
|
||||
recursiononacl);
|
||||
cacheonacl = recursiononacl;
|
||||
}
|
||||
|
||||
@ -3865,8 +3865,7 @@ configure_view_acls(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
* if set.
|
||||
*/
|
||||
if (recursiononacl == NULL && cacheonacl != NULL) {
|
||||
CHECK(dns_view_setacl(view, "allow-recursion-on",
|
||||
cacheonacl));
|
||||
dns_view_setacl(view, "allow-recursion-on", cacheonacl);
|
||||
recursiononacl = cacheonacl;
|
||||
}
|
||||
|
||||
@ -3910,13 +3909,12 @@ configure_view_acls(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
|
||||
*/
|
||||
if (cacheacl == NULL) {
|
||||
CHECK(dns_acl_none(mctx, &cacheacl));
|
||||
CHECK(dns_view_setacl(view, "allow-query-cache",
|
||||
cacheacl));
|
||||
dns_view_setacl(view, "allow-query-cache", cacheacl);
|
||||
}
|
||||
if (cacheonacl == NULL) {
|
||||
CHECK(dns_acl_none(mctx, &cacheonacl));
|
||||
CHECK(dns_view_setacl(view, "allow-query-cache-on",
|
||||
cacheonacl));
|
||||
dns_view_setacl(view, "allow-query-cache-on",
|
||||
cacheonacl);
|
||||
}
|
||||
}
|
||||
|
||||
@ -5209,7 +5207,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
|
||||
view->padding = (uint16_t)padding;
|
||||
CHECK(cfg_acl_fromconfig(aclobj, config, actx, named_g_mctx, 0,
|
||||
&acl));
|
||||
CHECK(dns_view_setacl(view, "response-padding", acl));
|
||||
dns_view_setacl(view, "response-padding", acl);
|
||||
dns_acl_detach(&acl);
|
||||
}
|
||||
|
||||
@ -7916,13 +7914,13 @@ apply_configuration(cfg_parser_t *configparser, cfg_obj_t *config,
|
||||
"the initial working directory is '%s'",
|
||||
cwd);
|
||||
}
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEBUILTIN);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEBUILTIN);
|
||||
dns_cfgmgr_rwtxn();
|
||||
REQUIRE(dns_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEUSER);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEUSER);
|
||||
dns_cfgmgr_rwtxn();
|
||||
REQUIRE(dns_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -7930,7 +7928,7 @@ apply_configuration(cfg_parser_t *configparser, cfg_obj_t *config,
|
||||
* user configuration. This is just a workaround until there is a clear
|
||||
* lifecycle model.
|
||||
*/
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODERUNNING);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODERUNNING);
|
||||
|
||||
/* Let's recreate the TLS context cache */
|
||||
if (server->tlsctx_server_cache != NULL) {
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/httpd.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/once.h>
|
||||
@ -27,6 +26,7 @@
|
||||
|
||||
#include <dns/adb.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/opcode.h>
|
||||
#include <dns/rcode.h>
|
||||
@ -3504,7 +3504,7 @@ struct cfgmgr_dumpctx {
|
||||
|
||||
static void
|
||||
statschannel__cfgmgr_dumpprop(void *state, const char *name,
|
||||
const isc_cfgmgr_val_t *val) {
|
||||
const dns_cfgmgr_val_t *val) {
|
||||
cfgmgr_dumpctx_t *ctx = state;
|
||||
|
||||
for (size_t i = 0; i < ctx->lvl * ctx->indent; i++) {
|
||||
@ -3513,13 +3513,13 @@ statschannel__cfgmgr_dumpprop(void *state, const char *name,
|
||||
|
||||
isc_buffer_printf(ctx->buffer, "%s ", name);
|
||||
switch (val->type) {
|
||||
case ISC_CFGMGR_UINT32:
|
||||
case DNS_CFGMGR_UINT32:
|
||||
isc_buffer_printf(ctx->buffer, "%u", val->uint32);
|
||||
break;
|
||||
case ISC_CFGMGR_STRING:
|
||||
case DNS_CFGMGR_STRING:
|
||||
isc_buffer_printf(ctx->buffer, "%s", val->string);
|
||||
break;
|
||||
case ISC_CFGMGR_REF:
|
||||
case DNS_CFGMGR_REF:
|
||||
isc_buffer_printf(ctx->buffer, "%p", val->ptr);
|
||||
break;
|
||||
default:
|
||||
@ -3554,15 +3554,15 @@ statschannel__cfgmgr_dumplabelup(void *state) {
|
||||
}
|
||||
|
||||
static void
|
||||
statschannel__cfgmgr_dump(isc_cfgmgr_mode_t mode, isc_buffer_t *buffer) {
|
||||
statschannel__cfgmgr_dump(dns_cfgmgr_mode_t mode, isc_buffer_t *buffer) {
|
||||
cfgmgr_dumpctx_t ctx = { .lvl = 0, .indent = 8, .buffer = buffer };
|
||||
|
||||
isc_cfgmgr_mode(mode);
|
||||
isc_cfgmgr_txn();
|
||||
isc_cfgmgr_foreach("/", 0, &ctx, statschannel__cfgmgr_dumpprop,
|
||||
dns_cfgmgr_mode(mode);
|
||||
dns_cfgmgr_txn();
|
||||
dns_cfgmgr_foreach("/", 0, &ctx, statschannel__cfgmgr_dumpprop,
|
||||
statschannel__cfgmgr_dumplabeldown,
|
||||
statschannel__cfgmgr_dumplabelup);
|
||||
isc_cfgmgr_closetxn();
|
||||
dns_cfgmgr_closetxn();
|
||||
}
|
||||
|
||||
static void
|
||||
@ -3597,13 +3597,13 @@ render_cfgmgr_dump(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo,
|
||||
isc_buffer_putstr(b, "<pre>");
|
||||
|
||||
isc_buffer_putstr(b, "# Builtin config dump\n\n");
|
||||
statschannel__cfgmgr_dump(ISC_CFGMGR_MODEBUILTIN, b);
|
||||
statschannel__cfgmgr_dump(DNS_CFGMGR_MODEBUILTIN, b);
|
||||
|
||||
isc_buffer_putstr(b, "\n\n\n\n# User/named.conf config dump\n\n");
|
||||
statschannel__cfgmgr_dump(ISC_CFGMGR_MODEUSER, b);
|
||||
statschannel__cfgmgr_dump(DNS_CFGMGR_MODEUSER, b);
|
||||
|
||||
isc_buffer_putstr(b, "\n\n\n\n# Running config dump\n\n");
|
||||
statschannel__cfgmgr_dump(ISC_CFGMGR_MODERUNNING, b);
|
||||
statschannel__cfgmgr_dump(DNS_CFGMGR_MODERUNNING, b);
|
||||
|
||||
isc_buffer_putstr(b, "</pre>");
|
||||
|
||||
@ -3614,7 +3614,7 @@ static isc_result_t
|
||||
cfgmgr_write(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *arg,
|
||||
unsigned int *retcode, const char **retmsg, const char **mimetype,
|
||||
isc_buffer_t *b, isc_httpdfree_t **freecb, void **freecb_args) {
|
||||
isc_cfgmgr_val_t val;
|
||||
dns_cfgmgr_val_t val;
|
||||
const char *base;
|
||||
uint16_t len;
|
||||
|
||||
@ -3651,14 +3651,14 @@ cfgmgr_write(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *arg,
|
||||
value = strtok(NULL, "&");
|
||||
REQUIRE(name != NULL);
|
||||
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_rwtxn();
|
||||
|
||||
if (value != NULL) {
|
||||
val.type = ISC_CFGMGR_STRING;
|
||||
val.type = DNS_CFGMGR_STRING;
|
||||
val.string = value;
|
||||
REQUIRE(isc_cfgmgr_write(name, &val) == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_write(name, &val);
|
||||
} else {
|
||||
isc_cfgmgr_write(name, NULL);
|
||||
dns_cfgmgr_write(name, NULL);
|
||||
}
|
||||
|
||||
if (strcmp(name, "/options/allow-query") == 0) {
|
||||
@ -3676,7 +3676,7 @@ cfgmgr_write(const isc_httpd_t *httpd, const isc_httpdurl_t *urlinfo, void *arg,
|
||||
dns_view_setacl(view, "allow-query", newacl);
|
||||
}
|
||||
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
REQUIRE(dns_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
return ISC_R_SUCCESS;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include <isc/sockaddr.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/lib.h>
|
||||
@ -218,17 +219,16 @@ init_cfgmgr(void) {
|
||||
/*
|
||||
* TODO temporary quick fix
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_init(mctx, "/tmp/delv-cfgmgr-lmdb") == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_init(mctx);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEBUILTIN);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEBUILTIN);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEUSER);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEUSER);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODERUNNING);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODERUNNING);
|
||||
}
|
||||
|
||||
int
|
||||
@ -309,7 +309,7 @@ main(int argc, char *argv[]) {
|
||||
|
||||
isc_loopmgr_run(loopmgr);
|
||||
|
||||
isc_cfgmgr_deinit();
|
||||
dns_cfgmgr_deinit();
|
||||
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
|
||||
|
||||
return 0;
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include <isc/time.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/fixedname.h>
|
||||
@ -2085,17 +2086,17 @@ init_cfgmgr(void) {
|
||||
* unloading flow which run at some point (so it uses cfgmgr to reset
|
||||
* properties, and it crashes it cfgmgr is not initialized)
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_init(mctx, "/tmp/mdig-cfgmgr-lmdb") == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_init(mctx);
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEBUILTIN);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEBUILTIN);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEUSER);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEUSER);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODERUNNING);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODERUNNING);
|
||||
}
|
||||
|
||||
/*% Main processing routine for mdig */
|
||||
@ -2198,7 +2199,7 @@ main(int argc, char *argv[]) {
|
||||
isc_mem_free(mctx, default_query.ecs_addr);
|
||||
}
|
||||
|
||||
isc_cfgmgr_deinit();
|
||||
dns_cfgmgr_deinit();
|
||||
isc_managers_destroy(&mctx, &loopmgr, &netmgr);
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/mem.h>
|
||||
#include <isc/once.h>
|
||||
#include <isc/string.h>
|
||||
@ -24,6 +23,7 @@
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/acl.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/iptable.h>
|
||||
|
||||
#include "acl_p.h"
|
||||
@ -799,9 +799,9 @@ dns__acl_cfgmgrdetach(void *ptr) {
|
||||
dns_acl_unref((dns_acl_t *)ptr);
|
||||
}
|
||||
|
||||
isc_cfgmgr_val_t
|
||||
dns_cfgmgr_val_t
|
||||
dns_acl_cfgmgrval(const dns_acl_t *acl) {
|
||||
return (isc_cfgmgr_val_t){ .type = ISC_CFGMGR_REF,
|
||||
return (dns_cfgmgr_val_t){ .type = DNS_CFGMGR_REF,
|
||||
.ptr = (void *)acl,
|
||||
.attach = dns__acl_cfgmgrattach,
|
||||
.detach = dns__acl_cfgmgrdetach };
|
||||
|
@ -30,11 +30,11 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/magic.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/refcount.h>
|
||||
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/geoip.h>
|
||||
#include <dns/iptable.h>
|
||||
#include <dns/name.h>
|
||||
@ -311,5 +311,5 @@ dns_acl_merge_ports_transports(dns_acl_t *dest, dns_acl_t *source, bool pos);
|
||||
*\li 'source' is a valid ACL object.
|
||||
*/
|
||||
|
||||
isc_cfgmgr_val_t
|
||||
dns_cfgmgr_val_t
|
||||
dns_acl_cfgmgrval(const dns_acl_t *acl);
|
||||
|
@ -1326,5 +1326,5 @@ dns_view_setmaxqueries(dns_view_t *view, uint16_t max_queries);
|
||||
dns_acl_t *
|
||||
dns_view_getacl(dns_view_t *view, const char *name);
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_view_setacl(dns_view_t *view, const char *name, const dns_acl_t *acl);
|
||||
|
@ -22,7 +22,6 @@
|
||||
#endif /* ifdef HAVE_LMDB */
|
||||
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/dir.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
@ -38,6 +37,7 @@
|
||||
#include <dns/adb.h>
|
||||
#include <dns/badcache.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/dispatch.h>
|
||||
#include <dns/dlz.h>
|
||||
@ -2367,32 +2367,31 @@ dns_view_setmaxqueries(dns_view_t *view, uint16_t max_queries) {
|
||||
dns_acl_t *
|
||||
dns_view_getacl(dns_view_t *view, const char *name) {
|
||||
char path[512];
|
||||
isc_cfgmgr_val_t val;
|
||||
dns_cfgmgr_val_t val;
|
||||
dns_acl_t *acl = NULL;
|
||||
|
||||
/*
|
||||
* Temporary work around until there is a clear life-cycle model of the
|
||||
* transaction
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_txn() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_txn();
|
||||
|
||||
sprintf(path, "/views/%s%p/%s-computed", view->name, view, name);
|
||||
if (isc_cfgmgr_read(path, &val) == ISC_R_SUCCESS) {
|
||||
INSIST(val.type == ISC_CFGMGR_REF);
|
||||
if (dns_cfgmgr_read(path, &val) == ISC_R_SUCCESS) {
|
||||
INSIST(val.type == DNS_CFGMGR_REF);
|
||||
acl = val.ptr;
|
||||
}
|
||||
|
||||
isc_cfgmgr_closetxn();
|
||||
dns_cfgmgr_closetxn();
|
||||
|
||||
return acl;
|
||||
}
|
||||
|
||||
|
||||
isc_result_t
|
||||
void
|
||||
dns_view_setacl(dns_view_t *view, const char *name, const dns_acl_t *acl) {
|
||||
char path[512];
|
||||
isc_cfgmgr_val_t val = dns_acl_cfgmgrval(acl);
|
||||
isc_result_t result;
|
||||
dns_cfgmgr_val_t val = dns_acl_cfgmgrval(acl);
|
||||
|
||||
REQUIRE(acl == NULL || DNS_ACL_VALID(acl));
|
||||
|
||||
@ -2400,7 +2399,7 @@ dns_view_setacl(dns_view_t *view, const char *name, const dns_acl_t *acl) {
|
||||
* Temporary work around until there is a clear life-cycle model of the
|
||||
* transaction
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_rwtxn();
|
||||
|
||||
/*
|
||||
* View pointer is part of the key because when named is
|
||||
@ -2415,9 +2414,7 @@ dns_view_setacl(dns_view_t *view, const char *name, const dns_acl_t *acl) {
|
||||
* let's keep this in mind...
|
||||
*/
|
||||
sprintf(path, "/views/%s%p/%s-computed", view->name, view, name);
|
||||
result = isc_cfgmgr_write(path, &val);
|
||||
dns_cfgmgr_write(path, &val);
|
||||
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
|
||||
return result;
|
||||
REQUIRE(dns_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/atomic.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/file.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/hashmap.h>
|
||||
@ -50,6 +49,7 @@
|
||||
#include <dns/adb.h>
|
||||
#include <dns/callbacks.h>
|
||||
#include <dns/catz.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/dbiterator.h>
|
||||
#include <dns/dlz.h>
|
||||
@ -24381,8 +24381,7 @@ dns_zone_setrad(dns_zone_t *zone, dns_name_t *name) {
|
||||
void
|
||||
dns_zone_setacl(dns_zone_t *zone, const char *name, const dns_acl_t *acl) {
|
||||
char path[512];
|
||||
isc_cfgmgr_val_t val = dns_acl_cfgmgrval(acl);
|
||||
isc_result_t result;
|
||||
dns_cfgmgr_val_t val = dns_acl_cfgmgrval(acl);
|
||||
|
||||
if (zone->view == NULL) {
|
||||
return;
|
||||
@ -24394,20 +24393,19 @@ dns_zone_setacl(dns_zone_t *zone, const char *name, const dns_acl_t *acl) {
|
||||
* Temporary work around until there is a clear life-cycle model of the
|
||||
* transaction
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_rwtxn();
|
||||
|
||||
sprintf(path, "/views/%s%p/zones/%s-%d/%s-computed", zone->view->name,
|
||||
zone->view, zone->strname, zone->type, name);
|
||||
result = isc_cfgmgr_write(path, &val);
|
||||
INSIST(result == ISC_R_SUCCESS || result == ISC_R_NOTFOUND);
|
||||
dns_cfgmgr_write(path, &val);
|
||||
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
REQUIRE(dns_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
}
|
||||
|
||||
dns_acl_t *
|
||||
dns_zone_getacl(dns_zone_t *zone, const char *name) {
|
||||
char path[512];
|
||||
isc_cfgmgr_val_t val;
|
||||
dns_cfgmgr_val_t val;
|
||||
dns_acl_t *acl = NULL;
|
||||
|
||||
if (zone->view == NULL) {
|
||||
@ -24418,7 +24416,7 @@ dns_zone_getacl(dns_zone_t *zone, const char *name) {
|
||||
* Temporary work around until there is a clear life-cycle model of the
|
||||
* transaction
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_txn() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_txn();
|
||||
|
||||
/*
|
||||
* Zone type needs to be part of the key, as, for instance, it is
|
||||
@ -24428,12 +24426,12 @@ dns_zone_getacl(dns_zone_t *zone, const char *name) {
|
||||
|
||||
sprintf(path, "/views/%s%p/zones/%s-%d/%s-computed", zone->view->name,
|
||||
zone->view, zone->strname, zone->type, name);
|
||||
if (isc_cfgmgr_read(path, &val) == ISC_R_SUCCESS) {
|
||||
INSIST(val.type == ISC_CFGMGR_REF);
|
||||
if (dns_cfgmgr_read(path, &val) == ISC_R_SUCCESS) {
|
||||
INSIST(val.type == DNS_CFGMGR_REF);
|
||||
acl = val.ptr;
|
||||
}
|
||||
|
||||
isc_cfgmgr_closetxn();
|
||||
dns_cfgmgr_closetxn();
|
||||
|
||||
return acl;
|
||||
}
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/counter.h>
|
||||
#include <isc/hex.h>
|
||||
#include <isc/list.h>
|
||||
@ -40,6 +39,7 @@
|
||||
#include <dns/badcache.h>
|
||||
#include <dns/byaddr.h>
|
||||
#include <dns/cache.h>
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/dlz.h>
|
||||
#include <dns/dns64.h>
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include <stdbool.h>
|
||||
|
||||
#include <isc/async.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/log.h>
|
||||
#include <isc/netaddr.h>
|
||||
#include <isc/serial.h>
|
||||
@ -23,6 +22,7 @@
|
||||
#include <isc/string.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/cfgmgr.h>
|
||||
#include <dns/db.h>
|
||||
#include <dns/dbiterator.h>
|
||||
#include <dns/diff.h>
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include <time.h>
|
||||
|
||||
#include <isc/buffer.h>
|
||||
#include <isc/cfgmgr.h>
|
||||
#include <isc/hash.h>
|
||||
#include <isc/loop.h>
|
||||
#include <isc/managers.h>
|
||||
@ -31,6 +30,8 @@
|
||||
#include <isc/timer.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#include <dns/cfgmgr.h>
|
||||
|
||||
#include <tests/isc.h>
|
||||
|
||||
isc_mem_t *mctx = NULL;
|
||||
@ -133,24 +134,23 @@ setup_cfgmgr(void **state ISC_ATTR_UNUSED) {
|
||||
* TODO: there is probably a working directory that can be used instead
|
||||
* of /tmp
|
||||
*/
|
||||
REQUIRE(isc_cfgmgr_init(mctx, "/tmp/named-cfgmgr-lmdb") == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_init(mctx);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEBUILTIN);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEBUILTIN);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODEUSER);
|
||||
dns_cfgmgr_rwtxn();
|
||||
dns_cfgmgr_commit();
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODEUSER);
|
||||
REQUIRE(isc_cfgmgr_rwtxn() == ISC_R_SUCCESS);
|
||||
REQUIRE(isc_cfgmgr_commit() == ISC_R_SUCCESS);
|
||||
|
||||
isc_cfgmgr_mode(ISC_CFGMGR_MODERUNNING);
|
||||
dns_cfgmgr_mode(DNS_CFGMGR_MODERUNNING);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
teardown_cfgmgr(void **state ISC_ATTR_UNUSED) {
|
||||
isc_cfgmgr_deinit();
|
||||
dns_cfgmgr_deinit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user