From owner-freebsd-bugs@FreeBSD.ORG Sat May 13 05:50:19 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org 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 CC12616A402 for ; Sat, 13 May 2006 05:50:19 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 44BDF43D46 for ; Sat, 13 May 2006 05:50:19 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k4D5oJKc057377 for ; Sat, 13 May 2006 05:50:19 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k4D5oJUC057375; Sat, 13 May 2006 05:50:19 GMT (envelope-from gnats) Resent-Date: Sat, 13 May 2006 05:50:19 GMT Resent-Message-Id: <200605130550.k4D5oJUC057375@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Aaron Gifford Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9D78816A402 for ; Sat, 13 May 2006 05:48:14 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4F51B43D45 for ; Sat, 13 May 2006 05:48:14 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k4D5mEik096776 for ; Sat, 13 May 2006 05:48:14 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id k4D5mEUq096775; Sat, 13 May 2006 05:48:14 GMT (envelope-from nobody) Message-Id: <200605130548.k4D5mEUq096775@www.freebsd.org> Date: Sat, 13 May 2006 05:48:14 GMT From: Aaron Gifford To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Cc: Subject: conf/97192: /etc/rc.d/jail script tests for empty variable using faulty method X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 13 May 2006 05:50:20 -0000 >Number: 97192 >Category: conf >Synopsis: /etc/rc.d/jail script tests for empty variable using faulty method >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat May 13 05:50:18 GMT 2006 >Closed-Date: >Last-Modified: >Originator: Aaron Gifford >Release: 6.1-RELEASE >Organization: >Environment: FreeBSD host.name 6.1-RELEASE FreeBSD 6.1-RELEASE #1: Fri May 12 15:21:07 MDT 2006 >Description: The RC script /etc/rc.d/jail does the following test: if [ -n ${jail_interface} ]; then The '[' test operator will ALWAYS evaluate the above as true, even when the variable jail_interface is empty. This bug is a showstopper if you upgrade from FreeBSD 5.x to 6.1-RELEASE and expect existing configured jails to work correclty. Some may, but those which depend on the jail system NOT automatically adding an alias IP will fail to launch. Sorry if this has already been reported. The www.freebsd.org bugs web page does NOT have a form to search existing bug reports to see if any similar submissions have already been made. >How-To-Repeat: Attempt to configure a jail using rc.conf in such a way that you desire an empty jail_interface variable. Starting/stopping the jail will fail due to the RC script bug. >Fix: Solution: Add double quotes around the variable in the test. ############### PATCH: --- jail.orig Fri May 12 17:27:40 2006 +++ jail Fri May 12 17:27:47 2006 @@ -164,7 +164,7 @@ echo -n " [${jail_hostname} already running (/var/run/jail_${_jail}.id exists)]" continue; fi - if [ -n ${jail_interface} ]; then + if [ -n "${jail_interface}" ]; then ifconfig ${jail_interface} alias ${jail_ip} netmask 255.255.255.255 fi if checkyesno jail_mount; then @@ -239,7 +239,7 @@ jail_umount_fs echo -n " $jail_hostname" fi - if [ -n ${jail_interface} ]; then + if [ -n "${jail_interface}" ]; then ifconfig ${jail_interface} -alias ${jail_ip} fi rm /var/run/jail_${_jail}.id >Release-Note: >Audit-Trail: >Unformatted: