conf/97192: /etc/rc.d/jail script tests for empty variable using
faulty method
Aaron Gifford
agifford at infowest.com
Sat May 13 05:50:20 UTC 2006
>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:
More information about the freebsd-bugs
mailing list