Date: Fri, 20 Dec 2002 07:40:03 -0800 (PST) From: Dan Pelleg <daniel+bsd@pelleg.org> To: freebsd-bugs@FreeBSD.org Subject: Re: conf/46401: [PATCH] /etc/rc.d/named doesn't create chroot dirs Message-ID: <200212201540.gBKFe3Al019622@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR conf/46401; it has been noted by GNATS.
From: Dan Pelleg <daniel+bsd@pelleg.org>
To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org
Cc:
Subject: Re: conf/46401: [PATCH] /etc/rc.d/named doesn't create chroot dirs
Date: Fri, 20 Dec 2002 10:29:38 -0500
Oops; there are a few more files that need to go into the jail together
with named-xfer (this is another bug in the original
/etc/rc.d/named). The following patch corrects this and also includes the
original patch.
--- /etc/rc.d/named.orig Thu Dec 19 21:11:19 2002
+++ /etc/rc.d/named Fri Dec 20 10:20:19 2002
@@ -17,6 +17,7 @@
pidfile="/var/run/${name}.pid"
start_precmd="named_precmd"
required_dirs="$named_chrootdir" # if it is set, it must exist
+named_chroot="$named_chrootdir"
extra_commands="reload"
case ${OSTYPE} in
@@ -41,30 +42,32 @@
#
chroot_autoupdate()
{
- # If the named-xfer in the system is newer than the one in the
+ # If the file in the system is newer than the one in the
# chroot directory or if it (in the chrootdir) doesn't exist
# copy it over
#
- if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \
- "${named_chrootdir}/usr/libexec/named-xfer" -ot \
- /usr/libexec/named-xfer ]; then
- rm -f "${named_chrootdir}/usr/libexec/named-xfer"
- cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec"
- fi
+ for f in /usr/libexec/named-xfer /usr/libexec/ld-elf.so.1 /usr/lib/libc.so.5 ; do
+ if [ ! -x "${named_chrootdir}${f}" -o \
+ "${named_chrootdir}${f}" -ot \
+ ${f} ]; then
+ rm -f "${named_chrootdir}${f}"
+ /bin/pax -rw -pe ${f} "${named_chrootdir}/"
+ fi
+ done
# Copy /dev/null over, if neccessary. Preserve everything (perms,
# ownership, mod times).
#
if [ ! -c "${named_chrootdir}/dev/null" ]; then
- rm -f "${named_chrootdir}/dev/null"
- ( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" )
+ rm -f "${named_chrootdir}/dev/null"
+ /bin/pax -rw -pe /dev/null "${named_chrootdir}/"
fi
# Copy local timezone information if it's not up-to-date.
#
if [ -f /etc/localtime ]; then
cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
- cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
+ pax -rw -pe /etc/localtime "${named_chrootdir}/"
fi
}
@@ -72,9 +75,11 @@
#
make_symlinks()
{
- ln -fs "${named_chrootdir}/var/run/named.pid" /var/run/named.pid
+ if [ ! -d ${named_chrootdir}/var/run ]; then
+ mkdir -p "${named_chrootdir}/var/run"
+ fi
+ ln -fs "${named_chrootdir}${pidfile}" ${pidfile}
ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc
-
}
named_precmd()
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212201540.gBKFe3Al019622>
