mirror of
https://github.com/NLnetLabs/unbound.git
synced 2026-02-10 06:13:20 -05:00
fix for bug 180
git-svn-id: file:///svn/unbound/trunk@1101 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
parent
97854e6bc5
commit
ef69508048
1 changed files with 7 additions and 7 deletions
|
|
@ -248,18 +248,18 @@ fname_after_chroot(const char* fname, struct config_file* cfg, int use_chdir)
|
|||
} else if(cfg->directory && cfg->directory[0]) {
|
||||
/* prepend chdir */
|
||||
if(slashit && cfg->directory[0] != '/')
|
||||
strncat(buf, "/", sizeof(buf)-1);
|
||||
strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
|
||||
if(strncmp(cfg->chrootdir, cfg->directory,
|
||||
strlen(cfg->chrootdir)) == 0)
|
||||
strncat(buf, cfg->directory+strlen(cfg->chrootdir),
|
||||
sizeof(buf)-1);
|
||||
else strncat(buf, cfg->directory, sizeof(buf)-1);
|
||||
sizeof(buf)-strlen(buf)-1);
|
||||
else strncat(buf, cfg->directory, sizeof(buf)-strlen(buf)-1);
|
||||
slashit = 1;
|
||||
}
|
||||
/* fname */
|
||||
if(slashit && fname[0] != '/')
|
||||
strncat(buf, "/", sizeof(buf)-1);
|
||||
strncat(buf, fname, sizeof(buf)-1);
|
||||
strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
|
||||
strncat(buf, fname, sizeof(buf)-strlen(buf)-1);
|
||||
buf[sizeof(buf)-1] = 0;
|
||||
return buf;
|
||||
}
|
||||
|
|
@ -329,9 +329,9 @@ morechecks(struct config_file* cfg, char* fname)
|
|||
if(fname[0] != '/') {
|
||||
if(getcwd(buf, sizeof(buf)) == NULL)
|
||||
fatal_exit("getcwd: %s", strerror(errno));
|
||||
strncat(buf, "/", sizeof(buf));
|
||||
strncat(buf, "/", sizeof(buf)-strlen(buf)-1);
|
||||
}
|
||||
strncat(buf, fname, sizeof(buf));
|
||||
strncat(buf, fname, sizeof(buf)-strlen(buf)-1);
|
||||
if(strncmp(buf, cfg->chrootdir, strlen(cfg->chrootdir)) != 0)
|
||||
fatal_exit("config file %s is not inside chroot %s",
|
||||
buf, cfg->chrootdir);
|
||||
|
|
|
|||
Loading…
Reference in a new issue