--- bind/bin/check/named-checkconf.8 +++ bind/bin/check/named-checkconf.8 @@ -45,6 +45,7 @@ checks the syntax, but not the semantics, of a named configuration file. Chroot to \fIdirectory\fR so that include directives in the configuration file are processed as if run by a similarly chrooted named. +By default, \fBnamed\-checkconf\fR will \fBchroot()\fR to \fI@ROOT@\fR. .RE .PP \-v --- bind/bin/check/named-checkconf.c +++ bind/bin/check/named-checkconf.c @@ -208,6 +208,7 @@ main(int argc, char **argv) { int exit_status = 0; isc_entropy_t *ectx = NULL; isc_boolean_t load_zones = ISC_FALSE; + const char *chroot_dir = "@ROOT@"; while ((c = isc_commandline_parse(argc, argv, "djt:vz")) != EOF) { switch (c) { @@ -220,18 +221,7 @@ main(int argc, char **argv) { break; case 't': - result = isc_dir_chroot(isc_commandline_argument); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "isc_dir_chroot: %s\n", - isc_result_totext(result)); - exit(1); - } - result = isc_dir_chdir("/"); - if (result != ISC_R_SUCCESS) { - fprintf(stderr, "isc_dir_chdir: %s\n", - isc_result_totext(result)); - exit(1); - } + chroot_dir = isc_commandline_argument; break; case 'v': @@ -247,6 +237,19 @@ main(int argc, char **argv) { } } + result = isc_dir_chroot(chroot_dir); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "isc_dir_chroot: %s\n", + isc_result_totext(result)); + exit(1); + } + result = isc_dir_chdir("/"); + if (result != ISC_R_SUCCESS) { + fprintf(stderr, "isc_dir_chdir: %s\n", + isc_result_totext(result)); + exit(1); + } + if (argv[isc_commandline_index] != NULL) conffile = argv[isc_commandline_index]; if (conffile == NULL || conffile[0] == '\0')