summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/nsd/configure.ac10
-rw-r--r--usr.sbin/nsd/nsd.c1
2 files changed, 11 insertions, 0 deletions
diff --git a/usr.sbin/nsd/configure.ac b/usr.sbin/nsd/configure.ac
index ccabe1462c9..a16176758c1 100644
--- a/usr.sbin/nsd/configure.ac
+++ b/usr.sbin/nsd/configure.ac
@@ -123,6 +123,16 @@ AC_DEFINE_UNQUOTED(XFRDFILE, ["`eval echo $xfrdfile`"], [Pathname to the NSD xfr
AC_SUBST(xfrdfile)
#
+# Determine default chroot directory
+#
+chrootdir="/"
+AC_ARG_WITH([chroot],
+ AC_HELP_STRING([--with-chroot=dir], [NSD default chroot directory]),
+ [chrootdir=$withval])
+AC_SUBST(chrootdir)
+AC_DEFINE_UNQUOTED(CHROOTDIR, ["`eval echo $chrootdir`"], [NSD default chroot directory.])
+
+#
# Determine the user name to drop privileges to
#
user=nsd
diff --git a/usr.sbin/nsd/nsd.c b/usr.sbin/nsd/nsd.c
index 708d897fcfd..b223a1f28b8 100644
--- a/usr.sbin/nsd/nsd.c
+++ b/usr.sbin/nsd/nsd.c
@@ -649,6 +649,7 @@ main(int argc, char *argv[])
#endif /* BIND8_STATS */
#ifdef HAVE_CHROOT
if(nsd.chrootdir == 0) nsd.chrootdir = nsd.options->chroot;
+ if(nsd.chrootdir == 0) nsd.chrootdir = strdup(CHROOTDIR);
#endif /* HAVE_CHROOT */
if(nsd.username == 0) {
if(nsd.options->username) nsd.username = nsd.options->username;