From owner-freebsd-bugs Fri Dec 20 7:30:13 2002 Delivered-To: freebsd-bugs@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 11CF737B401; Fri, 20 Dec 2002 07:30:11 -0800 (PST) Received: from gs166.sp.cs.cmu.edu (GS166.SP.CS.CMU.EDU [128.2.205.169]) by mx1.FreeBSD.org (Postfix) with SMTP id 3E78143EE5; Fri, 20 Dec 2002 07:30:10 -0800 (PST) (envelope-from dpelleg@gs166.sp.cs.cmu.edu) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15875.14178.943577.287779@gs166.sp.cs.cmu.edu> Date: Fri, 20 Dec 2002 10:29:38 -0500 To: FreeBSD-gnats-submit@FreeBSD.org, freebsd-bugs@FreeBSD.org Subject: Re: conf/46401: [PATCH] /etc/rc.d/named doesn't create chroot dirs In-Reply-To: <200212201400.gBKE0FCk018705@freefall.freebsd.org> References: <20021220135719.3EF84B627D@mail.pelleg.org> <200212201400.gBKE0FCk018705@freefall.freebsd.org> X-Mailer: VM 6.90 under 21.1 (patch 14) "Cuyahoga Valley" XEmacs Lucid From: Dan Pelleg Reply-To: Dan Pelleg Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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