diff options
author | Jakob Schlyter <jakob@cvs.openbsd.org> | 2010-01-17 19:32:41 +0000 |
---|---|---|
committer | Jakob Schlyter <jakob@cvs.openbsd.org> | 2010-01-17 19:32:41 +0000 |
commit | aba487a71c2c5cab76a4146e544fa0f39fa87dd1 (patch) | |
tree | 230381b343c90bed68391604f0f60b3c8ac6dfad | |
parent | ea743cad0b9667e0dad556ca9067b505eb49b8ef (diff) |
add --with-chroot option to set default chroot directory
-rw-r--r-- | usr.sbin/nsd/configure.ac | 10 | ||||
-rw-r--r-- | usr.sbin/nsd/nsd.c | 1 |
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; |