defunc: /etc/rc.d/jail restart
Yar Tikhiy
yar at comp.chem.msu.su
Thu Oct 20 12:39:32 PDT 2005
On Thu, Oct 20, 2005 at 07:30:10PM +0200, Dirk Engling wrote:
> -----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
IMHO the source of the problem is these two lines. I think they
should be replaced by calls to run_rc_command so that the configuration
is read only once by load_rc_config in the first (and the only)
instance of the script.
> ##### 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-----
> _______________________________________________
> freebsd-rc at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-rc
> To unsubscribe, send any mail to "freebsd-rc-unsubscribe at freebsd.org"
--
Yar
More information about the freebsd-rc
mailing list