- 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
This commit is contained in:
Wouter Wijngaards 2018-11-29 12:55:13 +00:00
parent c417f733af
commit 81ded6124d
2 changed files with 4 additions and 15 deletions

View file

@ -2,6 +2,8 @@
- iana portlist updated. - iana portlist updated.
- Fix chroot auth-zone fix to remove chroot prefix. - Fix chroot auth-zone fix to remove chroot prefix.
- tag for 1.8.2rc1. - 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 28 November 2018: Wouter
- Fix leak in chroot fix for auth-zone. - Fix leak in chroot fix for auth-zone.

View file

@ -431,7 +431,7 @@ check_modules_exist(const char* module_conf)
/** check configuration for errors */ /** check configuration for errors */
static void static void
morechecks(struct config_file* cfg, const char* fname) morechecks(struct config_file* cfg)
{ {
warn_hosts("stub-host", cfg->stubs); warn_hosts("stub-host", cfg->stubs);
warn_hosts("forward-host", cfg->forwards); warn_hosts("forward-host", cfg->forwards);
@ -463,19 +463,6 @@ morechecks(struct config_file* cfg, const char* fname)
!is_dir(cfg->chrootdir)) { !is_dir(cfg->chrootdir)) {
fatal_exit("bad chroot directory"); 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]) { if(cfg->directory && cfg->directory[0]) {
char* ad = fname_after_chroot(cfg->directory, cfg, 0); char* ad = fname_after_chroot(cfg->directory, cfg, 0);
if(!ad) fatal_exit("out of memory"); if(!ad) fatal_exit("out of memory");
@ -680,7 +667,7 @@ checkconf(const char* cfgfile, const char* opt, int final)
config_delete(cfg); config_delete(cfg);
return; return;
} }
morechecks(cfg, cfgfile); morechecks(cfg);
check_mod(cfg, iter_get_funcblock()); check_mod(cfg, iter_get_funcblock());
check_mod(cfg, val_get_funcblock()); check_mod(cfg, val_get_funcblock());
#ifdef WITH_PYTHONMODULE #ifdef WITH_PYTHONMODULE