From aba487a71c2c5cab76a4146e544fa0f39fa87dd1 Mon Sep 17 00:00:00 2001 From: Jakob Schlyter Date: Sun, 17 Jan 2010 19:32:41 +0000 Subject: add --with-chroot option to set default chroot directory --- usr.sbin/nsd/configure.ac | 10 ++++++++++ usr.sbin/nsd/nsd.c | 1 + 2 files changed, 11 insertions(+) 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 @@ -122,6 +122,16 @@ AC_ARG_WITH([xfrdfile], AC_HELP_STRING([--with-xfrdfile=path], AC_DEFINE_UNQUOTED(XFRDFILE, ["`eval echo $xfrdfile`"], [Pathname to the NSD xfrd zone timer state file.]) 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 # 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; -- cgit v1.2.3