diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 397451fd01..f5cc6722da 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1029,13 +1029,12 @@ unit:gcc:ossl3:amd64: artifacts: true # Jobs for regular GCC builds on Debian "sid" (amd64) -# Also tests configration option: --without-lmdb. gcc:sid:amd64: variables: CC: gcc CFLAGS: "${CFLAGS_COMMON} -O3" - EXTRA_CONFIGURE: "--with-libidn2 --without-lmdb ${WITH_READLINE}" + EXTRA_CONFIGURE: "--with-libidn2 ${WITH_READLINE}" RUN_MAKE_INSTALL: 1 <<: *debian_sid_amd64_image <<: *build_job @@ -1056,14 +1055,13 @@ unit:gcc:sid:amd64: artifacts: true # Job for out-of-tree GCC build on Debian 12 "bookworm" (amd64) -# Also tests configration option: --with-lmdb. gcc:out-of-tree: variables: CC: gcc CFLAGS: "${CFLAGS_COMMON} -Og" CONFIGURE: "${CI_PROJECT_DIR}/configure" - EXTRA_CONFIGURE: "--with-libidn2 --with-lmdb" + EXTRA_CONFIGURE: "--with-libidn2" RUN_MAKE_INSTALL: 1 OUT_OF_TREE_WORKSPACE: workspace <<: *base_image diff --git a/bin/named/config.c b/bin/named/config.c index 23df890193..7f0e7c57ae 100644 --- a/bin/named/config.c +++ b/bin/named/config.c @@ -159,11 +159,9 @@ options {\n\ fetch-quota-params 100 0.1 0.3 0.7;\n\ fetches-per-server 0;\n\ fetches-per-zone 0;\n\ - lame-ttl 0;\n" -#ifdef HAVE_LMDB - " lmdb-mapsize 32M;\n" -#endif /* ifdef HAVE_LMDB */ - " max-cache-size 90%;\n\ + lame-ttl 0;\n\ + lmdb-mapsize 32M;\n\ + max-cache-size 90%;\n\ max-cache-ttl 604800; /* 1 week */\n\ max-clients-per-query 100;\n\ max-ncache-ttl 10800; /* 3 hours */\n\ diff --git a/bin/named/server.c b/bin/named/server.c index e52e60f11f..f6988b1fc1 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -140,14 +140,7 @@ #include #endif /* ifdef HAVE_LIBSCF */ -#ifdef HAVE_LMDB #include -#define configure_newzones configure_newzones_db -#define dumpzone dumpzone_db -#else /* HAVE_LMDB */ -#define configure_newzones configure_newzones_file -#define dumpzone dumpzone_file -#endif /* HAVE_LMDB */ #ifndef SIZE_MAX #define SIZE_MAX ((size_t)-1) @@ -503,7 +496,6 @@ putuint8(isc_buffer_t **b, uint8_t val); static isc_result_t putnull(isc_buffer_t **b); -#ifdef HAVE_LMDB static isc_result_t nzd_writable(dns_view_t *view); @@ -518,10 +510,6 @@ nzd_env_close(dns_view_t *view); static isc_result_t nzd_close(MDB_txn **txnp, bool commit); -#else /* ifdef HAVE_LMDB */ -static isc_result_t -nzf_append(dns_view_t *view, const cfg_obj_t *zconfig); -#endif /* ifdef HAVE_LMDB */ static isc_result_t load_nzf(dns_view_t *view, ns_cfgctx_t *nzcfg); @@ -7361,7 +7349,6 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, dns_view_setnewzonedir(view, dir); } -#ifdef HAVE_LMDB result = named_config_get(maps, "lmdb-mapsize", &obj); if (result == ISC_R_SUCCESS && obj != NULL) { mapsize = cfg_obj_asuint64(obj); @@ -7381,9 +7368,6 @@ setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, return ISC_R_FAILURE; } } -#else /* ifdef HAVE_LMDB */ - UNUSED(obj); -#endif /* HAVE_LMDB */ /* * A non-empty catalog-zones statement implies allow-new-zones @@ -7478,54 +7462,6 @@ configure_zone_setviewcommit(isc_result_t result, const cfg_obj_t *zconfig, dns_view_detach(&pview); } -#ifndef HAVE_LMDB - -static isc_result_t -configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig, - cfg_aclconfctx_t *actx) { - isc_result_t result; - ns_cfgctx_t *nzctx; - const cfg_obj_t *zonelist; - const cfg_listelt_t *element; - - nzctx = view->new_zone_config; - if (nzctx == NULL || nzctx->nzf_config == NULL) { - return ISC_R_SUCCESS; - } - - isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, - ISC_LOG_INFO, "loading additional zones for view '%s'", - view->name); - - zonelist = NULL; - cfg_map_get(nzctx->nzf_config, "zone", &zonelist); - - for (element = cfg_list_first(zonelist); element != NULL; - element = cfg_list_next(element)) - { - const cfg_obj_t *zconfig = cfg_listelt_value(element); - CHECK(configure_zone(config, zconfig, vconfig, view, - &named_g_server->viewlist, - &named_g_server->kasplist, - &named_g_server->keystorelist, actx, true, - false, false, false)); - } - - result = ISC_R_SUCCESS; - -cleanup: - for (element = cfg_list_first(zonelist); element != NULL; - element = cfg_list_next(element)) - { - const cfg_obj_t *zconfig = cfg_listelt_value(element); - configure_zone_setviewcommit(result, zconfig, view); - } - - return result; -} - -#else /* HAVE_LMDB */ - static isc_result_t data_to_cfg(dns_view_t *view, MDB_val *key, MDB_val *data, isc_buffer_t **text, cfg_obj_t **zoneconfig) { @@ -7823,8 +7759,6 @@ cleanup: return result; } -#endif /* HAVE_LMDB */ - static isc_result_t load_configuration(const char *filename, named_server_t *server, bool first_time) { @@ -8832,12 +8766,11 @@ load_configuration(const char *filename, named_server_t *server, server->sctx->tkeyctx = tkeyctx; } -#ifdef HAVE_LMDB /* - * If we're using LMDB, we may have created newzones databases - * as root, making it impossible to reopen them later after - * switching to a new userid. We close them now, and reopen - * after relinquishing privileges them. + * We may have created newzones LMDB databases as root, making + * it impossible to reopen them later after switching to a new + * userid. We close them now, and reopen after relinquishing + * privileges them. */ if (first_time) { for (dns_view_t *view = ISC_LIST_HEAD(server->viewlist); @@ -8846,7 +8779,6 @@ load_configuration(const char *filename, named_server_t *server, nzd_env_close(view); } } -#endif /* HAVE_LMDB */ /* * Switch to the effective UID for setting up files. @@ -8868,7 +8800,6 @@ load_configuration(const char *filename, named_server_t *server, goto cleanup_cachelist; } -#ifdef HAVE_LMDB /* * Reopen NZD databases. */ @@ -8879,7 +8810,6 @@ load_configuration(const char *filename, named_server_t *server, nzd_env_reopen(view); } } -#endif /* HAVE_LMDB */ /* * Configure the logging system. @@ -12345,163 +12275,6 @@ named_smf_add_message(isc_buffer_t **text) { } #endif /* HAVE_LIBSCF */ -#ifndef HAVE_LMDB - -/* - * Emit a comment at the top of the nzf file containing the viewname - * Expects the fp to already be open for writing - */ -#define HEADER1 "# New zone file for view: " -#define HEADER2 \ - "\n# This file contains configuration for zones added by\n" \ - "# the 'rndc addzone' command. DO NOT EDIT BY HAND.\n" -static isc_result_t -add_comment(FILE *fp, const char *viewname) { - isc_result_t result; - CHECK(isc_stdio_write(HEADER1, sizeof(HEADER1) - 1, 1, fp, NULL)); - CHECK(isc_stdio_write(viewname, strlen(viewname), 1, fp, NULL)); - CHECK(isc_stdio_write(HEADER2, sizeof(HEADER2) - 1, 1, fp, NULL)); -cleanup: - return result; -} - -static void -dumpzone(void *arg, const char *buf, int len) { - FILE *fp = arg; - - (void)isc_stdio_write(buf, len, 1, fp, NULL); -} - -static isc_result_t -nzf_append(dns_view_t *view, const cfg_obj_t *zconfig) { - isc_result_t result; - off_t offset; - FILE *fp = NULL; - bool offsetok = false; - - LOCK(&view->new_zone_lock); - - CHECK(isc_stdio_open(view->new_zone_file, "a", &fp)); - CHECK(isc_stdio_seek(fp, 0, SEEK_END)); - - CHECK(isc_stdio_tell(fp, &offset)); - offsetok = true; - if (offset == 0) { - CHECK(add_comment(fp, view->name)); - } - - CHECK(isc_stdio_write("zone ", 5, 1, fp, NULL)); - cfg_printx(zconfig, CFG_PRINTER_ONELINE, dumpzone, fp); - CHECK(isc_stdio_write(";\n", 2, 1, fp, NULL)); - CHECK(isc_stdio_flush(fp)); - result = isc_stdio_close(fp); - fp = NULL; - -cleanup: - if (fp != NULL) { - (void)isc_stdio_close(fp); - if (offsetok) { - isc_result_t result2; - - result2 = isc_file_truncate(view->new_zone_file, - offset); - if (result2 != ISC_R_SUCCESS) { - isc_log_write(NAMED_LOGCATEGORY_GENERAL, - NAMED_LOGMODULE_SERVER, - ISC_LOG_ERROR, - "Error truncating NZF file '%s' " - "during rollback from append: " - "%s", - view->new_zone_file, - isc_result_totext(result2)); - } - } - } - UNLOCK(&view->new_zone_lock); - return result; -} - -static isc_result_t -nzf_writeconf(const cfg_obj_t *config, dns_view_t *view) { - const cfg_obj_t *zl = NULL; - cfg_list_t *list; - const cfg_listelt_t *elt; - - FILE *fp = NULL; - char tmp[1024]; - isc_result_t result; - - result = isc_file_template(view->new_zone_file, "nzf-XXXXXXXX", tmp, - sizeof(tmp)); - if (result == ISC_R_SUCCESS) { - result = isc_file_openunique(tmp, &fp); - } - if (result != ISC_R_SUCCESS) { - return result; - } - - cfg_map_get(config, "zone", &zl); - if (!cfg_obj_islist(zl)) { - CHECK(ISC_R_FAILURE); - } - - list = UNCONST(&zl->value.list); - - CHECK(add_comment(fp, view->name)); /* force a comment */ - - for (elt = ISC_LIST_HEAD(*list); elt != NULL; - elt = ISC_LIST_NEXT(elt, link)) - { - const cfg_obj_t *zconfig = cfg_listelt_value(elt); - - CHECK(isc_stdio_write("zone ", 5, 1, fp, NULL)); - cfg_printx(zconfig, CFG_PRINTER_ONELINE, dumpzone, fp); - CHECK(isc_stdio_write(";\n", 2, 1, fp, NULL)); - } - - CHECK(isc_stdio_flush(fp)); - result = isc_stdio_close(fp); - fp = NULL; - if (result != ISC_R_SUCCESS) { - goto cleanup; - } - CHECK(isc_file_rename(tmp, view->new_zone_file)); - return result; - -cleanup: - if (fp != NULL) { - (void)isc_stdio_close(fp); - } - (void)isc_file_remove(tmp); - return result; -} - -static isc_result_t -load_nzf(dns_view_t *view, ns_cfgctx_t *nzcfg) { - isc_result_t result; - - /* The new zone file may not exist. That is OK. */ - if (!isc_file_exists(view->new_zone_file)) { - return ISC_R_SUCCESS; - } - - /* - * Parse the configuration in the NZF file. This may be called in - * multiple views, so we reset the parser each time. - */ - cfg_parser_reset(named_g_addparser); - result = cfg_parse_file(named_g_addparser, view->new_zone_file, - &cfg_type_addzoneconf, &nzcfg->nzf_config); - if (result != ISC_R_SUCCESS) { - isc_log_write(NAMED_LOGCATEGORY_GENERAL, NAMED_LOGMODULE_SERVER, - ISC_LOG_ERROR, "Error parsing NZF file '%s': %s", - view->new_zone_file, isc_result_totext(result)); - } - - return result; -} -#else /* HAVE_LMDB */ - static void nzd_setkey(MDB_val *key, dns_name_t *name, char *namebuf, size_t buflen) { dns_fixedname_t fixed; @@ -12983,7 +12756,6 @@ cleanup: return result; } -#endif /* HAVE_LMDB */ static isc_result_t newzone_parse(named_server_t *server, char *command, dns_view_t **viewp, @@ -13168,21 +12940,14 @@ cleanup: static isc_result_t do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, - dns_name_t *name, cfg_obj_t *zoneconf, const cfg_obj_t *zoneobj, - bool redirect, isc_buffer_t **text) { + dns_name_t *name, const cfg_obj_t *zoneobj, bool redirect, + isc_buffer_t **text) { isc_result_t result, tresult; dns_zone_t *zone = NULL; -#ifndef HAVE_LMDB - FILE *fp = NULL; - bool cleanup_config = false; -#else /* HAVE_LMDB */ MDB_txn *txn = NULL; MDB_dbi dbi; bool locked = false; - UNUSED(zoneconf); -#endif - /* Zone shouldn't already exist */ if (redirect) { result = (view->redirect == NULL) ? ISC_R_NOTFOUND @@ -13198,24 +12963,6 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, } isc_loopmgr_pause(named_g_loopmgr); - -#ifndef HAVE_LMDB - /* - * Make sure we can open the configuration save file - */ - result = isc_stdio_open(view->new_zone_file, "a", &fp); - if (result != ISC_R_SUCCESS) { - isc_loopmgr_resume(named_g_loopmgr); - TCHECK(putstr(text, "unable to create '")); - TCHECK(putstr(text, view->new_zone_file)); - TCHECK(putstr(text, "': ")); - TCHECK(putstr(text, isc_result_totext(result))); - goto cleanup; - } - - (void)isc_stdio_close(fp); - fp = NULL; -#else /* HAVE_LMDB */ LOCK(&view->new_zone_lock); locked = true; /* Make sure we can open the NZD database */ @@ -13228,7 +12975,6 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, result = ISC_R_FAILURE; goto cleanup; } -#endif /* HAVE_LMDB */ /* Mark view unfrozen and configure zone */ dns_view_thaw(view); @@ -13263,22 +13009,6 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, } } -#ifndef HAVE_LMDB - /* - * If there wasn't a previous newzone config, just save the one - * we've created. If there was a previous one, merge the new - * zone into it. - */ - if (cfg->nzf_config == NULL) { - cfg_obj_attach(zoneconf, &cfg->nzf_config); - } else { - cfg_obj_t *z = UNCONST(zoneobj); - CHECK(cfg_parser_mapadd(cfg->add_parser, cfg->nzf_config, z, - "zone")); - } - cleanup_config = true; -#endif /* HAVE_LMDB */ - /* * Load the zone from the master file. If this fails, we'll * need to undo the configuration we've done already. @@ -13307,34 +13037,17 @@ do_addzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, /* Flag the zone as having been added at runtime */ dns_zone_setadded(zone, true); -#ifdef HAVE_LMDB /* Save the new zone configuration into the NZD */ CHECK(nzd_open(view, 0, &txn, &dbi)); CHECK(nzd_save(&txn, dbi, zone, zoneobj)); -#else /* ifdef HAVE_LMDB */ - /* Append the zone configuration to the NZF */ - result = nzf_append(view, zoneobj); -#endif /* HAVE_LMDB */ cleanup: - -#ifndef HAVE_LMDB - if (fp != NULL) { - (void)isc_stdio_close(fp); - } - if (result != ISC_R_SUCCESS && cleanup_config) { - tresult = delete_zoneconf(view, cfg->add_parser, - cfg->nzf_config, name, NULL); - RUNTIME_CHECK(tresult == ISC_R_SUCCESS); - } -#else /* HAVE_LMDB */ if (txn != NULL) { (void)nzd_close(&txn, false); } if (locked) { UNLOCK(&view->new_zone_lock); } -#endif /* HAVE_LMDB */ if (zone != NULL) { dns_zone_detach(&zone); @@ -13350,14 +13063,9 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, isc_result_t result, tresult; dns_zone_t *zone = NULL; bool added; -#ifndef HAVE_LMDB - FILE *fp = NULL; - cfg_obj_t *z; -#else /* HAVE_LMDB */ MDB_txn *txn = NULL; MDB_dbi dbi; bool locked = false; -#endif /* HAVE_LMDB */ /* Zone must already exist */ if (redirect) { @@ -13377,30 +13085,8 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, added = dns_zone_getadded(zone); dns_zone_detach(&zone); -#ifndef HAVE_LMDB - cfg = (ns_cfgctx_t *)view->new_zone_config; - if (cfg == NULL) { - TCHECK(putstr(text, "new zone config is not set")); - CHECK(ISC_R_FAILURE); - } -#endif /* ifndef HAVE_LMDB */ - isc_loopmgr_pause(named_g_loopmgr); -#ifndef HAVE_LMDB - /* Make sure we can open the configuration save file */ - result = isc_stdio_open(view->new_zone_file, "a", &fp); - if (result != ISC_R_SUCCESS) { - TCHECK(putstr(text, "unable to open '")); - TCHECK(putstr(text, view->new_zone_file)); - TCHECK(putstr(text, "': ")); - TCHECK(putstr(text, isc_result_totext(result))); - isc_loopmgr_resume(named_g_loopmgr); - goto cleanup; - } - (void)isc_stdio_close(fp); - fp = NULL; -#else /* HAVE_LMDB */ LOCK(&view->new_zone_lock); locked = true; /* Make sure we can open the NZD database */ @@ -13413,7 +13099,6 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, isc_loopmgr_resume(named_g_loopmgr); goto cleanup; } -#endif /* HAVE_LMDB */ /* Reconfigure the zone */ dns_view_thaw(view); @@ -13441,21 +13126,6 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, CHECK(dns_view_findzone(view, name, DNS_ZTFIND_EXACT, &zone)); } -#ifndef HAVE_LMDB - /* Remove old zone from configuration (and NZF file if applicable) */ - if (added) { - result = delete_zoneconf(view, cfg->add_parser, cfg->nzf_config, - dns_zone_getorigin(zone), - nzf_writeconf); - if (result != ISC_R_SUCCESS) { - TCHECK(putstr(text, "former zone configuration " - "not deleted: ")); - TCHECK(putstr(text, isc_result_totext(result))); - goto cleanup; - } - } -#endif /* HAVE_LMDB */ - if (!added) { if (cfg->vconfig == NULL) { result = delete_zoneconf( @@ -13512,24 +13182,9 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, goto cleanup; } -#ifndef HAVE_LMDB - /* Store the new zone configuration; also in NZF if applicable */ - z = UNCONST(zoneobj); - CHECK(cfg_parser_mapadd(cfg->add_parser, cfg->nzf_config, z, "zone")); -#endif /* HAVE_LMDB */ - if (added) { -#ifdef HAVE_LMDB CHECK(nzd_open(view, 0, &txn, &dbi)); CHECK(nzd_save(&txn, dbi, zone, zoneobj)); -#else /* ifdef HAVE_LMDB */ - result = nzf_append(view, zoneobj); - if (result != ISC_R_SUCCESS) { - TCHECK(putstr(text, "\nNew zone config not saved: ")); - TCHECK(putstr(text, isc_result_totext(result))); - goto cleanup; - } -#endif /* HAVE_LMDB */ TCHECK(putstr(text, "zone '")); TCHECK(putstr(text, zname)); @@ -13543,18 +13198,12 @@ do_modzone(named_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view, cleanup: -#ifndef HAVE_LMDB - if (fp != NULL) { - (void)isc_stdio_close(fp); - } -#else /* HAVE_LMDB */ if (txn != NULL) { (void)nzd_close(&txn, false); } if (locked) { UNLOCK(&view->new_zone_lock); } -#endif /* HAVE_LMDB */ if (zone != NULL) { dns_zone_detach(&zone); @@ -13594,12 +13243,7 @@ named_server_changezone(named_server_t *server, char *command, &redirect, text)); /* Are we accepting new zones in this view? */ -#ifdef HAVE_LMDB - if (view->new_zone_db == NULL) -#else /* ifdef HAVE_LMDB */ - if (view->new_zone_file == NULL) -#endif /* HAVE_LMDB */ - { + if (view->new_zone_db == NULL) { (void)putstr(text, "Not allowing new zones in view '"); (void)putstr(text, view->name); (void)putstr(text, "'"); @@ -13629,8 +13273,8 @@ named_server_changezone(named_server_t *server, char *command, } if (addzone) { - CHECK(do_addzone(server, cfg, view, dnsname, zoneconf, zoneobj, - redirect, text)); + CHECK(do_addzone(server, cfg, view, dnsname, zoneobj, redirect, + text)); } else { CHECK(do_modzone(server, cfg, view, dnsname, zonename, zoneobj, redirect, text)); @@ -13693,10 +13337,8 @@ rmzone(void *arg) { dns_db_t *dbp = NULL; bool added; isc_result_t result; -#ifdef HAVE_LMDB MDB_txn *txn = NULL; MDB_dbi dbi; -#endif /* ifdef HAVE_LMDB */ REQUIRE(dz != NULL); @@ -13718,7 +13360,6 @@ rmzone(void *arg) { catz = dns_zone_get_parentcatz(zone); if (added && catz == NULL && cfg != NULL) { -#ifdef HAVE_LMDB /* Make sure we can open the NZD database */ LOCK(&view->new_zone_lock); result = nzd_open(view, 0, &txn, &dbi); @@ -13742,17 +13383,6 @@ rmzone(void *arg) { (void)nzd_close(&txn, false); } UNLOCK(&view->new_zone_lock); -#else /* ifdef HAVE_LMDB */ - result = delete_zoneconf(view, cfg->add_parser, cfg->nzf_config, - dns_zone_getorigin(zone), - nzf_writeconf); - if (result != ISC_R_SUCCESS) { - isc_log_write(NAMED_LOGCATEGORY_GENERAL, - NAMED_LOGMODULE_SERVER, ISC_LOG_ERROR, - "unable to delete zone configuration: %s", - isc_result_totext(result)); - } -#endif /* HAVE_LMDB */ } if (!added && cfg != NULL) { @@ -14061,9 +13691,7 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex, dns_view_t *view = NULL; dns_zone_t *zone = NULL; ns_cfgctx_t *cfg = NULL; -#ifdef HAVE_LMDB cfg_obj_t *nzconfig = NULL; -#endif /* HAVE_LMDB */ bool added, redirect; ns_dzarg_t dzarg; @@ -14103,12 +13731,6 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex, redirect); } -#ifndef HAVE_LMDB - if (zconfig == NULL && cfg->nzf_config != NULL) { - zconfig = find_name_in_list_from_map(cfg->nzf_config, "zone", - zonename, redirect); - } -#else /* HAVE_LMDB */ if (zconfig == NULL) { const cfg_obj_t *zlist = NULL; CHECK(get_newzone_config(view, zonename, &nzconfig)); @@ -14119,7 +13741,6 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex, zconfig = cfg_listelt_value(cfg_list_first(zlist)); } -#endif /* HAVE_LMDB */ if (zconfig == NULL) { CHECK(ISC_R_NOTFOUND); @@ -14137,11 +13758,10 @@ named_server_showzone(named_server_t *server, isc_lex_t *lex, result = ISC_R_SUCCESS; cleanup: -#ifdef HAVE_LMDB if (nzconfig != NULL) { cfg_obj_destroy(named_g_addparser, &nzconfig); } -#endif /* HAVE_LMDB */ + if (isc_buffer_usedlength(*text) > 0) { (void)putnull(text); } diff --git a/bin/rndc/rndc.rst b/bin/rndc/rndc.rst index 11c35c2d03..6d81ddd5f5 100644 --- a/bin/rndc/rndc.rst +++ b/bin/rndc/rndc.rst @@ -133,14 +133,13 @@ Currently supported commands are: string specified on the command line is the zone configuration text that would ordinarily be placed in :iscman:`named.conf`. - The configuration is saved in a file called ``viewname.nzf`` (or, if - :iscman:`named` is compiled with liblmdb, an LMDB database file called - ``viewname.nzd``). ``viewname`` is the name of the view, unless the view - name contains characters that are incompatible with use as a file - name, in which case a cryptographic hash of the view name is used - instead. When :iscman:`named` is restarted, the file is loaded into - the view configuration so that zones that were added can persist - after a restart. + The configuration is saved in an LMDB database called + ``viewname.nzf``. ``viewname`` is the name of the view, unless the + view name contains characters that are incompatible with use as a + file name, in which case a cryptographic hash of the view name is + used instead. When :iscman:`named` is restarted, the file is loaded + into the view configuration so that zones that were added can + persist after a restart. This sample ``addzone`` command adds the zone ``example.com`` to the default view: diff --git a/bin/tests/system/addzone/tests.sh b/bin/tests/system/addzone/tests.sh index 6d5939c896..41f239a0ac 100755 --- a/bin/tests/system/addzone/tests.sh +++ b/bin/tests/system/addzone/tests.sh @@ -36,8 +36,8 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -# When LMDB support is compiled in, this tests that migration from -# NZF to NZD occurs during named startup +# This tests that migration from NZF to NZD occurs during named +# startup echo_i "checking previously added zone ($n)" ret=0 $DIG $DIGOPTS @10.53.0.2 a.previous.example a >dig.out.ns2.$n || ret=1 @@ -47,13 +47,11 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -if $FEATURETEST --with-lmdb; then - echo_i "checking that existing NZF file was renamed after migration ($n)" - [ -e ns2/3bf305731dd26307.nzf~ ] || ret=1 - n=$((n + 1)) - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi +echo_i "checking that existing NZF file was renamed after migration ($n)" +[ -e ns2/3bf305731dd26307.nzf~ ] || ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) echo_i "adding new zone ($n)" ret=0 @@ -126,16 +124,6 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -if ! $FEATURETEST --with-lmdb; then - echo_i "verifying no comments in NZF file ($n)" - ret=0 - hcount=$(grep "^# New zone file for view: _default" ns2/3bf305731dd26307.nzf | wc -l) - [ $hcount -eq 0 ] || ret=1 - n=$((n + 1)) - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi - echo_i "checking rndc showzone with previously added zone ($n)" ret=0 $RNDCCMD 10.53.0.2 showzone previous.example >rndc.out.ns2.$n @@ -145,13 +133,11 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -if $FEATURETEST --with-lmdb; then - echo_i "checking zone is present in NZD ($n)" - ret=0 - $NZD2NZF ns2/_default.nzd | grep previous.example >/dev/null || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi +echo_i "checking zone is present in NZD ($n)" +ret=0 +$NZD2NZF ns2/_default.nzd | grep previous.example >/dev/null || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) echo_i "deleting previously added zone ($n)" ret=0 @@ -171,22 +157,10 @@ check_nzd2nzf() ( && ! grep previous.example nzd2nzf.out.$n >/dev/null ) -if $FEATURETEST --with-lmdb; then - echo_i "checking zone was deleted from NZD ($n)" - retry_quiet 10 check_nzd2nzf || ret=1 - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi - -if ! $FEATURETEST --with-lmdb; then - echo_i "checking NZF file now has comment ($n)" - ret=0 - hcount=$(grep "^# New zone file for view: _default" ns2/3bf305731dd26307.nzf | wc -l) - [ $hcount -eq 1 ] || ret=1 - n=$((n + 1)) - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi +echo_i "checking zone was deleted from NZD ($n)" +retry_quiet 10 check_nzd2nzf || ret=1 +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) echo_i "deleting newly added zone added.example ($n)" ret=0 @@ -508,24 +482,12 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -if ! $FEATURETEST --with-lmdb; then - echo_i "checking new NZF file has comment ($n)" - ret=0 - hcount=$(grep "^# New zone file for view: external" ns2/external.nzf | wc -l) - [ $hcount -eq 1 ] || ret=1 - n=$((n + 1)) - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi - -if $FEATURETEST --with-lmdb; then - echo_i "verifying added.example in external view created an external.nzd DB ($n)" - ret=0 - [ -e ns2/external.nzd ] || ret=1 - n=$((n + 1)) - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi +echo_i "verifying added.example in external view created an external.nzd DB ($n)" +ret=0 +[ -e ns2/external.nzd ] || ret=1 +n=$((n + 1)) +if [ $ret != 0 ]; then echo_i "failed"; fi +status=$((status + ret)) echo_i "checking rndc reload causes named to reload the external view's new zone config ($n)" ret=0 @@ -544,11 +506,7 @@ status=$((status + ret)) echo_i "checking rndc showzone with newly added zone ($n)" _check_rndc_showzone_newly_added() ( - if ! $FEATURETEST --with-lmdb; then - expected='zone "added.example" in external { type primary; file "added.db"; };' - else - expected='zone "added.example" { type primary; file "added.db"; };' - fi + expected='zone "added.example" { type primary; file "added.db"; };' $RNDCCMD 10.53.0.2 showzone added.example in external >rndc.out.ns2.$n 2>/dev/null \ && [ "$(cat rndc.out.ns2.$n)" = "$expected" ] ) @@ -651,13 +609,8 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -if $FEATURETEST --with-lmdb; then - echo_i "checking NZD file was created in new-zones-directory ($n)" - expect=ns2/new-zones/directory.nzd -else - echo_i "checking NZF file was created in new-zones-directory ($n)" - expect=ns2/new-zones/directory.nzf -fi +echo_i "checking NZD file was created in new-zones-directory ($n)" +expect=ns2/new-zones/directory.nzd $RNDCCMD 10.53.0.2 sync 'added.example IN directory' 2>&1 | sed 's/^/I:ns2 /' sleep 2 [ -e "$expect" ] || ret=1 @@ -693,19 +646,6 @@ n=$((n + 1)) if [ $ret != 0 ]; then echo_i "failed"; fi status=$((status + ret)) -if ! $FEATURETEST --with-lmdb; then - echo_i "check that addzone is fully reversed on failure (--with-lmdb=no) ($n)" - ret=0 - $RNDCCMD 10.53.0.3 addzone "test1.baz" '{ type primary; file "e.db"; };' >/dev/null 2>&1 || ret=1 - $RNDCCMD 10.53.0.3 addzone "test2.baz" '{ type primary; file "dne.db"; };' >/dev/null 2>&1 && ret=1 - $RNDCCMD 10.53.0.3 addzone "test3.baz" '{ type primary; file "e.db"; };' >/dev/null 2>&1 || ret=1 - $RNDCCMD 10.53.0.3 delzone "test3.baz" >/dev/null 2>&1 || ret=1 - grep test2.baz ns3/_default.nzf >/dev/null && ret=1 - n=$((n + 1)) - if [ $ret != 0 ]; then echo_i "failed"; fi - status=$((status + ret)) -fi - _check_version_bind() ( $DIG $DIGOPTS @10.53.0.3 version.bind txt ch >dig.out.test$n \ && grep "status: NOERROR" dig.out.test$n >/dev/null diff --git a/bin/tests/system/feature-test.c b/bin/tests/system/feature-test.c index 11481f3bbb..4f6134e6ae 100644 --- a/bin/tests/system/feature-test.c +++ b/bin/tests/system/feature-test.c @@ -54,7 +54,6 @@ usage(void) { fprintf(stderr, "\t--tsan\n"); fprintf(stderr, "\t--with-dlz-filesystem\n"); fprintf(stderr, "\t--with-libidn2\n"); - fprintf(stderr, "\t--with-lmdb\n"); fprintf(stderr, "\t--with-libnghttp2\n"); fprintf(stderr, "\t--with-zlib\n"); } @@ -238,14 +237,6 @@ main(int argc, char **argv) { #endif /* ifdef HAVE_LIBIDN2 */ } - if (strcmp(argv[1], "--with-lmdb") == 0) { -#ifdef HAVE_LMDB - return 0; -#else /* ifdef HAVE_LMDB */ - return 1; -#endif /* ifdef HAVE_LMDB */ - } - if (strcmp(argv[1], "--with-libnghttp2") == 0) { #ifdef HAVE_LIBNGHTTP2 return 0; diff --git a/bin/tests/system/nzd2nzf/prereq.sh b/bin/tests/system/nzd2nzf/prereq.sh index c3a239b741..e2eacbbe5b 100644 --- a/bin/tests/system/nzd2nzf/prereq.sh +++ b/bin/tests/system/nzd2nzf/prereq.sh @@ -13,8 +13,5 @@ . ../conf.sh -$FEATURETEST --with-lmdb || { - echo_i "This test requires LMDB support." >&2 - exit 255 -} +$FEATURETEST exit 0 diff --git a/bin/tools/Makefile.am b/bin/tools/Makefile.am index 0df1c7409b..d7e2f71ab4 100644 --- a/bin/tools/Makefile.am +++ b/bin/tools/Makefile.am @@ -2,18 +2,21 @@ include $(top_srcdir)/Makefile.top AM_CPPFLAGS += \ $(LIBISC_CFLAGS) \ - $(LIBDNS_CFLAGS) + $(LIBDNS_CFLAGS) \ + $(LMDB_CFLAGS) LDADD += \ $(LIBDNS_LIBS) \ - $(LIBISC_LIBS) + $(LIBISC_LIBS) \ + $(LMDB_LIBS) bin_PROGRAMS = \ arpaname \ mdig \ named-journalprint \ named-rrchecker \ - nsec3hash + nsec3hash \ + named-nzd2nzf arpaname_LDADD = \ $(LIBISC_LIBS) @@ -32,17 +35,3 @@ dnstap_read_LDADD = \ $(LIBISC_LIBS) \ $(DNSTAP_LIBS) endif - -if HAVE_LMDB -bin_PROGRAMS += \ - named-nzd2nzf - -named_nzd2nzf_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - $(LMDB_CFLAGS) - -named_nzd2nzf_LDADD = \ - $(LIBISC_LIBS) \ - $(LMDB_LIBS) - -endif diff --git a/bin/tools/named-nzd2nzf.c b/bin/tools/named-nzd2nzf.c index 42be33f7fc..c77cbb5375 100644 --- a/bin/tools/named-nzd2nzf.c +++ b/bin/tools/named-nzd2nzf.c @@ -11,10 +11,6 @@ * information regarding copyright ownership. */ -#ifndef HAVE_LMDB -#error This program requires the LMDB library. -#endif /* ifndef HAVE_LMDB */ - #include #include #include diff --git a/configure.ac b/configure.ac index 71f14127ee..fe3aa8aa70 100644 --- a/configure.ac +++ b/configure.ac @@ -756,43 +756,13 @@ AC_SUBST([KRB5_CFLAGS]) AC_SUBST([KRB5_LIBS]) # -# was --with-lmdb specified? +# LMDB is mandatory # +PKG_CHECK_MODULES([LMDB], [lmdb]) +AX_SAVE_FLAGS([lmdb]) -# [pairwise: --with-lmdb=auto, --with-lmdb=yes, --without-lmdb] -AC_ARG_WITH([lmdb], - [AS_HELP_STRING([--with-lmdb=@<:@PATH@:>@], - [use LMDB library @<:@default=auto@:>@, optionally specify the prefix for lmdb library])], - [:], - [with_lmdb="auto"]) - -ac_lib_lmdb_found=no -AS_CASE([$with_lmdb], - [no],[], - [auto|yes], [PKG_CHECK_MODULES([LMDB], [lmdb], - [ac_lib_lmdb_found=yes], - [for ac_lib_lmdb_path in /usr /usr/local /opt /opt/local; do - AX_LIB_LMDB([$ac_lib_lmdb_path], - [ac_lib_lmdb_found=yes - break]) - done - ])], - [AX_LIB_LMDB([$with_lmdb],[ac_lib_lmdb_found=yes])]) - -# don't fail when in automatic mode -AS_IF([test "$with_lmdb" = "auto" && test "$ac_lib_lmdb_found" = "no"], - [with_lmdb=no]) - -# hard fail when LMDB requested, but not found -AS_IF([test "$with_lmdb" != "no" && test "$ac_lib_lmdb_found" != "yes"], - [AC_MSG_ERROR([LMDB requested, but not found])]) - -AS_IF([test "$ac_lib_lmdb_found" = "yes"], - [AC_DEFINE([HAVE_LMDB], [1], [Use lmdb library])]) - -AC_SUBST([LMDB_CFLAGS]) -AC_SUBST([LMDB_LIBS]) -AM_CONDITIONAL([HAVE_LMDB], [test -n "$LMDB_LIBS"]) +CFLAGS="$CFLAGS $LMDB_CFLAGS" +LIBS="$LIBS $LMDB_LIBS" # # was --with-libxml2 specified? @@ -1519,7 +1489,7 @@ report() { test -z "$LIBXML2_LIBS" || echo " XML statistics (--with-libxml2)" test -z "$JSON_C_LIBS" || echo " JSON statistics (--with-json-c): $JSON_C_CFLAGS $JSON_C_LIBS" test -z "$ZLIB_LIBS" || echo " HTTP zlib compression (--with-zlib)" - test -z "$LMDB_LIBS" || echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)" + test -z "$LMDB_LIBS" || echo " LMDB database" test -z "$LIBIDN2_LIBS" || echo " IDN support (--with-libidn2)" fi @@ -1581,7 +1551,7 @@ report() { test -z "$LIBXML2_LIBS" && echo " XML statistics (--with-libxml2)" test -z "$JSON_C_LIBS" && echo " JSON statistics (--with-json-c)" test -z "$ZLIB_LIBS" && echo " HTTP zlib compression (--with-zlib)" - test -z "$LMDB_LIBS" && echo " LMDB database to store configuration for 'addzone' zones (--with-lmdb)" + test -z "$LMDB_LIBS" && echo " LMDB database" test -z "$LIBIDN2_LIBS" && echo " IDN support (--with-libidn2)" echo "-------------------------------------------------------------------------------" diff --git a/doc/arm/build.inc.rst b/doc/arm/build.inc.rst index 10dd3eaddd..1baa80511d 100644 --- a/doc/arm/build.inc.rst +++ b/doc/arm/build.inc.rst @@ -116,11 +116,6 @@ be linked against ``zlib`` (https://zlib.net/). If this is installed in a nonstandard location, specify the prefix using ``--with-zlib=/prefix``. -To support storing configuration data for runtime-added zones in an LMDB -database, the server must be linked with ``liblmdb`` -(https://github.com/LMDB/lmdb). If this is installed in a nonstandard -location, specify the prefix using ``--with-lmdb=/prefix``. - To support MaxMind GeoIP2 location-based ACLs, the server must be linked with ``libmaxminddb`` (https://maxmind.github.io/libmaxminddb/). This is turned on by default if the library is found; if the library is diff --git a/doc/arm/reference.rst b/doc/arm/reference.rst index 4f83936ba8..d82989a234 100644 --- a/doc/arm/reference.rst +++ b/doc/arm/reference.rst @@ -1364,12 +1364,11 @@ default is used. :tags: server :short: Sets a maximum size for the memory map of the new-zone database in LMDB database format. - When :iscman:`named` is built with liblmdb, this option sets a maximum size - for the memory map of the new-zone database (NZD) in LMDB database - format. This database is used to store configuration information for - zones added using :option:`rndc addzone`. Note that this is not the NZD - database file size, but the largest size that the database may grow - to. + This option sets a maximum size for the memory map of the new-zone + database (NZD) in LMDB database format. This database is used to + store configuration information for zones added using :option:`rndc + addzone`. Note that this is not the NZD database file size, but the + largest size that the database may grow to. Because the database file is memory-mapped, its size is limited by the address space of the :iscman:`named` process. The default of 32 megabytes @@ -1998,17 +1997,15 @@ Boolean Options Newly added zones' configuration parameters are stored so that they can persist after the server is restarted. The configuration - information is saved in a file called ``viewname.nzf`` (or, if - :iscman:`named` is compiled with liblmdb, in an LMDB database file called - ``viewname.nzd``). "viewname" is the name of the view, unless the view - name contains characters that are incompatible with use as a file - name, in which case a cryptographic hash of the view name is used - instead. + information is saved in an LMDB database file called + ``viewname.nzf``. "viewname" is the name of the view, unless the + view name contains characters that are incompatible with use as a + file name, in which case a cryptographic hash of the view name is + used instead. - Configurations for zones added at runtime are stored either in - a new-zone file (NZF) or a new-zone database (NZD), depending on - whether :iscman:`named` was linked with liblmdb at compile time. See - :ref:`man_rndc` for further details about :option:`rndc addzone`. + Configurations for zones added at runtime are stored either in a + new-zone database (NZD). See :ref:`man_rndc` for further details + about :option:`rndc addzone`. .. namedconf:statement:: auth-nxdomain :tags: query diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 37d29ed17f..d43627bae6 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -100,6 +100,7 @@ man_MANS = \ named-checkzone.1 \ named-compilezone.1 \ named-journalprint.1 \ + named-nzd2nzf.1 \ named.8 \ nsec3hash.1 \ rndc-confgen.8 \ @@ -111,11 +112,6 @@ man_MANS += \ dnstap-read.1 endif HAVE_DNSTAP -if HAVE_LMDB -man_MANS += \ - named-nzd2nzf.1 -endif HAVE_LMDB - MANPAGES_IN = \ $(man_MANS:=in) \ dnstap-read.1in \ diff --git a/doc/misc/options b/doc/misc/options index baa4e3696f..816015e66c 100644 --- a/doc/misc/options +++ b/doc/misc/options @@ -165,7 +165,7 @@ options { lame-ttl ; listen-on [ port ] [ proxy ] [ tls ] [ http ] { ; ... }; // may occur multiple times listen-on-v6 [ port ] [ proxy ] [ tls ] [ http ] { ; ... }; // may occur multiple times - lmdb-mapsize ; // optional (only available if configured) + lmdb-mapsize ; managed-keys-directory ; masterfile-format ( raw | text ); masterfile-style ( full | relative ); @@ -449,7 +449,7 @@ view [ ] { }; // may occur multiple times key-directory ; lame-ttl ; - lmdb-mapsize ; // optional (only available if configured) + lmdb-mapsize ; masterfile-format ( raw | text ); masterfile-style ( full | relative ); match-clients { ; ... }; diff --git a/lib/dns/Makefile.am b/lib/dns/Makefile.am index d287dc5503..95a627dfe5 100644 --- a/lib/dns/Makefile.am +++ b/lib/dns/Makefile.am @@ -267,6 +267,7 @@ libdns_la_CPPFLAGS = \ $(LIBISC_CFLAGS) \ $(LIBURCU_CFLAGS) \ $(LIBUV_CFLAGS) \ + $(LMDB_CFLAGS) \ $(OPENSSL_CFLAGS) libdns_la_LDFLAGS = \ @@ -277,6 +278,7 @@ libdns_la_LIBADD = \ $(LIBISC_LIBS) \ $(LIBURCU_LIBS) \ $(LIBUV_LIBS) \ + $(LMDB_LIBS) \ $(OPENSSL_LIBS) if HAVE_JSON_C @@ -326,11 +328,6 @@ libdns_la_CPPFLAGS += $(DNSTAP_CFLAGS) libdns_la_LIBADD += $(DNSTAP_LIBS) endif -if HAVE_LMDB -libdns_la_CPPFLAGS += $(LMDB_CFLAGS) -libdns_la_LIBADD += $(LMDB_LIBS) -endif - if !HAVE_SYSTEMTAP DTRACE_DEPS = libdns_la-xfrin.lo DTRACE_OBJS = .libs/libdns_la-xfrin.$(OBJEXT) diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index edab9d2be1..86e771c09d 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -246,7 +246,6 @@ struct dns_view { #define DNS_VIEWATTR_ADBSHUTDOWN 0x02 #define DNS_VIEWATTR_REQSHUTDOWN 0x04 -#ifdef HAVE_LMDB #define DNS_LMDB_COMMON_FLAGS (MDB_CREATE | MDB_NOSUBDIR | MDB_NOLOCK) #ifndef __OpenBSD__ #define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS) @@ -257,7 +256,6 @@ struct dns_view { */ #define DNS_LMDB_FLAGS (DNS_LMDB_COMMON_FLAGS | MDB_WRITEMAP) #endif /* __OpenBSD__ */ -#endif /* HAVE_LMDB */ isc_result_t dns_view_create(isc_mem_t *mctx, isc_loopmgr_t *loopmgr, diff --git a/lib/dns/view.c b/lib/dns/view.c index d2f21ee8ba..f6c056ac8a 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -15,11 +15,8 @@ #include #include -#include - -#ifdef HAVE_LMDB #include -#endif /* ifdef HAVE_LMDB */ +#include #include #include @@ -392,7 +389,6 @@ destroy(dns_view_t *view) { isc_mem_free(view->mctx, view->new_zone_dir); view->new_zone_dir = NULL; } -#ifdef HAVE_LMDB if (view->new_zone_dbenv != NULL) { mdb_env_close((MDB_env *)view->new_zone_dbenv); view->new_zone_dbenv = NULL; @@ -401,7 +397,6 @@ destroy(dns_view_t *view) { isc_mem_free(view->mctx, view->new_zone_db); view->new_zone_db = NULL; } -#endif /* HAVE_LMDB */ dns_fwdtable_destroy(&view->fwdtable); dns_aclenv_detach(&view->aclenv); if (view->failcache != NULL) { @@ -1787,14 +1782,8 @@ dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, void (*cfg_destroy)(void **), uint64_t mapsize) { isc_result_t result = ISC_R_SUCCESS; char buffer[1024]; -#ifdef HAVE_LMDB MDB_env *env = NULL; int status; -#endif /* ifdef HAVE_LMDB */ - -#ifndef HAVE_LMDB - UNUSED(mapsize); -#endif /* ifndef HAVE_LMDB */ REQUIRE(DNS_VIEW_VALID(view)); REQUIRE((cfgctx != NULL && cfg_destroy != NULL) || !allow); @@ -1804,7 +1793,6 @@ dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, view->new_zone_file = NULL; } -#ifdef HAVE_LMDB if (view->new_zone_dbenv != NULL) { mdb_env_close((MDB_env *)view->new_zone_dbenv); view->new_zone_dbenv = NULL; @@ -1814,7 +1802,6 @@ dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, isc_mem_free(view->mctx, view->new_zone_db); view->new_zone_db = NULL; } -#endif /* HAVE_LMDB */ if (view->new_zone_config != NULL) { view->cfg_destroy(&view->new_zone_config); @@ -1830,7 +1817,6 @@ dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, view->new_zone_file = isc_mem_strdup(view->mctx, buffer); -#ifdef HAVE_LMDB CHECK(nz_legacy(view->new_zone_dir, view->name, "nzd", buffer, sizeof(buffer))); @@ -1866,7 +1852,6 @@ dns_view_setnewzones(dns_view_t *view, bool allow, void *cfgctx, view->new_zone_dbenv = env; env = NULL; -#endif /* HAVE_LMDB */ view->new_zone_config = cfgctx; view->cfg_destroy = cfg_destroy; @@ -1878,7 +1863,6 @@ cleanup: view->new_zone_file = NULL; } -#ifdef HAVE_LMDB if (view->new_zone_db != NULL) { isc_mem_free(view->mctx, view->new_zone_db); view->new_zone_db = NULL; @@ -1886,7 +1870,7 @@ cleanup: if (env != NULL) { mdb_env_close(env); } -#endif /* HAVE_LMDB */ + view->new_zone_config = NULL; view->cfg_destroy = NULL; } diff --git a/lib/isccfg/namedconf.c b/lib/isccfg/namedconf.c index e6bef96e3c..453c3b10c8 100644 --- a/lib/isccfg/namedconf.c +++ b/lib/isccfg/namedconf.c @@ -2061,11 +2061,7 @@ static cfg_clausedef_t view_clauses[] = { { "ipv4only-server", &cfg_type_astring, 0 }, { "ixfr-from-differences", &cfg_type_ixfrdifftype, 0 }, { "lame-ttl", &cfg_type_duration, 0 }, -#ifdef HAVE_LMDB - { "lmdb-mapsize", &cfg_type_sizeval, CFG_CLAUSEFLAG_OPTIONAL }, -#else /* ifdef HAVE_LMDB */ - { "lmdb-mapsize", &cfg_type_sizeval, CFG_CLAUSEFLAG_NOTCONFIGURED }, -#endif /* ifdef HAVE_LMDB */ + { "lmdb-mapsize", &cfg_type_sizeval, 0 }, { "max-acache-size", NULL, CFG_CLAUSEFLAG_ANCIENT }, { "max-cache-size", &cfg_type_sizeorpercent, 0 }, { "max-cache-ttl", &cfg_type_duration, 0 },