]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
restore the former change_directory logging
authorEvan Hunt <each@isc.org>
Thu, 23 Oct 2025 18:44:15 +0000 (11:44 -0700)
committerEvan Hunt <each@isc.org>
Thu, 23 Oct 2025 20:01:31 +0000 (13:01 -0700)
change_directory() now lives in libisccfg. when it was moved,
the logging behavior changed: previously it had been logged
by named only, in the general logging category, and without the
named.conf filename and line number. it was not logged by
named-checkconf. this behavior has now been restored.

bin/named/server.c
lib/isccfg/parser.c

index dbf5dc52bf1a63b05b8b40a276c2ba691195b3e5..5d7f74cb1933cb6aaf2b2f12e0b6fe577a7a6850 100644 (file)
@@ -8143,8 +8143,7 @@ apply_configuration(cfg_obj_t *config, cfg_obj_t *bindkeys,
                if (getcwd(cwd, sizeof(cwd)) == cwd) {
                        isc_log_write(NAMED_LOGCATEGORY_GENERAL,
                                      NAMED_LOGMODULE_SERVER, ISC_LOG_INFO,
-                                     "the initial working directory is '%s'",
-                                     cwd);
+                                     "the working directory is now '%s'", cwd);
                }
        }
 
index f0af06a8bb5e97cb707b07829ce9753bde164f95..f5e2dbffd93e14c6344d622494254c94eb292576 100644 (file)
@@ -136,8 +136,8 @@ static void
 free_map(cfg_obj_t *obj);
 
 static isc_result_t
-parse_symtab_elt(cfg_parser_t *pctx, const char *name, cfg_type_t *elttype,
-                isc_symtab_t *symtab, bool callback);
+parse_symtab_elt(cfg_parser_t *pctx, const cfg_clausedef_t *clause,
+                isc_symtab_t *symtab);
 
 static void
 free_noop(cfg_obj_t *obj);
@@ -2360,12 +2360,8 @@ cfg_parse_mapbody(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret) {
                        CHECK(parse_semicolon(pctx));
                } else {
                        /* Single-valued clause */
-                       bool chdir = ((clause->flags & CFG_CLAUSEFLAG_CHDIR) !=
-                                     0);
-
-                       result = parse_symtab_elt(pctx, clause->name,
-                                                 clause->type,
-                                                 obj->value.map.symtab, chdir);
+                       result = parse_symtab_elt(pctx, clause,
+                                                 obj->value.map.symtab);
                        if (result == ISC_R_EXISTS) {
                                cfg_parser_error(pctx, CFG_LOG_NEAR,
                                                 "'%s' redefined",
@@ -2392,19 +2388,13 @@ cleanup:
 }
 
 static isc_result_t
-change_directory(const char *clausename, const cfg_obj_t *obj) {
+change_directory(const cfg_obj_t *obj) {
        isc_result_t result;
-       const char *directory;
-
-       REQUIRE(strcasecmp("directory", clausename) == 0);
-
-       UNUSED(clausename);
+       const char *directory = cfg_obj_asstring(obj);
 
        /*
         * Change directory.
         */
-       directory = cfg_obj_asstring(obj);
-
        if (!isc_file_ischdiridempotent(directory)) {
                cfg_obj_log(obj, ISC_LOG_WARNING,
                            "option 'directory' contains relative path '%s'",
@@ -2425,30 +2415,24 @@ change_directory(const char *clausename, const cfg_obj_t *obj) {
                return result;
        }
 
-       char cwd[PATH_MAX];
-       if (getcwd(cwd, sizeof(cwd)) == cwd) {
-               cfg_obj_log(obj, ISC_LOG_INFO,
-                           "the working directory is now '%s'", cwd);
-       }
-
        return ISC_R_SUCCESS;
 }
 
 static isc_result_t
-parse_symtab_elt(cfg_parser_t *pctx, const char *name, cfg_type_t *elttype,
-                isc_symtab_t *symtab, bool chdir) {
+parse_symtab_elt(cfg_parser_t *pctx, const cfg_clausedef_t *clause,
+                isc_symtab_t *symtab) {
        isc_result_t result;
        cfg_obj_t *obj = NULL;
        isc_symvalue_t symval;
 
-       CHECK(cfg_parse_obj(pctx, elttype, &obj));
+       CHECK(cfg_parse_obj(pctx, clause->type, &obj));
 
-       if (chdir) {
-               CHECK(change_directory(name, obj));
+       if ((clause->flags & CFG_CLAUSEFLAG_CHDIR) != 0) {
+               CHECK(change_directory(obj));
        }
 
        symval.as_pointer = obj;
-       CHECK(isc_symtab_define(symtab, name, SYMTAB_DUMMY_TYPE, symval,
+       CHECK(isc_symtab_define(symtab, clause->name, SYMTAB_DUMMY_TYPE, symval,
                                isc_symexists_reject));
        return ISC_R_SUCCESS;