From owner-freebsd-bugs Fri Dec 20 7:40: 6 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FE2A37B401 for ; Fri, 20 Dec 2002 07:40:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 06C5743EE8 for ; Fri, 20 Dec 2002 07:40:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id gBKFe3NS019623 for ; Fri, 20 Dec 2002 07:40:03 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gBKFe3Al019622; Fri, 20 Dec 2002 07:40:03 -0800 (PST) Date: Fri, 20 Dec 2002 07:40:03 -0800 (PST) Message-Id: <200212201540.gBKFe3Al019622@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Dan Pelleg Subject: Re: conf/46401: [PATCH] /etc/rc.d/named doesn't create chroot dirs 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 The following reply was made to PR conf/46401; it has been noted by GNATS. From: Dan Pelleg 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