From: Wouter Wijngaards Date: Thu, 29 Nov 2018 12:55:13 +0000 (+0000) Subject: - Fix that unbound-checkconf does not complains if the config file X-Git-Tag: release-1.9.0rc1~84 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81ded6124d291f59c0774be7ea9c3559a6f1d3f3;p=thirdparty%2Funbound.git - Fix that unbound-checkconf does not complains if the config file is not placed inside the chroot. git-svn-id: file:///svn/unbound/trunk@4995 be551aaa-1e26-0410-a405-d3ace91eadb9 --- diff --git a/doc/Changelog b/doc/Changelog index 21b0e7fcc..82d91c1a8 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -2,6 +2,8 @@ - iana portlist updated. - Fix chroot auth-zone fix to remove chroot prefix. - tag for 1.8.2rc1. + - Fix that unbound-checkconf does not complains if the config file + is not placed inside the chroot. 28 November 2018: Wouter - Fix leak in chroot fix for auth-zone. diff --git a/smallapp/unbound-checkconf.c b/smallapp/unbound-checkconf.c index ea4647917..eddd3e172 100644 --- a/smallapp/unbound-checkconf.c +++ b/smallapp/unbound-checkconf.c @@ -431,7 +431,7 @@ check_modules_exist(const char* module_conf) /** check configuration for errors */ static void -morechecks(struct config_file* cfg, const char* fname) +morechecks(struct config_file* cfg) { warn_hosts("stub-host", cfg->stubs); warn_hosts("forward-host", cfg->forwards); @@ -463,19 +463,6 @@ morechecks(struct config_file* cfg, const char* fname) !is_dir(cfg->chrootdir)) { fatal_exit("bad chroot directory"); } - if(cfg->chrootdir && cfg->chrootdir[0]) { - char buf[10240]; - buf[0] = 0; - if(fname[0] != '/') { - if(getcwd(buf, sizeof(buf)) == NULL) - fatal_exit("getcwd: %s", strerror(errno)); - (void)strlcat(buf, "/", sizeof(buf)); - } - (void)strlcat(buf, fname, sizeof(buf)); - if(strncmp(buf, cfg->chrootdir, strlen(cfg->chrootdir)) != 0) - fatal_exit("config file %s is not inside chroot %s", - buf, cfg->chrootdir); - } if(cfg->directory && cfg->directory[0]) { char* ad = fname_after_chroot(cfg->directory, cfg, 0); if(!ad) fatal_exit("out of memory"); @@ -680,7 +667,7 @@ checkconf(const char* cfgfile, const char* opt, int final) config_delete(cfg); return; } - morechecks(cfg, cfgfile); + morechecks(cfg); check_mod(cfg, iter_get_funcblock()); check_mod(cfg, val_get_funcblock()); #ifdef WITH_PYTHONMODULE