Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Oct 2005 19:30:10 +0200
From:      Dirk Engling <erdgeist@erdgeist.org>
To:        freebsd-rc@freebsd.org
Subject:   defunc: /etc/rc.d/jail restart 
Message-ID:  <4357D422.2000200@erdgeist.org>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

The /etc/rc.d/jail script does nothing when its restart subcommand is
called.

This is due to these lines:

##### in /etc/rc.d/jail, line 246ff

cmd="$1"
if [ $# -gt 0 ]; then
~        shift
fi
[ -n "$*" ] && jail_list="$*"
run_rc_command "${cmd}"

##### in /etc/rc.subr, line 773f

( $0 ${_rc_prefix}stop $rc_extra_args )
$0 ${_rc_prefix}start $rc_extra_args

##### in /etc/defaults/rc.conf, line 513

jail_list=""            # Space separated list of names of jails




So /etc/rc.d/jail throws away the parameters after saving its value in
$jail_list. It calls /etc/rc.subr which, for the restart command, then
calls /etc/rc.d/jail stop and /etc/rc.d/jail start, which both in turn
source /etc/defaults/rc.conf, which again clears $jail_list.

My suggestion would be to let /etc/defaults/* just do the job it is
being meant for: providing defaults. This would lead to the following diff.


- --- rc.conf     Thu Oct 20 19:25:13 2005
+++ rc.conf_old Thu Oct 20 19:24:16 2005
@@ -510,7 +510,7 @@
~ ### Jail Configuration #######################################
~ ##############################################################
~ jail_enable="NO"       # Set to NO to disable starting of any jails
- -jail_list=${jail_list:-""} # Space separated list of names of jails
+jail_list=""           # Space separated list of names of jails
~ jail_set_hostname_allow="YES" # Allow root user in a jail to change its
hostname
~ jail_socket_unixiproute_only="YES" # Route only TCP/IP within a jail
~ jail_sysvipc_allow="NO"        # Allow SystemV IPC use from within a jail


However, theres lots of variables that should not be reset if already
set, I might want to call /etc/rc.d/jail having set up some variables
(including jail_list) myself (which in fact I tried in another project).

Are there any situation, where accepting variables from environment of
caller can be harmful?

Regards

~  Dirk Engling
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (Darwin)

iD8DBQFDV9QiImmQdUyYEgkRAm9MAKCOYcJOBj8hQFGcdgGJ/lwRkQnRhACeNjVt
Edbt/WyJy/NtcOEHuS+L4cc=
=jjHt
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4357D422.2000200>